1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs

This commit is contained in:
Vincent Belaïche 2017-07-13 23:25:34 +02:00
commit ab87dbad1d
10 changed files with 104 additions and 67 deletions

View file

@ -442,7 +442,7 @@ new face 'line-number-current-line' can be customized to display the
current line's number differently from all the other line numbers; by current line's number differently from all the other line numbers; by
default these two faces are identical. default these two faces are identical.
You can also customize the new variable 'display-line-number-width' to You can also customize the new variable 'display-line-numbers-width' to
specify a fixed minimal with of the area allocated to line-number specify a fixed minimal with of the area allocated to line-number
display. The default is nil, meaning that Emacs will dynamically display. The default is nil, meaning that Emacs will dynamically
calculate the area width, enlarging or shrinking it as needed. calculate the area width, enlarging or shrinking it as needed.

View file

@ -594,7 +594,7 @@ since it could result in memory overflow and make Emacs crash."
(const :tag "Visually relative line numbers" (const :tag "Visually relative line numbers"
:value visual)) :value visual))
"26.1") "26.1")
(display-line-number-width display (display-line-numbers-width display
(choice (choice
(const :tag "Dynamically computed" (const :tag "Dynamically computed"
:value nil) :value nil)

View file

@ -2473,7 +2473,7 @@ See also `toggle-frame-maximized'."
wrap-prefix wrap-prefix
truncate-lines truncate-lines
display-line-numbers display-line-numbers
display-line-number-width display-line-numbers-width
display-line-numbers-current-absolute display-line-numbers-current-absolute
display-line-numbers-widen display-line-numbers-widen
bidi-paragraph-direction bidi-paragraph-direction

View file

@ -1843,19 +1843,25 @@ with a brace block."
(unless (eq where 'at-header) (unless (eq where 'at-header)
(c-backward-to-nth-BOF-{ 1 where) (c-backward-to-nth-BOF-{ 1 where)
(c-beginning-of-decl-1)) (c-beginning-of-decl-1))
(when (looking-at c-typedef-key)
(goto-char (match-end 0))
(c-forward-syntactic-ws))
;; Pick out the defun name, according to the type of defun. ;; Pick out the defun name, according to the type of defun.
(cond (cond
;; struct, union, enum, or similar: ;; struct, union, enum, or similar:
((and (looking-at c-type-prefix-key) ((looking-at c-type-prefix-key)
(progn (c-forward-token-2 2) ; over "struct foo " (let ((key-pos (point)))
(or (eq (char-after) ?\{) (c-forward-token-2 1) ; over "struct ".
(looking-at c-symbol-key)))) ; "struct foo bar ..." (cond
(save-match-data (c-forward-token-2)) ((looking-at c-symbol-key) ; "struct foo { ..."
(when (eq (char-after) ?\{) (buffer-substring-no-properties key-pos (match-end 0)))
(c-backward-token-2) ((eq (char-after) ?{) ; "struct { ... } foo"
(looking-at c-symbol-key)) (when (c-go-list-forward)
(match-string-no-properties 0)) (c-forward-syntactic-ws)
(when (looking-at c-symbol-key) ; a bit bogus - there might
; be several identifiers.
(match-string-no-properties 0)))))))
((looking-at "DEFUN\\s-*(") ;"DEFUN\\_>") think of XEmacs! ((looking-at "DEFUN\\s-*(") ;"DEFUN\\_>") think of XEmacs!
;; DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, ...) ==> Ffile_name_directory ;; DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, ...) ==> Ffile_name_directory
@ -1900,7 +1906,8 @@ with a brace block."
(c-backward-syntactic-ws)) (c-backward-syntactic-ws))
(setq name-end (point)) (setq name-end (point))
(c-back-over-compound-identifier) (c-back-over-compound-identifier)
(buffer-substring-no-properties (point) name-end))))))))) (and (looking-at c-symbol-start)
(buffer-substring-no-properties (point) name-end))))))))))
(defun c-declaration-limits (near) (defun c-declaration-limits (near)
;; Return a cons of the beginning and end positions of the current ;; Return a cons of the beginning and end positions of the current

View file

@ -417,6 +417,17 @@ to it is returned. This function does not modify the point or the mark."
;; Emacs. ;; Emacs.
`(setq mark-active ,activate))) `(setq mark-active ,activate)))
(defmacro c-set-keymap-parent (map parent)
(cond
;; XEmacs
((cc-bytecomp-fboundp 'set-keymap-parents)
`(set-keymap-parents ,map ,parent))
;; Emacs
((cc-bytecomp-fboundp 'set-keymap-parent)
`(set-keymap-parent ,map ,parent))
;; incompatible
(t (error "CC Mode is incompatible with this version of Emacs"))))
(defmacro c-delete-and-extract-region (start end) (defmacro c-delete-and-extract-region (start end)
"Delete the text between START and END and return it." "Delete the text between START and END and return it."
(if (cc-bytecomp-fboundp 'delete-and-extract-region) (if (cc-bytecomp-fboundp 'delete-and-extract-region)
@ -1266,6 +1277,7 @@ with value CHAR in the region [FROM to)."
(def-edebug-spec cc-eval-when-compile (&rest def-form)) (def-edebug-spec cc-eval-when-compile (&rest def-form))
(def-edebug-spec c-point t) (def-edebug-spec c-point t)
(def-edebug-spec c-set-region-active t) (def-edebug-spec c-set-region-active t)
(def-edebug-spec c-set-keymap-parent t)
(def-edebug-spec c-safe t) (def-edebug-spec c-safe t)
(def-edebug-spec c-save-buffer-state let*) (def-edebug-spec c-save-buffer-state let*)
(def-edebug-spec c-tentative-buffer-changes t) (def-edebug-spec c-tentative-buffer-changes t)

View file

@ -6091,6 +6091,13 @@ comment at the start of cc-engine.el for more info."
;; Clears `c-found-types'. ;; Clears `c-found-types'.
(setq c-found-types (make-vector 53 0))) (setq c-found-types (make-vector 53 0)))
(defun c-copy-found-types ()
(let ((copy (make-vector 53 0)))
(mapatoms (lambda (sym)
(intern (symbol-name sym) copy))
c-found-types)
copy))
(defun c-add-type (from to) (defun c-add-type (from to)
;; Add the given region as a type in `c-found-types'. If the region ;; Add the given region as a type in `c-found-types'. If the region
;; doesn't match an existing type but there is a type which is equal ;; doesn't match an existing type but there is a type which is equal
@ -7059,6 +7066,7 @@ comment at the start of cc-engine.el for more info."
;; This function might do hidden buffer changes. ;; This function might do hidden buffer changes.
(let ((start (point)) (let ((start (point))
(old-found-types (c-copy-found-types))
;; If `c-record-type-identifiers' is set then activate ;; If `c-record-type-identifiers' is set then activate
;; recording of any found types that constitute an argument in ;; recording of any found types that constitute an argument in
;; the arglist. ;; the arglist.
@ -7074,6 +7082,7 @@ comment at the start of cc-engine.el for more info."
(nconc c-record-found-types c-record-type-identifiers))) (nconc c-record-found-types c-record-type-identifiers)))
t) t)
(setq c-found-types old-found-types)
(goto-char start) (goto-char start)
nil))) nil)))

