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
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
display. The default is nil, meaning that Emacs will dynamically
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"
:value visual))
"26.1")
(display-line-number-width display
(display-line-numbers-width display
(choice
(const :tag "Dynamically computed"
:value nil)

View file

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

View file

@ -1843,19 +1843,25 @@ with a brace block."
(unless (eq where 'at-header)
(c-backward-to-nth-BOF-{ 1 where)
(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.
(cond
;; struct, union, enum, or similar:
((and (looking-at c-type-prefix-key)
(progn (c-forward-token-2 2) ; over "struct foo "
(or (eq (char-after) ?\{)
(looking-at c-symbol-key)))) ; "struct foo bar ..."
(save-match-data (c-forward-token-2))
(when (eq (char-after) ?\{)
(c-backward-token-2)
(looking-at c-symbol-key))
(match-string-no-properties 0))
((looking-at c-type-prefix-key)
(let ((key-pos (point)))
(c-forward-token-2 1) ; over "struct ".
(cond
((looking-at c-symbol-key) ; "struct foo { ..."
(buffer-substring-no-properties key-pos (match-end 0)))
((eq (char-after) ?{) ; "struct { ... } foo"
(when (c-go-list-forward)
(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!
;; 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))
(setq name-end (point))
(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)
;; 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.
`(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)
"Delete the text between START and END and return it."
(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 c-point 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-save-buffer-state let*)
(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'.
(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)
;; 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
@ -7059,6 +7066,7 @@ comment at the start of cc-engine.el for more info."
;; This function might do hidden buffer changes.
(let ((start (point))
(old-found-types (c-copy-found-types))
;; If `c-record-type-identifiers' is set then activate
;; recording of any found types that constitute an argument in
;; 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)))
t)
(setq c-found-types old-found-types)
(goto-char start)
nil)))

View file

@ -225,18 +225,7 @@ control). See \"cc-mode.el\" for more info."
(defun c-make-inherited-keymap ()
(let ((map (make-sparse-keymap)))
;; Necessary to use `cc-bytecomp-fboundp' below since this
;; 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")))
(c-set-keymap-parent map c-mode-base-map)
map))
(defun c-define-abbrev-table (name defs &optional doc)
@ -276,6 +265,8 @@ control). See \"cc-mode.el\" for more info."
nil
(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
;; backward-kill-word.
@ -446,27 +437,36 @@ preferably use the `c-mode-menu' language constant directly."
t))))
(defun c-unfind-coalesced-tokens (beg end)
;; unless the non-empty region (beg end) is entirely WS and there's at
;; least one character of WS just before or after this region, remove
;; the tokens which touch the region from `c-found-types' should they
;; be present.
(or (c-partial-ws-p beg end)
(save-excursion
(progn
(goto-char beg)
(or (eq beg (point-min))
(c-skip-ws-backward (1- beg))
(/= (point) beg)
(= (c-backward-token-2) 1)
(c-unfind-type (buffer-substring-no-properties
(point) beg)))
(goto-char end)
(or (eq end (point-max))
(c-skip-ws-forward (1+ end))
(/= (point) end)
(progn (forward-char) (c-end-of-current-token) nil)
(c-unfind-type (buffer-substring-no-properties
end (point))))))))
;; If removing the region (beg end) would coalesce an identifier ending at
;; beg with an identifier (fragment) beginning at end, or an identifier
;; fragment ending at beg with an identifier beginning at end, remove the
;; pertinent identifier(s) from `c-found-types'.
(save-excursion
(when (< beg end)
(goto-char beg)
(when
(and (not (bobp))
(progn (c-backward-syntactic-ws) (eq (point) beg))
(/= (skip-chars-backward c-symbol-chars (1- (point))) 0)
(progn (goto-char beg) (c-forward-syntactic-ws) (<= (point) end))
(> (point) beg)
(goto-char end)
(looking-at c-symbol-char-key))
(goto-char beg)
(c-simple-skip-symbol-backward)
(c-unfind-type (buffer-substring-no-properties (point) beg)))
(goto-char end)
(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
;; 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. */
if (!it->lnum_width)
{
if (NATNUMP (Vdisplay_line_number_width))
it->lnum_width = XFASTINT (Vdisplay_line_number_width);
if (NATNUMP (Vdisplay_line_numbers_width))
it->lnum_width = XFASTINT (Vdisplay_line_numbers_width);
/* Max line number to be displayed cannot be more than the one
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,
doc: /* Non-nil means display line numbers.
If the value is t, display absolute line numbers starting at the
beginning of the current narrowing, or at buffer beginning.
If the value is `relative', display line numbers relative to the
line showing point.
The value `visual' countse lative screen lines rather than
physical line: by default, line numbers are displayed before each
non-continuation line that displays buffer text, i.e. after each
newline that came from buffer text. However, if the value is `visual',
every screen line will have a number.
If the value is t, display the absolute number of each line of a buffer
shown in a window. Absolute line numbers count from the beginning of
the current narrowing, or from buffer beginning. If the value is
`relative', display for each line not containing the window's point its
relative number instead, i.e. the number of the line relative to the
line showing the window's point.
In either case, line numbers are displayed at the beginning of each
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
screen line by putting the `display-line-numbers-disable' text
property or overlay property on the first visible character of
that line. */);
buffer line by putting the `display-line-numbers-disable' text property
or overlay property on the first visible character of that line. */);
Vdisplay_line_numbers = Qnil;
DEFSYM (Qdisplay_line_numbers, "display-line-numbers");
Fmake_variable_buffer_local (Qdisplay_line_numbers);
DEFSYM (Qrelative, "relative");
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.
A positive number means reserve that many columns for line numbers,
even if the actual number needs less space.
The default value of nil means compute the space dynamically.
Any other value is treated as nil. */);
Vdisplay_line_number_width = Qnil;
DEFSYM (Qdisplay_line_number_width, "display-line-number-width");
Fmake_variable_buffer_local (Qdisplay_line_number_width);
Vdisplay_line_numbers_width = Qnil;
DEFSYM (Qdisplay_line_numbers_width, "display-line-number-width");
Fmake_variable_buffer_local (Qdisplay_line_numbers_width);
DEFVAR_LISP ("display-line-numbers-current-absolute",
Vdisplay_line_numbers_current_absolute,

View file

@ -136,7 +136,8 @@ endif
$(AM_V_ELC)$(emacs) -f batch-byte-compile $<
## 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)
testloadfile = $*.el
@ -147,8 +148,7 @@ endif
%.log: %.elc
$(AM_V_at)${MKDIR_P} $(dir $@)
$(AM_V_GEN)HOME=/nonexistent $(emacs) -l ert -l $(testloadfile) \
--eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" \
$(if $(and ${NIX_STORE}, $(findstring tramp, $(testloadfile))), , ${WRITE_LOG})
--eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG}
ifeq (@HAVE_MODULES@, yes)
maybe_exclude_module_tests :=

View file

@ -3787,9 +3787,15 @@ process sentinels. They shall not disturb each other."
(should-not (file-attributes file))
(should (file-attributes file)))
;; 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)))
(tramp--test-message
"Trace 2 action %d %s %s" count buf (current-time-string))
(accept-process-output proc 0.1 nil 0)
;; Regular operation.
(tramp--test-message
"Trace 3 action %d %s %s" count buf (current-time-string))
(if (= count 2)
(should-not (file-attributes file))
(should (file-attributes file)))