View file

@ -225,18 +225,7 @@ control). See \"cc-mode.el\" for more info."
(defun c-make-inherited-keymap () (defun c-make-inherited-keymap ()
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
;; Necessary to use `cc-bytecomp-fboundp' below since this (c-set-keymap-parent map c-mode-base-map)
;; function is called from top-level forms that are evaluated
;; while cc-bytecomp is active when one does M-x eval-buffer.
(cond
;; Emacs
((cc-bytecomp-fboundp 'set-keymap-parent)
(set-keymap-parent map c-mode-base-map))
;; XEmacs
((fboundp 'set-keymap-parents)
(set-keymap-parents map c-mode-base-map))
;; incompatible
(t (error "CC Mode is incompatible with this version of Emacs")))
map)) map))
(defun c-define-abbrev-table (name defs &optional doc) (defun c-define-abbrev-table (name defs &optional doc)
@ -276,6 +265,8 @@ control). See \"cc-mode.el\" for more info."
nil nil
(setq c-mode-base-map (make-sparse-keymap)) (setq c-mode-base-map (make-sparse-keymap))
(when (boundp 'prog-mode-map)
(c-set-keymap-parent c-mode-base-map prog-mode-map))
;; Separate M-BS from C-M-h. The former should remain ;; Separate M-BS from C-M-h. The former should remain
;; backward-kill-word. ;; backward-kill-word.
@ -446,27 +437,36 @@ preferably use the `c-mode-menu' language constant directly."
t)))) t))))
(defun c-unfind-coalesced-tokens (beg end) (defun c-unfind-coalesced-tokens (beg end)
;; unless the non-empty region (beg end) is entirely WS and there's at ;; If removing the region (beg end) would coalesce an identifier ending at
;; least one character of WS just before or after this region, remove ;; beg with an identifier (fragment) beginning at end, or an identifier
;; the tokens which touch the region from `c-found-types' should they ;; fragment ending at beg with an identifier beginning at end, remove the
;; be present. ;; pertinent identifier(s) from `c-found-types'.
(or (c-partial-ws-p beg end) (save-excursion
(save-excursion (when (< beg end)
(progn (goto-char beg)
(goto-char beg) (when
(or (eq beg (point-min)) (and (not (bobp))
(c-skip-ws-backward (1- beg)) (progn (c-backward-syntactic-ws) (eq (point) beg))
(/= (point) beg) (/= (skip-chars-backward c-symbol-chars (1- (point))) 0)
(= (c-backward-token-2) 1) (progn (goto-char beg) (c-forward-syntactic-ws) (<= (point) end))
(c-unfind-type (buffer-substring-no-properties (> (point) beg)
(point) beg))) (goto-char end)
(goto-char end) (looking-at c-symbol-char-key))
(or (eq end (point-max)) (goto-char beg)
(c-skip-ws-forward (1+ end)) (c-simple-skip-symbol-backward)
(/= (point) end) (c-unfind-type (buffer-substring-no-properties (point) beg)))
(progn (forward-char) (c-end-of-current-token) nil)
(c-unfind-type (buffer-substring-no-properties (goto-char end)
end (point)))))))) (when
(and (not (eobp))
(progn (c-forward-syntactic-ws) (eq (point) end))
(looking-at c-symbol-char-key)
(progn (c-backward-syntactic-ws) (>= (point) beg))
(< (point) end)
(/= (skip-chars-backward c-symbol-chars (1- (point))) 0))
(goto-char (1+ end))
(c-end-of-current-token)
(c-unfind-type (buffer-substring-no-properties end (point)))))))
;; c-maybe-stale-found-type records a place near the region being ;; c-maybe-stale-found-type records a place near the region being
;; changed where an element of `found-types' might become stale. It ;; changed where an element of `found-types' might become stale. It

View file

@ -20904,8 +20904,8 @@ maybe_produce_line_number (struct it *it)
/* Compute the required width if needed. */ /* Compute the required width if needed. */
if (!it->lnum_width) if (!it->lnum_width)
{ {
if (NATNUMP (Vdisplay_line_number_width)) if (NATNUMP (Vdisplay_line_numbers_width))
it->lnum_width = XFASTINT (Vdisplay_line_number_width); it->lnum_width = XFASTINT (Vdisplay_line_numbers_width);
/* Max line number to be displayed cannot be more than the one /* Max line number to be displayed cannot be more than the one
corresponding to the last row of the desired matrix. */ corresponding to the last row of the desired matrix. */
@ -32686,35 +32686,38 @@ To add a prefix to continuation lines, use `wrap-prefix'. */);
DEFVAR_LISP ("display-line-numbers", Vdisplay_line_numbers, DEFVAR_LISP ("display-line-numbers", Vdisplay_line_numbers,
doc: /* Non-nil means display line numbers. doc: /* Non-nil means display line numbers.
If the value is t, display absolute line numbers starting at the If the value is t, display the absolute number of each line of a buffer
beginning of the current narrowing, or at buffer beginning. shown in a window. Absolute line numbers count from the beginning of
If the value is `relative', display line numbers relative to the the current narrowing, or from buffer beginning. If the value is
line showing point. `relative', display for each line not containing the window's point its
The value `visual' countse lative screen lines rather than relative number instead, i.e. the number of the line relative to the
physical line: by default, line numbers are displayed before each line showing the window's point.
non-continuation line that displays buffer text, i.e. after each
newline that came from buffer text. However, if the value is `visual', In either case, line numbers are displayed at the beginning of each
every screen line will have a number. non-continuation line that displays buffer text, i.e. after each newline
character that comes from the buffer. The value `visual' is like
`relative' but counts screen lines instead of buffer lines. In practice
this means that continuation lines count as well when calculating the
relative number of a line.
Lisp programs can disable display of a line number of a particular Lisp programs can disable display of a line number of a particular
screen line by putting the `display-line-numbers-disable' text buffer line by putting the `display-line-numbers-disable' text property
property or overlay property on the first visible character of or overlay property on the first visible character of that line. */);
that line. */);
Vdisplay_line_numbers = Qnil; Vdisplay_line_numbers = Qnil;
DEFSYM (Qdisplay_line_numbers, "display-line-numbers"); DEFSYM (Qdisplay_line_numbers, "display-line-numbers");
Fmake_variable_buffer_local (Qdisplay_line_numbers); Fmake_variable_buffer_local (Qdisplay_line_numbers);
DEFSYM (Qrelative, "relative"); DEFSYM (Qrelative, "relative");
DEFSYM (Qvisual, "visual"); DEFSYM (Qvisual, "visual");
DEFVAR_LISP ("display-line-number-width", Vdisplay_line_number_width, DEFVAR_LISP ("display-line-numbers-width", Vdisplay_line_numbers_width,
doc: /* Minimum width of space reserved for line number display. doc: /* Minimum width of space reserved for line number display.
A positive number means reserve that many columns for line numbers, A positive number means reserve that many columns for line numbers,
even if the actual number needs less space. even if the actual number needs less space.
The default value of nil means compute the space dynamically. The default value of nil means compute the space dynamically.
Any other value is treated as nil. */); Any other value is treated as nil. */);
Vdisplay_line_number_width = Qnil; Vdisplay_line_numbers_width = Qnil;
DEFSYM (Qdisplay_line_number_width, "display-line-number-width"); DEFSYM (Qdisplay_line_numbers_width, "display-line-number-width");
Fmake_variable_buffer_local (Qdisplay_line_number_width); Fmake_variable_buffer_local (Qdisplay_line_numbers_width);
DEFVAR_LISP ("display-line-numbers-current-absolute", DEFVAR_LISP ("display-line-numbers-current-absolute",
Vdisplay_line_numbers_current_absolute, Vdisplay_line_numbers_current_absolute,

View file

@ -136,7 +136,8 @@ endif
$(AM_V_ELC)$(emacs) -f batch-byte-compile $< $(AM_V_ELC)$(emacs) -f batch-byte-compile $<
## Save logs, and show logs for failed tests. ## Save logs, and show logs for failed tests.
WRITE_LOG = > $@ 2>&1 || { STAT=$$?; cat $@; exit $$STAT; } WRITE_LOG = $(if $(and ${NIX_STORE}, $(findstring tramp, $@)), |& tee $@, > $@ 2>&1) \
|| { STAT=$$?; cat $@; exit $$STAT; }
ifeq ($(TEST_LOAD_EL), yes) ifeq ($(TEST_LOAD_EL), yes)
testloadfile = $*.el testloadfile = $*.el
@ -147,8 +148,7 @@ endif
%.log: %.elc %.log: %.elc
$(AM_V_at)${MKDIR_P} $(dir $@) $(AM_V_at)${MKDIR_P} $(dir $@)
$(AM_V_GEN)HOME=/nonexistent $(emacs) -l ert -l $(testloadfile) \ $(AM_V_GEN)HOME=/nonexistent $(emacs) -l ert -l $(testloadfile) \
--eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" \ --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG}
$(if $(and ${NIX_STORE}, $(findstring tramp, $(testloadfile))), , ${WRITE_LOG})
ifeq (@HAVE_MODULES@, yes) ifeq (@HAVE_MODULES@, yes)
maybe_exclude_module_tests := maybe_exclude_module_tests :=

View file

@ -3787,9 +3787,15 @@ process sentinels. They shall not disturb each other."
(should-not (file-attributes file)) (should-not (file-attributes file))
(should (file-attributes file))) (should (file-attributes file)))
;; Send string to process. ;; Send string to process.
(tramp--test-message
"Trace 1 action %d %s %s" count buf (current-time-string))
(process-send-string proc (format "%s\n" (buffer-name buf))) (process-send-string proc (format "%s\n" (buffer-name buf)))
(tramp--test-message
"Trace 2 action %d %s %s" count buf (current-time-string))
(accept-process-output proc 0.1 nil 0) (accept-process-output proc 0.1 nil 0)
;; Regular operation. ;; Regular operation.
(tramp--test-message
"Trace 3 action %d %s %s" count buf (current-time-string))
(if (= count 2) (if (= count 2)
(should-not (file-attributes file)) (should-not (file-attributes file))
(should (file-attributes file))) (should (file-attributes file)))