commit 921d279e15256a07168033b0c50f1fc82e22ef7f (HEAD, refs/remotes/origin/master) Merge: 01963fbbe1 6fa99f06b9 Author: Wilson Snyder Date: Mon May 6 18:35:59 2019 -0400 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit 01963fbbe10d290ba037cd523d21ebbcd2536b40 Author: Wilson Snyder Date: Mon May 6 18:35:31 2019 -0400 Fix verilog-mode module backticks; whitespace from prev commits. * verilog-mode.el (verilog-read-inst-module-matcher): Work when point is near backtick. Reported by Mattias Engdegard. diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index e75e5845ef..eeed4c0d7c 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -121,7 +121,7 @@ ;; ;; This variable will always hold the version number of the mode -(defconst verilog-mode-version "2019-04-02-5d62d3f-vpo-GNU" +(defconst verilog-mode-version "2019-05-06-28bee25-vpo-GNU" "Version of this Verilog mode.") (defconst verilog-mode-release-emacs t "If non-nil, this version of Verilog mode was released with Emacs itself.") @@ -2760,13 +2760,13 @@ find the errors." (defconst verilog-delay-re "#\\s-*\\(\\([0-9_]+\\('s?[hdxbo][0-9a-fA-F_xz]+\\)?\\)\\|\\(([^()]*)\\)\\|\\(\\sw+\\)\\)") (defconst verilog-declaration-re-2-no-macro (concat "\\s-*" verilog-declaration-re - "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" verilog-delay-re "\\)" - "\\)")) + "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" verilog-delay-re "\\)" + "\\)")) (defconst verilog-declaration-re-2-macro (concat "\\s-*" verilog-declaration-re - "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" verilog-delay-re "\\)" - "\\|\\(" verilog-macroexp-re "\\)" - "\\)")) + "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" verilog-delay-re "\\)" + "\\|\\(" verilog-macroexp-re "\\)" + "\\)")) (defconst verilog-declaration-re-1-macro (concat "^" verilog-declaration-re-2-macro)) @@ -8357,13 +8357,13 @@ Use optional HEADER and PREFIX." (when (looking-at ")") (verilog-backward-open-paren) (verilog-re-search-backward-quick "\\b[a-zA-Z0-9`_$]" nil nil)) - (skip-chars-backward "a-zA-Z0-9'_$") + (skip-chars-backward "a-zA-Z0-9`_$") ;; #1 is legal syntax for gate primitives (when (save-excursion - (verilog-backward-syntactic-ws-quick) - (eq ?# (char-before))) + (verilog-backward-syntactic-ws-quick) + (eq ?# (char-before))) (verilog-re-search-backward-quick "\\b[a-zA-Z0-9`_$]" nil nil) - (skip-chars-backward "a-zA-Z0-9'_$")) + (skip-chars-backward "a-zA-Z0-9`_$")) (looking-at "[a-zA-Z0-9`_$]+") ;; Important: don't use match string, this must work with Emacs 19 font-lock on (buffer-substring-no-properties (match-beginning 0) (match-end 0)) @@ -11412,7 +11412,7 @@ If PAR-VALUES replace final strings with these parameter values." (when tpl-ass ;; Evaluate @"(lispcode)" (when (string-match "@\".*[^\\]\"" tpl-net) - (while (string-match "@\"\\(\\([^\\\"]\\|\\\\.\\)*\\)\"" tpl-net) + (while (string-match "@\"\\(\\([^\\\"]\\|\\\\.\\)*\\)\"" tpl-net) (setq tpl-net (concat (substring tpl-net 0 (match-beginning 0)) commit 6fa99f06b92b593082d7181ba59ab7eebda45f81 Author: Juri Linkov Date: Mon May 6 22:32:26 2019 +0300 * lisp/emacs-lisp/lisp.el (insert-pair-alist): Turn defvar into defcustom. Revert to old default value. (Bug#35480) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index f73dbb269d..38df920f17 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -645,14 +645,8 @@ Interactively, the behavior depends on `narrow-to-defun-include-comments'." (re-search-backward "^\n" (- (point) 1) t) (narrow-to-region beg end)))) -(defvar insert-pair-alist - (append '((?\< ?\>) (?\" ?\") (?\' ?\') (?\` ?\')) - (let (alist) - (map-char-table - (lambda (open close) - (when (< open close) (push (list open close) alist))) - (unicode-property-table-internal 'paired-bracket)) - (nreverse alist))) +(defcustom insert-pair-alist + '((?\( ?\)) (?\[ ?\]) (?\{ ?\}) (?\< ?\>) (?\" ?\") (?\' ?\') (?\` ?\')) "Alist of paired characters inserted by `insert-pair'. Each element looks like (OPEN-CHAR CLOSE-CHAR) or (COMMAND-CHAR OPEN-CHAR CLOSE-CHAR). The characters OPEN-CHAR and CLOSE-CHAR @@ -661,7 +655,16 @@ or without modifiers, are inserted by `insert-pair'. If COMMAND-CHAR is specified, it is a character that triggers the insertion of the open/close pair, and COMMAND-CHAR itself isn't -inserted.") +inserted." + :type '(repeat (choice (list :tag "Pair" + (character :tag "Open") + (character :tag "Close")) + (list :tag "Triple" + (character :tag "Command") + (character :tag "Open") + (character :tag "Close")))) + :group 'lisp + :version "27.1") (defun insert-pair (&optional arg open close) "Enclose following ARG sexps in a pair of OPEN and CLOSE characters. commit c31823a51bba1e4f0c87af1a08ce856cc600f5c8 Author: Stefan Monnier Date: Mon May 6 14:58:20 2019 -0400 Make combine-after-change-calls work in the common case again * src/insdel.c (signal_after_change): Allow combine_after_change_calls even when syntax-ppss-flush-cache is on before-change-functions. diff --git a/src/insdel.c b/src/insdel.c index 1231bb2682..85fffd8fd1 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -2178,6 +2178,7 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins) { ptrdiff_t count = SPECPDL_INDEX (); struct rvoe_arg rvoe_arg; + Lisp_Object tmp; if (inhibit_modification_hooks) return; @@ -2186,7 +2187,16 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins) and there are no before-change functions, just record the args that we were going to use. */ if (! NILP (Vcombine_after_change_calls) - && NILP (Vbefore_change_functions) + /* It's OK to defer after-changes even if syntax-ppss-flush-cache + * is on before-change-functions, which is common enough to be worth + * adding a special case for it. */ + && (NILP (Vbefore_change_functions) + || (CONSP (Vbefore_change_functions) + && EQ (Qt, XCAR (Vbefore_change_functions)) + && NILP (Fdefault_value (Qbefore_change_functions)) + && CONSP (tmp = XCDR (Vbefore_change_functions)) + && NILP (XCDR (tmp)) + && EQ (XCAR (tmp), Qsyntax_ppss_flush_cache))) && !buffer_has_overlays ()) { Lisp_Object elt; @@ -2343,6 +2353,7 @@ syms_of_insdel (void) combine_after_change_buffer = Qnil; DEFSYM (Qundo_auto__undoable_change, "undo-auto--undoable-change"); + DEFSYM (Qsyntax_ppss_flush_cache, "syntax-ppss-flush-cache"); DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls, doc: /* Used internally by the function `combine-after-change-calls' macro. */); commit 66c388c21aa83d3ddb5a1827f81dd432514242ac Author: John Shahid Date: Sun Apr 28 15:59:50 2019 -0400 Prevent accidental edits in the ansi-term buffer from breaking resizing * lisp/term.el (term-unwrap-line, term-emulate-terminal): Prevent the `term-line-wrap` property of newlines from spreading accidentally when inserting text next to it. diff --git a/lisp/term.el b/lisp/term.el index 586a887a29..283e5684b7 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -2935,7 +2935,8 @@ See `term-prompt-regexp'." (delete-region (point) (line-end-position)) (term-down 1 t) (term-move-columns (- (term-current-column))) - (put-text-property (1- (point)) (point) 'term-line-wrap t) + (add-text-properties (1- (point)) (point) + '(term-line-wrap t rear-nonsticky t)) (setq decoded-substring (substring decoded-substring (- term-width old-column))) (setq old-column 0))) @@ -3754,7 +3755,8 @@ all pending output has been dealt with.")) (when (not (bolp)) (let ((old-point (point))) (insert-before-markers ?\n) - (put-text-property old-point (point) 'term-line-wrap t)))) + (add-text-properties old-point (point) + '(term-line-wrap t rear-nonsticky t))))) (defun term-erase-in-line (kind) (when (= kind 1) ;; erase left of point commit 77b1148b5164c71c4ba673173eed2a37918d4f78 Author: Alan Mackenzie Date: Mon May 6 17:36:28 2019 +0000 c-beginning-of-statement-1: Handle syntactic WS macros properly. * lisp/progmodes/cc-engine.el (c-beginning-of-statement-1): The variable before-sws-pos should record the position of a closing paren/brace/bracket before moving backwards over a sexp. When there is a syntactic WS macro between the starting point and the closing p/b/b, setq before-sws-pos again after moving backward over the macro. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 7e6a46ea6e..a2762ca209 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -1143,6 +1143,9 @@ comment at the start of cc-engine.el for more info." ;; Have we moved into a macro? ((and (not macro-start) (c-beginning-of-macro)) + (save-excursion + (c-backward-syntactic-ws) + (setq before-sws-pos (point))) ;; Have we crossed a statement boundary? If not, ;; keep going back until we find one or a "real" sexp. (and commit 63091313490beee4c5ed9767195c2a3df98f0332 Author: Stefan Monnier Date: Mon May 6 12:37:00 2019 -0400 * lisp/custom.el: Avoid adding vars to load-history multiple times Avoid the abuse of (eval `(defvar ...)) which tends to end up adding redundant entries in `load-history`, as discussed in https://lists.gnu.org/r/help-gnu-emacs/2019-03/msg00237.html (custom-initialize-default): Don't add to load-history. (custom-declare-variable): Use internal--define-uninitialized-variable and only add the var to load-history once. Do it before calling `initialize` so the special-variable-p flag is set. * src/eval.c (Finternal__define_uninitialized_variable): New function. (Fdefvar, Fdefconst): Use it. (syms_of_eval): Defsubr' it. diff --git a/lisp/custom.el b/lisp/custom.el index 53b8045f05..29bf9e570a 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -56,8 +56,14 @@ Otherwise, if symbol has a `saved-value' property, it will evaluate the car of that and use it as the default binding for symbol. Otherwise, EXP will be evaluated and used as the default binding for symbol." - (eval `(defvar ,symbol ,(let ((sv (get symbol 'saved-value))) - (if sv (car sv) exp))))) + (condition-case nil + (default-toplevel-value symbol) ;Test presence of default value. + (void-variable + ;; The var is not initialized yet. + (set-default-toplevel-value + symbol (eval (let ((sv (get symbol 'saved-value))) + (if sv (car sv) exp)) + t))))) (defun custom-initialize-set (symbol exp) "Initialize SYMBOL based on EXP. @@ -188,18 +194,13 @@ set to nil, as the value is no longer rogue." (t (custom-handle-keyword symbol keyword value 'custom-variable)))))) + ;; Set the docstring, record the var on load-history, as well + ;; as set the special-variable-p flag. + (internal--define-uninitialized-variable symbol doc) (put symbol 'custom-requests requests) ;; Do the actual initialization. (unless custom-dont-initialize (funcall initialize symbol default))) - ;; Use defvar to set the docstring as well as the special-variable-p flag. - ;; FIXME: We should reproduce more of `defvar's behavior, such as the warning - ;; when the var is currently let-bound. - (if (not (default-boundp symbol)) - ;; Don't use defvar to avoid setting a default-value when undesired. - (when doc (put symbol 'variable-documentation doc)) - (eval `(defvar ,symbol nil ,@(when doc (list doc))))) - (push symbol current-load-list) (run-hooks 'custom-define-hook) symbol) diff --git a/src/eval.c b/src/eval.c index 3fd9a40a3a..567c32e0d7 100644 --- a/src/eval.c +++ b/src/eval.c @@ -715,6 +715,25 @@ DEFUN ("set-default-toplevel-value", Fset_default_toplevel_value, return Qnil; } +DEFUN ("internal--define-uninitialized-variable", + Finternal__define_uninitialized_variable, + Sinternal__define_uninitialized_variable, 1, 2, 0, + doc: /* Define SYMBOL as a variable, with DOC as its docstring. +This is like `defvar' and `defconst' but without affecting the variable's +value. */) + (Lisp_Object symbol, Lisp_Object doc) +{ + XSYMBOL (symbol)->u.s.declared_special = true; + if (!NILP (doc)) + { + if (!NILP (Vpurify_flag)) + doc = Fpurecopy (doc); + Fput (symbol, Qvariable_documentation, doc); + } + LOADHIST_ATTACH (symbol); + return Qnil; +} + DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, doc: /* Define SYMBOL as a variable, and return SYMBOL. You are not required to define a variable in order to use it, but @@ -754,32 +773,25 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) { if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail)))) error ("Too many arguments"); + Lisp_Object exp = XCAR (tail); tem = Fdefault_boundp (sym); + tail = XCDR (tail); /* Do it before evaluating the initial value, for self-references. */ - XSYMBOL (sym)->u.s.declared_special = true; + Finternal__define_uninitialized_variable (sym, CAR (tail)); if (NILP (tem)) - Fset_default (sym, eval_sub (XCAR (tail))); + Fset_default (sym, eval_sub (exp)); else { /* Check if there is really a global binding rather than just a let binding that shadows the global unboundness of the var. */ union specbinding *binding = default_toplevel_binding (sym); if (binding && EQ (specpdl_old_value (binding), Qunbound)) { - set_specpdl_old_value (binding, eval_sub (XCAR (tail))); + set_specpdl_old_value (binding, eval_sub (exp)); } } - tail = XCDR (tail); - tem = Fcar (tail); - if (!NILP (tem)) - { - if (!NILP (Vpurify_flag)) - tem = Fpurecopy (tem); - Fput (sym, Qvariable_documentation, tem); - } - LOADHIST_ATTACH (sym); } else if (!NILP (Vinternal_interpreter_environment) && (SYMBOLP (sym) && !XSYMBOL (sym)->u.s.declared_special)) @@ -827,19 +839,12 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) docstring = XCAR (XCDR (XCDR (args))); } + Finternal__define_uninitialized_variable (sym, docstring); tem = eval_sub (XCAR (XCDR (args))); if (!NILP (Vpurify_flag)) tem = Fpurecopy (tem); - Fset_default (sym, tem); - XSYMBOL (sym)->u.s.declared_special = true; - if (!NILP (docstring)) - { - if (!NILP (Vpurify_flag)) - docstring = Fpurecopy (docstring); - Fput (sym, Qvariable_documentation, docstring); - } - Fput (sym, Qrisky_local_variable, Qt); - LOADHIST_ATTACH (sym); + Fset_default (sym, tem); /* FIXME: set-default-toplevel-value? */ + Fput (sym, Qrisky_local_variable, Qt); /* FIXME: Why? */ return sym; } @@ -4198,6 +4203,7 @@ alist of active lexical bindings. */); defsubr (&Sdefvaralias); DEFSYM (Qdefvaralias, "defvaralias"); defsubr (&Sdefconst); + defsubr (&Sinternal__define_uninitialized_variable); defsubr (&Smake_var_non_special); defsubr (&Slet); defsubr (&SletX); commit f0c0b2cea3ffea7e3c53ff24c58e7a08ac40babb Author: Michael Albinus Date: Mon May 6 12:04:24 2019 +0200 Use lambda in tramp-compat-* functions * lisp/net/tramp-compat.el (tramp-handle-temporary-file-directory): Declare. (tramp-compat-temporary-file-directory-function): Use function symbol. (tramp-compat-file-attribute-type) (tramp-compat-file-attribute-link-number) (tramp-compat-file-attribute-user-id) (tramp-compat-file-attribute-group-id) (tramp-compat-file-attribute-modification-time) (tramp-compat-file-attribute-size) (tramp-compat-file-attribute-modes) (tramp-compat-directory-name-p, tramp-compat-file-local-name) (tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote) (tramp-compat-file-name-unquote, tramp-compat-exec-path) (tramp-compat-time-equal-p, tramp-compat-flatten-tree): Make them lambdas. diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index b8a2b45136..b515f253c9 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -45,8 +45,7 @@ (require 'timer) (require 'ucs-normalize) -(declare-function tramp-compat-file-local-name "tramp-compat") -(declare-function tramp-compat-file-name-quoted-p "tramp-compat") +(declare-function tramp-handle-temporary-file-directory "tramp") ;; For not existing functions, obsolete functions, or functions with a ;; changed argument list, there are compiler warnings. We want to @@ -77,7 +76,7 @@ Add the extension of F, if existing." (defalias 'tramp-compat-temporary-file-directory-function (if (fboundp 'temporary-file-directory) #'temporary-file-directory - 'tramp-handle-temporary-file-directory)) + #'tramp-handle-temporary-file-directory)) (defun tramp-compat-process-running-p (process-name) "Returns t if system process PROCESS-NAME is running for `user-login-name'." @@ -109,79 +108,85 @@ Add the extension of F, if existing." ;; `file-attribute-*' are introduced in Emacs 25.1. -(if (fboundp 'file-attribute-type) - (defalias 'tramp-compat-file-attribute-type #'file-attribute-type) - (defsubst tramp-compat-file-attribute-type (attributes) - "The type field in ATTRIBUTES returned by `file-attributes'. +(defalias 'tramp-compat-file-attribute-type + (if (fboundp 'file-attribute-type) + #'file-attribute-type + (lambda (attributes) + "The type field in ATTRIBUTES returned by `file-attributes'. The value is either t for directory, string (name linked to) for symbolic link, or nil." - (nth 0 attributes))) - -(if (fboundp 'file-attribute-link-number) - (defalias 'tramp-compat-file-attribute-link-number - #'file-attribute-link-number) - (defsubst tramp-compat-file-attribute-link-number (attributes) - "Return the number of links in ATTRIBUTES returned by `file-attributes'." - (nth 1 attributes))) - -(if (fboundp 'file-attribute-user-id) - (defalias 'tramp-compat-file-attribute-user-id #'file-attribute-user-id) - (defsubst tramp-compat-file-attribute-user-id (attributes) - "The UID field in ATTRIBUTES returned by `file-attributes'. + (nth 0 attributes)))) + +(defalias 'tramp-compat-file-attribute-link-number + (if (fboundp 'file-attribute-link-number) + #'file-attribute-link-number + (lambda (attributes) + "Return the number of links in ATTRIBUTES returned by `file-attributes'." + (nth 1 attributes)))) + +(defalias 'tramp-compat-file-attribute-user-id + (if (fboundp 'file-attribute-user-id) + #'file-attribute-user-id + (lambda (attributes) + "The UID field in ATTRIBUTES returned by `file-attributes'. This is either a string or a number. If a string value cannot be looked up, a numeric value, either an integer or a float, is returned." - (nth 2 attributes))) + (nth 2 attributes)))) -(if (fboundp 'file-attribute-group-id) - (defalias 'tramp-compat-file-attribute-group-id #'file-attribute-group-id) - (defsubst tramp-compat-file-attribute-group-id (attributes) - "The GID field in ATTRIBUTES returned by `file-attributes'. +(defalias 'tramp-compat-file-attribute-group-id + (if (fboundp 'file-attribute-group-id) + #'file-attribute-group-id + (lambda (attributes) + "The GID field in ATTRIBUTES returned by `file-attributes'. This is either a string or a number. If a string value cannot be looked up, a numeric value, either an integer or a float, is returned." - (nth 3 attributes))) + (nth 3 attributes)))) -(if (fboundp 'file-attribute-modification-time) - (defalias 'tramp-compat-file-attribute-modification-time - #'file-attribute-modification-time) - (defsubst tramp-compat-file-attribute-modification-time (attributes) - "The modification time in ATTRIBUTES returned by `file-attributes'. +(defalias 'tramp-compat-file-attribute-modification-time + (if (fboundp 'file-attribute-modification-time) + #'file-attribute-modification-time + (lambda (attributes) + "The modification time in ATTRIBUTES returned by `file-attributes'. This is the time of the last change to the file's contents, and is a Lisp timestamp in the style of `current-time'." - (nth 5 attributes))) + (nth 5 attributes)))) -(if (fboundp 'file-attribute-size) - (defalias 'tramp-compat-file-attribute-size #'file-attribute-size) - (defsubst tramp-compat-file-attribute-size (attributes) - "The size (in bytes) in ATTRIBUTES returned by `file-attributes'. +(defalias 'tramp-compat-file-attribute-size + (if (fboundp 'file-attribute-size) + #'file-attribute-size + (lambda (attributes) + "The size (in bytes) in ATTRIBUTES returned by `file-attributes'. If the size is too large for a fixnum, this is a bignum in Emacs 27 and later, and is a float in Emacs 26 and earlier." - (nth 7 attributes))) + (nth 7 attributes)))) -(if (fboundp 'file-attribute-modes) - (defalias 'tramp-compat-file-attribute-modes #'file-attribute-modes) - (defsubst tramp-compat-file-attribute-modes (attributes) - "The file modes in ATTRIBUTES returned by `file-attributes'. +(defalias 'tramp-compat-file-attribute-modes + (if (fboundp 'file-attribute-modes) + #'file-attribute-modes + (lambda (attributes) + "The file modes in ATTRIBUTES returned by `file-attributes'. This is a string of ten letters or dashes as in ls -l." - (nth 8 attributes))) + (nth 8 attributes)))) ;; `format-message' is new in Emacs 25.1. (unless (fboundp 'format-message) (defalias 'format-message #'format)) ;; `directory-name-p' is new in Emacs 25.1. -(if (fboundp 'directory-name-p) - (defalias 'tramp-compat-directory-name-p #'directory-name-p) - (defsubst tramp-compat-directory-name-p (name) - "Return non-nil if NAME ends with a directory separator character." - (let ((len (length name)) - (lastc ?.)) - (if (> len 0) - (setq lastc (aref name (1- len)))) - (or (= lastc ?/) - (and (memq system-type '(windows-nt ms-dos)) - (= lastc ?\\)))))) +(defalias 'tramp-compat-directory-name-p + (if (fboundp 'directory-name-p) + #'directory-name-p + (lambda (name) + "Return non-nil if NAME ends with a directory separator character." + (let ((len (length name)) + (lastc ?.)) + (if (> len 0) + (setq lastc (aref name (1- len)))) + (or (= lastc ?/) + (and (memq system-type '(windows-nt ms-dos)) + (= lastc ?\\))))))) ;; `file-missing' is introduced in Emacs 26.1. (defconst tramp-file-missing @@ -190,45 +195,49 @@ This is a string of ten letters or dashes as in ls -l." ;; `file-local-name', `file-name-quoted-p', `file-name-quote' and ;; `file-name-unquote' are introduced in Emacs 26. -(if (fboundp 'file-local-name) - (defalias 'tramp-compat-file-local-name #'file-local-name) - (defsubst tramp-compat-file-local-name (name) - "Return the local name component of NAME. +(defalias 'tramp-compat-file-local-name + (if (fboundp 'file-local-name) + #'file-local-name + (lambda (name) + "Return the local name component of NAME. It returns a file name which can be used directly as argument of `process-file', `start-file-process', or `shell-command'." - (or (file-remote-p name 'localname) name))) + (or (file-remote-p name 'localname) name)))) ;; `file-name-quoted-p' got a second argument in Emacs 27.1. -(if (and - (fboundp 'file-name-quoted-p) - (equal (tramp-compat-funcall 'func-arity #'file-name-quoted-p) '(1 . 2))) - (defalias 'tramp-compat-file-name-quoted-p #'file-name-quoted-p) - (defsubst tramp-compat-file-name-quoted-p (name &optional top) - "Whether NAME is quoted with prefix \"/:\". +(defalias 'tramp-compat-file-name-quoted-p + (if (and + (fboundp 'file-name-quoted-p) + (equal (tramp-compat-funcall 'func-arity #'file-name-quoted-p) '(1 . 2))) + #'file-name-quoted-p + (lambda (name &optional top) + "Whether NAME is quoted with prefix \"/:\". If NAME is a remote file name and TOP is nil, check the local part of NAME." - (let ((file-name-handler-alist (unless top file-name-handler-alist))) - (string-prefix-p "/:" (tramp-compat-file-local-name name))))) - -(if (fboundp 'file-name-quote) - (defalias 'tramp-compat-file-name-quote #'file-name-quote) - (defsubst tramp-compat-file-name-quote (name) - "Add the quotation prefix \"/:\" to file NAME. + (let ((file-name-handler-alist (unless top file-name-handler-alist))) + (string-prefix-p "/:" (tramp-compat-file-local-name name)))))) + +(defalias 'tramp-compat-file-name-quote + (if (fboundp 'file-name-quote) + #'file-name-quote + (lambda (name) + "Add the quotation prefix \"/:\" to file NAME. If NAME is a remote file name, the local part of NAME is quoted." - (if (tramp-compat-file-name-quoted-p name) - name - (concat - (file-remote-p name) "/:" (tramp-compat-file-local-name name))))) - -(if (fboundp 'file-name-unquote) - (defalias 'tramp-compat-file-name-unquote #'file-name-unquote) - (defsubst tramp-compat-file-name-unquote (name) - "Remove quotation prefix \"/:\" from file NAME. + (if (tramp-compat-file-name-quoted-p name) + name + (concat + (file-remote-p name) "/:" (tramp-compat-file-local-name name)))))) + +(defalias 'tramp-compat-file-name-unquote + (if (fboundp 'file-name-unquote) + #'file-name-unquote + (lambda (name) + "Remove quotation prefix \"/:\" from file NAME. If NAME is a remote file name, the local part of NAME is unquoted." - (let ((localname (tramp-compat-file-local-name name))) - (when (tramp-compat-file-name-quoted-p localname) - (setq - localname (if (= (length localname) 2) "/" (substring localname 2)))) - (concat (file-remote-p name) localname)))) + (let ((localname (tramp-compat-file-local-name name))) + (when (tramp-compat-file-name-quoted-p localname) + (setq + localname (if (= (length localname) 2) "/" (substring localname 2)))) + (concat (file-remote-p name) localname))))) ;; `tramp-syntax' has changed its meaning in Emacs 26. We still ;; support old settings. @@ -252,10 +261,10 @@ If NAME is a remote file name, the local part of NAME is unquoted." "Whether to use url-tramp.el.") ;; `exec-path' is new in Emacs 27.1. -(eval-and-compile +(defalias 'tramp-compat-exec-path (if (fboundp 'exec-path) - (defalias 'tramp-compat-exec-path #'exec-path) - (defun tramp-compat-exec-path () + #'exec-path + (lambda () "List of directories to search programs to run in remote subprocesses." (let ((handler (find-file-name-handler default-directory 'exec-path))) (if handler @@ -263,27 +272,29 @@ If NAME is a remote file name, the local part of NAME is unquoted." exec-path))))) ;; `time-equal-p' has appeared in Emacs 27.1. -(if (fboundp 'time-equal-p) - (defalias 'tramp-compat-time-equal-p #'time-equal-p) - (defsubst tramp-compat-time-equal-p (t1 t2) - "Return non-nil if time value T1 is equal to time value T2. +(defalias 'tramp-compat-time-equal-p + (if (fboundp 'time-equal-p) + #'time-equal-p + (lambda (t1 t2) + "Return non-nil if time value T1 is equal to time value T2. A nil value for either argument stands for the current time." - (equal (or t1 (current-time)) (or t2 (current-time))))) + (equal (or t1 (current-time)) (or t2 (current-time)))))) ;; `flatten-tree' has appeared in Emacs 27.1. -(if (fboundp 'flatten-tree) - (defalias 'tramp-compat-flatten-tree #'flatten-tree) - (defun tramp-compat-flatten-tree (tree) - "Take TREE and \"flatten\" it." - (let (elems) - (setq tree (list tree)) - (while (let ((elem (pop tree))) - (cond ((consp elem) - (setq tree (cons (car elem) (cons (cdr elem) tree)))) - (elem - (push elem elems))) - tree)) - (nreverse elems)))) +(defalias 'tramp-compat-flatten-tree + (if (fboundp 'flatten-tree) + #'flatten-tree + (lambda (tree) + "Take TREE and \"flatten\" it." + (let (elems) + (setq tree (list tree)) + (while (let ((elem (pop tree))) + (cond ((consp elem) + (setq tree (cons (car elem) (cons (cdr elem) tree)))) + (elem + (push elem elems))) + tree)) + (nreverse elems))))) (add-hook 'tramp-unload-hook (lambda () commit 1ac5c6c3cfc4c50347af893aa72926cdf2edb8c1 Author: Michael Albinus Date: Mon May 6 11:23:54 2019 +0200 ; Make /etc/NEWS more consistent diff --git a/etc/NEWS b/etc/NEWS index caaffc2281..5fe2e63526 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -39,9 +39,9 @@ counterparts from json.el. ** Several configure options now accept an option-argument 'ifavailable'. For example, './configure --with-xpm=ifavailable' now configures Emacs -to attempt to use libxpm but to continue building even if libxpm is absent. -The other affected options are --with-gif, --with-gnutls, --with-jpeg, ---with-png, and --with-tiff. +to attempt to use libxpm but to continue building even if libxpm is +absent. The other affected options are '--with-gif', '--with-gnutls', +'--with-jpeg', '--with-png', and '--with-tiff'. ** The etags program now uses the C library's regular expression matcher when possible, and a compatible regex substitute otherwise. This will @@ -128,13 +128,14 @@ file, which was previously done when Emacs was started. As a result of this change, it is no longer necessary to call 'package-initialize' in your init file. -However, if your init file changes the values of 'package-load-list' or -'package-user-dir', or sets 'package-enable-at-startup' to nil then it won't -work right without some adjustment: -- you can move that code to the early init file (see above), so those settings - apply before Emacs tries to activate the packages. -- you can use the new 'package-quickstart' so activation of packages does not - need to pay attention to 'package-load-list' or 'package-user-dir' any more. +However, if your init file changes the values of 'package-load-list' +or 'package-user-dir', or sets 'package-enable-at-startup' to nil then +it won't work right without some adjustment: +- You can move that code to the early init file (see above), so those + settings apply before Emacs tries to activate the packages. +- You can use the new 'package-quickstart' so activation of packages + does not need to pay attention to 'package-load-list' or + 'package-user-dir' any more. --- ** Emacs now notifies systemd when startup finishes or shutdown begins. @@ -153,16 +154,16 @@ the new version of the file again.) *** emacsclient now supports the 'EMACS_SOCKET_NAME' environment variable. The behavior is identical to 'EMACS_SERVER_FILE', in that the command-line value specified via '--socket-name' will override the -environment, and the natural default to TMPDIR, then "/tmp", continues +environment, and the natural default to 'TMPDIR', then "/tmp", continues to apply. +++ -*** Emacs and emacsclient now default to $XDG_RUNTIME_DIR/emacs +*** Emacs and emacsclient now default to "$XDG_RUNTIME_DIR/emacs" as the directory for client/server sockets, if Emacs is running -under an X Window System desktop that sets the XDG_RUNTIME_DIR +under an X Window System desktop that sets the 'XDG_RUNTIME_DIR' environment variable to indicate where session sockets should go. To get the old, less-secure behavior, you can set the -EMACS_SOCKET_NAME environment variable to an appropriate value. +'EMACS_SOCKET_NAME' environment variable to an appropriate value. --- *** When run by root, emacsclient no longer connects to non-root sockets. @@ -176,11 +177,11 @@ be controlled via the new variable 'face-near-same-color-threshold'. The default value is 30000, as the previously hard-coded threshold. +++ -** The function 'read-passwd' uses '*' as default character to hide passwords. +** The function 'read-passwd' uses "*" as default character to hide passwords. -** Lexical binding is now used when evaluating interactive Elisp forms -More specifically, lexical-binding is now used for M-:, --eval, as well -as in the *scratch* and *ielm* buffers. +** Lexical binding is now used when evaluating interactive Elisp forms. +More specifically, lexical-binding is now used for 'M-:', '--eval', as +well as in the "*scratch*" and "*ielm*" buffers. --- ** The new option 'tooltip-resize-echo-area' avoids truncating tooltip text @@ -215,7 +216,7 @@ indirectly, e.g., by checking that functions like 'libxml-parse-html-region' return nil. +++ -** 'libxml-parse-xml-region' and 'libxml-parse-html' region take +** 'libxml-parse-xml-region' and 'libxml-parse-html-region' take a parameter that's called DISCARD-COMMENTS, but it really only discards the top-level comment. Therefore this parameter is now obsolete, and the new utility function 'xml-remove-comments' can be @@ -241,7 +242,7 @@ security level (assuming you use the 'medium' level). +++ ** Native GnuTLS connections can now use client certificates. Previously, this support was only available when using the external -gnutls-cli command. Call 'open-network-stream' with +'gnutls-cli' command. Call 'open-network-stream' with ':client-certificate t' to trigger looking up of per-server certificates via 'auth-source'. @@ -321,21 +322,20 @@ and directory-local variables. +++ *** The macro 'with-connection-local-variables' has been renamed from -'with-connection-local-profiles'. No argument 'profiles' needed any -longer. +'with-connection-local-profiles'. No argument PROFILES needed any longer. --- -** New variable next-error-verbose controls when `next-error' outputs - a message about the error locus. +** New variable 'next-error-verbose' controls when 'next-error' outputs +a message about the error locus. --- -** New variable grep-search-path defines the directories searched for - grep hits (this used to be controlled by compilation-search-path). +** New variable 'grep-search-path defines' the directories searched for +grep hits (this used to be controlled by 'compilation-search-path'). --- -** New variable emacs-lisp-compilation-search-path defines the - directories searched for byte-compiler error messages (this used to - be controlled by compilation-search-path). +** New variable 'emacs-lisp-compilation-search-path' defines the +directories searched for byte-compiler error messages (this used to +be controlled by 'compilation-search-path'). ** Multicolor fonts such as "Noto Color Emoji" can be displayed on Emacs configured with Cairo drawing and linked with cairo >= 1.16.0. @@ -344,7 +344,7 @@ Emacs configured with Cairo drawing and linked with cairo >= 1.16.0. ** Emacs now optionally displays a fill column indicator. This is similar to what 'fill-column-indicator' package provides, but -much faster and compatible with show-trailing-whitespace. +much faster and compatible with 'show-trailing-whitespace'. Customize the buffer-local variables 'display-fill-column-indicator' and 'display-fill-column-indicator-character' to activate the @@ -415,17 +415,17 @@ syntax that you can see in the example of a ".dir-locals.el" file in the node "(emacs) Directory Variables" of the user manual. +++ -** Network connections using 'local can now use IPv6. +** Network connections using 'local' can now use IPv6. 'make-network-process' now uses the correct loopback address when -asked to use :host 'local and :family 'ipv6. +asked to use ':host 'local' and ':family 'ipv6'. +++ -** The new function `replace-region-contents' replaces the current +** The new function 'replace-region-contents' replaces the current region using a given replacement-function in a non-destructive manner -(in terms of `replace-buffer-contents'). +(in terms of 'replace-buffer-contents'). +++ -** The command `replace-buffer-contents' now has two optional +** The command 'replace-buffer-contents' now has two optional arguments mitigating performance issues when operating on huge buffers. @@ -440,14 +440,16 @@ current and the previous or the next line, as before. ** compile.el --- -*** In compilation-error-regexp-alist, 'line' (and 'end-line') can be functions +*** In 'compilation-error-regexp-alist', 'line' (and 'end-line') can +be functions. -** cl-lib +** cl-lib.el +++ -*** cl-defstruct has a new :noinline argument to prevent inlining its functions +*** 'cl-defstruct' has a new ':noinline' argument to prevent inlining +its functions. -** doc-view-mode -*** New commands doc-view-presentation and doc-view-fit-window-to-page +** doc-view.el +*** New commands 'doc-view-presentation' and 'doc-view-fit-window-to-page'. *** Added support for password-protected PDF files ** Ido @@ -489,10 +491,10 @@ that display the next buffer in the window at the specified direction. This is like 'windmove-default-keybindings' that binds keys to commands that select the window in the specified direction, but additionally it displays the buffer from the next command in that window. For example, -'S-M-right C-h i' displays the *Info* buffer in the right window, +'S-M-right C-h i' displays the "*Info*" buffer in the right window, creating the window if necessary. A special key can be customized to display the buffer in the same window, for example, 'S-M-0 C-h e' -displays the *Messages* buffer in the same window. +displays the "*Messages*" buffer in the same window. *** Windmove also supports directional window deletion. The new command 'windmove-delete-default-keybindings' binds default @@ -557,7 +559,7 @@ With non-nil, 'vc-find-revision' doesn't write the created buffer to file. This new variable allows customizing the default arguments passed to 'git-grep' when 'vc-git-grep' is used. -*** Command 'vc-git-stash' now respects marks in the '*vc-dir*' buffer. +*** Command 'vc-git-stash' now respects marks in the "*vc-dir*" buffer. When some files are marked, only those are stashed. When no files are marked, all modified files are stashed, as before. @@ -575,7 +577,7 @@ values. and compares their entire trees. *** New user option 'vc-hg-revert-switches' specifies switches to pass -to hg revert. +to Hg revert. *** 'C-x v M D' ('vc-diff-mergebase') and 'C-x v M L' ('vc-log-mergebase') print diffs and logs between the merge base (common ancestor) of two @@ -584,9 +586,10 @@ given revisions. ** Diff mode +++ *** Hunks are now automatically refined by font-lock. -To disable refinement, set the new defcustom 'diff-refine' to nil. +To disable refinement, set the new user option 'diff-refine' to nil. To get back the old behavior where hunks are refined as you navigate through a diff, set 'diff-refine' to the symbol 'navigate'. + +++ *** 'diff-auto-refine-mode' is deprecated in favor of 'diff-refine'. It is no longer enabled by default and binding it no longer has any @@ -599,7 +602,7 @@ according to the appropriate major mode. Customize the new option 'diff-font-lock-syntax' to nil to disable this. *** File headers can be shortened, mimicking Magit's diff format. -To enable it, set the new defcustom 'diff-font-lock-prettify' to t. +To enable it, set the new user option 'diff-font-lock-prettify' to t. +++ *** Prefix arg of 'diff-goto-source' means jump to the old revision @@ -609,11 +612,11 @@ or to the new revision of the file otherwise. ** Texinfo +++ -*** New function for inserting @pxref, @xref, or @ref commands. +*** New function for inserting '@pxref', '@xref', or '@ref' commands. The function 'texinfo-insert-dwim-@ref', bound to 'C-c C-c r' by default, inserts one of three types of references based on the text -surrounding point, namely @pxref near a parenthesis, @xref at the -start of a sentence or at (point-min), else @ref. +surrounding point, namely '@pxref' near a parenthesis, '@xref' at the +start of a sentence or at '(point-min)', else '@ref'. ** Browse-url @@ -647,7 +650,6 @@ end. ** SQL *** SQL Indent Minor Mode - SQL Mode now supports the ELPA 'sql-indent' package for assisting sophisticated SQL indenting rules. Note, however, that SQL is not like other programming languages like C, Java, or Python where code is @@ -669,7 +671,6 @@ default values. If you have existing customizations to these variables, you should make sure that the new default entry is included. *** Connection Wallet - Database passwords can now by stored in NETRC or JSON data files that may optionally be encrypted. When establishing an interactive session with the database via 'sql-connect' or a product specific function, @@ -679,9 +680,9 @@ searched for the password. The 'sql-product', 'sql-server', appropriate authorization. This eliminates the discouraged practice of embedding database passwords in your Emacs initialization. -See the `auth-source' module for complete documentation on the file +See the 'auth-source' module for complete documentation on the file formats. By default, the wallet file is expected to be in the -`user-emacs-directory', named 'sql-wallet' or '.sql-wallet', with +'user-emacs-directory', named 'sql-wallet' or '.sql-wallet', with '.json' (JSON) or no (NETRC) suffix. Both file formats can optionally be encrypted with GPG by adding an additional '.gpg' suffix. @@ -721,12 +722,13 @@ it can't find the config file. Example use in auctex.el: '(defconst auctex-version (package-get-version))' *** New 'package-quickstart' feature. -When 'package-quickstart' is non-nil, package.el precomputes a big autoloads -file so that activation of packages can be done much faster, which can speed up -your startup significantly. -It also causes variables like 'package-user-dir' and 'package-load-list' to be -consulted when 'package-quickstart-refresh' is run rather than at startup so -you don't need to set them in your early init file. +When 'package-quickstart' is non-nil, package.el precomputes a big +autoloads file so that activation of packages can be done much faster, +which can speed up your startup significantly. +It also causes variables like 'package-user-dir' and +'package-load-list' to be consulted when 'package-quickstart-refresh' +is run rather than at startup so you don't need to set them in your +early init file. *** New function 'package-activate-all'. @@ -752,19 +754,19 @@ Previously, setting 'xref-marker-ring-length' would only take effect if set before 'xref.el' was loaded. --- -*** xref-find-definitions now sets the mark at the buffer position -where it was invoked +*** 'xref-find-definitions' now sets the mark at the buffer position +where it was invoked. --- -*** New xref faces 'xref-file-header', 'xref-line-number', 'xref-match' +*** New xref faces 'xref-file-header', 'xref-line-number', 'xref-match'. ** Ecomplete *** The ecomplete sorting has changed to a decay-based algorithm. This can be controlled by the new 'ecomplete-sort-predicate' variable. -*** The 'ecompleterc' file is now placed in ~/.emacs.d/ecompleterc by default. -Of course it will still find it if you have it in ~/.ecompleterc +*** The 'ecompleterc' file is now placed in '~/.emacs.d/ecompleterc' by default. +Of course it will still find it if you have it in '~/.ecompleterc'. ** Gnus @@ -811,7 +813,7 @@ This option controls whether and how to use Gnus search groups as ** erc --- -*** 'erc-button-google-url' has been renamed 'erc-button-search-url' +*** 'erc-button-google-url' has been renamed to 'erc-button-search-url' and its value has been changed to Duck Duck Go. ** EUDC @@ -903,7 +905,7 @@ directories in the destination. ** Help --- -*** Description of variables and functions give an estimated first release +*** Description of variables and functions give an estimated first release. --- *** Output format of 'C-h l' ('view-lossage') has changed. @@ -982,7 +984,7 @@ and case-sensitivity together with search strings in the search ring. *** Isearch now has its own tool-bar and menu-bar menu. +++ -*** flush-lines prints and returns the number of deleted matching lines. +*** 'flush-lines' prints and returns the number of deleted matching lines. ** Debugger @@ -1025,7 +1027,7 @@ by default. ** Grep +++ -*** rgrep, lgrep and zrgrep now hide part of the command line +*** 'rgrep', 'lgrep' and 'zrgrep' now hide part of the command line that contains a list of ignored directories and files. Clicking on the button with ellipsis unhides it. The abbreviation can be disabled by the new option @@ -1084,10 +1086,10 @@ default, and not just the opening element. ** Eshell -*** TAB completion uses the standard completion-at-point rather than pcomplete -Its UI is slightly different but can be customized to behave similarly, -e.g. Pcomplete's default cycling can be obtained with -(setq completion-cycle-threshold 5). +*** TAB completion uses the standard 'completion-at-point' rather than +'pcomplete'. Its UI is slightly different but can be customized to +behave similarly, e.g. Pcomplete's default cycling can be obtained +with '(setq completion-cycle-threshold 5)'. --- *** Expansion of history event designators is disabled by default. @@ -1122,7 +1124,7 @@ variable for remote shells. It still defaults to "/bin/sh". ** Single shell commands ---- ++++ *** 'async-shell-command-width' defines the number of display columns available for output of asynchronous shell commands. @@ -1186,6 +1188,7 @@ Setting this option to an integer causes URLs displayed in Rcirc buffers to be truncated to that many characters. ** Register + --- *** The return value of method 'register-val-describe' includes the names of buffers shown by the windows of a window configuration. @@ -1308,7 +1311,7 @@ frame when making a frame. *** New predicates 'display-blink-cursor-p' and 'display-symbol-keys-p'. These predicates are to be preferred over 'display-graphic-p' when testing for blinking cursor capability and the capability to have -symbols (e.g., [return], [tab], [backspace]) as keys respectively. +symbols (e.g., '[return]', '[tab]', '[backspace]') as keys respectively. ** Tabulated List mode @@ -1329,8 +1332,8 @@ near the current column in Tabulated Lists (see variables ** CUA mode --- -*** New defcustom 'cua-rectangle-terminal-modifier-key'. -This defcustom allows for the customization of the modifier key used +*** New user option 'cua-rectangle-terminal-modifier-key'. +This user option allows for the customization of the modifier key used in a terminal frame. ** JS mode @@ -1343,11 +1346,11 @@ will be supported in 'js-mode' and derivative modes. ('js-jsx-mode' no longer needs to be enabled.) --- -*** New defcustom 'js-jsx-detect-syntax' disables automatic detection. +*** New user option 'js-jsx-detect-syntax' disables automatic detection. This is turned on by default. --- -*** New defcustom 'js-jsx-syntax' enables JSX syntax unconditionally. +*** New user option 'js-jsx-syntax' enables JSX syntax unconditionally. This is off by default. --- @@ -1367,7 +1370,7 @@ of the React developer community (see 'js-jsx-align->-with-<'), otherwise still adhering to SGML conventions. --- -*** New defcustom 'js-jsx-align->-with-<' controls '>' indents. +*** New user option 'js-jsx-align->-with-<' controls '>' indents. Commonly in JSX code, a '>' on its own line is indented at the same level as its opening '<'. This is the new default for JSX. This behavior is slightly different than that used by SGML in Emacs, where @@ -1390,12 +1393,12 @@ The old behavior can be emulated by controlling JSX indentation independently of JS, by setting 'js-jsx-indent-level'. --- -*** New defcustom 'js-jsx-indent-level' for different JSX indentation. +*** New user option 'js-jsx-indent-level' for different JSX indentation. If you wish to indent JSX by a different number of spaces than JS, set -this variable to the desired number. +this user option to the desired number. --- -*** New defcustom 'js-jsx-attribute-offset' for JSX attribute indents. +*** New user option 'js-jsx-attribute-offset' for JSX attribute indents. --- *** New variable 'js-syntactic-mode-name' controls mode name display. @@ -1412,7 +1415,7 @@ name, too. ** Autorevert *** New variable 'auto-revert-avoid-polling' for saving power. -When set to a non-nil value, buffers in Auto-Revert mode are no longer +When set to a non-nil value, buffers in Auto Revert mode are no longer polled for changes periodically. This reduces the power consumption of an idle Emacs, but may fail on some network file systems; set 'auto-revert-notify-exclude-dir-regexp' to match files where @@ -1449,8 +1452,8 @@ documentation of the new mode and its commands. * Incompatible Lisp Changes in Emacs 27.1 -** In compilation-error-regexp-alist the old undocumented feature where 'line' -could be a function of 2 arguments has been dropped. +** In 'compilation-error-regexp-alist' the old undocumented feature +where 'line' could be a function of 2 arguments has been dropped. ** 'define-fringe-bitmap' is always defined, even when Emacs is built without any GUI support. @@ -1473,11 +1476,11 @@ its default value changed in Emacs 27.1. ** The REPETITIONS argument of 'benchmark-run' can now also be a variable. -** Interpretation of relative HOME directory has changed. -If $HOME is set to a relative file name, 'expand-file-name' now +** Interpretation of relative 'HOME' directory has changed. +If "$HOME" is set to a relative file name, 'expand-file-name' now interprets it relative to the directory where Emacs was started, not relative to the 'default-directory' of the current buffer. We recommend -always setting $HOME to an absolute file name, so that its meaning is +always setting "$HOME" to an absolute file name, so that its meaning is independent of where Emacs was started. ** The FILENAME argument to 'file-name-base' is now mandatory and no @@ -1503,7 +1506,7 @@ old-style backquotes as new-style, bind the new variable integer, Emacs now signals an error if the number is too large for the implementation to format. -** logb now returns infinity when given an infinite or zero argument, +** 'logb' now returns infinity when given an infinite or zero argument, and returns a NaN when given a NaN. Formerly, it returned an extreme fixnum for such arguments. @@ -1554,11 +1557,11 @@ they are now allocated like any other pseudovector. As a result, the removed. +++ -** Reversed character ranges are no longer permitted in rx. +** Reversed character ranges are no longer permitted in 'rx'. Previously, ranges where the starting character is greater than the ending character were silently omitted. For example, '(rx (any "@z-a" (?9 . ?0)))' would match '@' only. -Now, such rx expressions generate an error. +Now, such 'rx' expressions generate an error. +++ ** 'text-mode' no longer sets the value of 'indent-line-function'. @@ -1567,7 +1570,7 @@ The global value of 'indent-line-function', which defaults to 'text-mode'. To get back the old behavior, add a function to 'text-mode-hook' which -performs (setq-local indent-line-function #'indent-relative). +performs '(setq-local indent-line-function #'indent-relative)'. ** 'make-process' no longer accepts a non-nil ':stop' key. This has never worked reliably, and now causes an error. @@ -1576,7 +1579,7 @@ never worked reliably, and now causes an error. * Lisp Changes in Emacs 27.1 ** New 'help-fns-describe-variable-functions' hook. -Makes it possible to add metadata information to describe-variable. +Makes it possible to add metadata information to 'describe-variable'. ** i18n (internationalization) @@ -1584,7 +1587,7 @@ Makes it possible to add metadata information to describe-variable. according to the given numeric value. +++ -** inhibit-null-byte-detection is renamed to inhibit-nul-byte-detection +** 'inhibit-null-byte-detection' is renamed to 'inhibit-nul-byte-detection'. +++ ** 'self-insert-command' takes the char to insert as (optional) argument. @@ -1628,8 +1631,10 @@ like 'file-attributes' that compute file sizes and other attributes, functions like 'process-id' that compute process IDs, and functions like 'user-uid' and 'group-gid' that compute user and group IDs. +** Time values + +++ -** Although the default timestamp format is still (HI LO US PS), +*** Although the default timestamp format is still '(HI LO US PS)', it is planned to change in a future Emacs version, to exploit bignums. The documentation has been updated to mention that the timestamp format may change and that programs should use functions like @@ -1638,22 +1643,22 @@ probing the innards of a timestamp directly, or creating a timestamp by hand. +++ -** 'encode-time' supports a new API '(encode-time TIME &optional FORM)'. +*** 'encode-time' supports a new API '(encode-time TIME &optional FORM)'. This can convert decoded times and Lisp time values to Lisp timestamps of various forms, including a new timestamp form '(TICKS . HZ)', where TICKS is an integer and HZ is a positive integer denoting a clock frequency. The old 'encode-time' API is still supported. +++ -** 'time-add', 'time-subtract', and 'time-less-p' now accept +*** 'time-add', 'time-subtract', and 'time-less-p' now accept infinities and NaNs too, and propagate them or return nil like floating-point operators do. +++ -** New function 'time-equal-p' compares time values for equality. +*** New function 'time-equal-p' compares time values for equality. +++ -** 'format-time-string' supports a new conversion specifier flag '+' +*** 'format-time-string' supports a new conversion specifier flag '+' that acts like the '0' flag but also puts a '+' before nonnegative years containing more than four digits. This is for compatibility with POSIX.1-2017. @@ -1706,7 +1711,6 @@ of the Emacs Lisp Reference manual for more detail. +++ ** Window change functions have been redesigned. - Hooks reacting to window changes run now only when redisplay detects that a change has actually occurred. Six hooks are now provided: 'window-buffer-change-functions' (run after window buffers have @@ -1734,7 +1738,7 @@ See the section "(elisp) Window Hooks" in the Elisp manual for a detailed explanation of the new behavior. +++ -*** New option 'resize-mini-frames'. +** New option 'resize-mini-frames'. This option allows to automatically resize minibuffer-only frames similarly to how minibuffer windows are resized on "normal" frames. @@ -1765,7 +1769,7 @@ This avoids problems in calls like '(read (format "#x%x" -1))', and is more compatible with bignums. To get the traditional machine-dependent behavior, set the experimental variable 'binary-as-unsigned' to t, and if the new behavior breaks your code please email -32252@debbugs.gnu.org. Because '%o' and '%x' can now format signed +<32252@debbugs.gnu.org>. Because '%o' and '%x' can now format signed integers, they now support the '+' and space flags. ** To avoid confusion caused by "smart quotes", the reader signals an @@ -1894,16 +1898,31 @@ some years back. It now respects 'imagemagick-types-inhibit' as a way to disable that. --- -*** Some image-mode variables are now buffer-local. +*** Some 'image-mode' variables are now buffer-local. The image parameters 'image-transform-rotation', 'image-transform-scale' and 'image-transform-resize' are now declared buffer-local, so each buffer could have its own values for these parameters. -** The function 'load' now behaves correctly when loading modules. +** Modules + +*** The function 'load' now behaves correctly when loading modules. Specifically, it puts the module name into 'load-history', prints loading messages if requested, and protects against recursive loads. +*** New module environment function 'process_input' to process user +input while module code is running. + +*** New module environment functions 'make_time' and 'extract_time' to +convert between timespec structures and Emacs Lisp time values. + +*** New module environment functions 'make_big_integer' and +'extract_big_integer' to create and extract arbitrary-size integer +values. + +*** emacs-module.h now defines a macro 'EMACS_MAJOR_VERSION' that expands +to the major version of the latest Emacs supported by the header. + +++ ** The function 'read-variable' now uses its own history list. The history of variable names read by 'read-variable' is recorded in @@ -1936,13 +1955,10 @@ The new function 'image-scaling-p' can be used to test whether any given frame supports resizing. +++ -** (locale-info 'paper) now returns the paper size on systems that support it. +** '(locale-info 'paper)' now returns the paper size on systems that support it. This is currently supported on GNUish hosts and on modern versions of MS-Windows. -** New module environment function 'process_input' to process user -input while module code is running. - +++ ** The function 'regexp-opt' accepts an additional optional argument. By default, the regexp returned by 'regexp-opt' may match the strings @@ -1956,16 +1972,6 @@ returns a regexp that never matches anything, which is an identity for this operation. Previously, the empty string was returned in this case. -** New module environment functions 'make_time' and 'extract_time' to -convert between timespec structures and Emacs Lisp time values. - -** New module environment functions 'make_big_integer' and -'extract_big_integer' to create and extract arbitrary-size integer -values. - -** emacs-module.h now defines a macro EMACS_MAJOR_VERSION that expands -to the major version of the latest Emacs supported by the header. - * Changes in Emacs 27.1 on Non-Free Operating Systems commit 926a394997eaae55b797a90cb2cd037bbe3c3db4 Author: Paul Eggert Date: Sun May 5 17:35:05 2019 -0700 Use simpler way to print function pointers The module code can’t possibly work on weird platforms where function pointers are wider than data pointers, so there’s no need to bother with the stackoverflow-like approach that is intended only for portability to such platforms. Besides, the stackoverflow-like approach does not work well on weird platforms where CHAR_BIT is not a multiple of 4. * src/lisp.h (pMx): New macro. * src/print.c (data_from_funcptr) [HAVE_MODULES]: New function. (print_vectorlike) [HAVE_MODULES]: Use it. (print_object): Make sure buf is big enough for this. diff --git a/src/lisp.h b/src/lisp.h index ca833476c0..61cc20e9d4 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -144,11 +144,13 @@ typedef intmax_t printmax_t; typedef uintmax_t uprintmax_t; # define pMd PRIdMAX # define pMu PRIuMAX +# define pMx PRIxMAX #else typedef EMACS_INT printmax_t; typedef EMACS_UINT uprintmax_t; # define pMd pI"d" # define pMu pI"u" +# define pMx pI"x" #endif /* Use pD to format ptrdiff_t values, which suffice for indexes into diff --git a/src/print.c b/src/print.c index 08c39d3466..406abbf4a3 100644 --- a/src/print.c +++ b/src/print.c @@ -1361,6 +1361,19 @@ print_prune_string_charset (Lisp_Object string) return string; } +#ifdef HAVE_MODULES +/* Return a data pointer equal to FUNCPTR. */ + +static void const * +data_from_funcptr (void (*funcptr) (void)) +{ + /* The module code, and the POSIX API for dynamic linking, already + assume that function and data pointers are represented + interchangeably, so it's OK to assume that here too. */ + return (void const *) funcptr; +} +#endif + static bool print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, char *buf) @@ -1788,30 +1801,20 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, { print_c_string ("#stack_top = buf; maybe_quit (); commit 31c60dfbd8541c9f1b1bc8127dde85e5d5af51b5 Author: Juri Linkov Date: Sun May 5 23:07:44 2019 +0300 * lisp/progmodes/flymake.el (flymake-start): Check for flymake-mode. Check for the value of flymake-mode after hooks are finished (bug#34294) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 5c7a7cc070..abe2933c10 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -860,6 +860,7 @@ with a report function." (defvar-local flymake--recent-changes nil "Recent changes collected by `flymake-after-change-function'.") +(defvar flymake-mode) (defun flymake-start (&optional deferred force) "Start a syntax check for the current buffer. @@ -904,7 +905,7 @@ Interactively, with a prefix arg, FORCE is t." (add-hook 'window-configuration-change-hook #'start-on-display 'append 'local)) - (t + (flymake-mode (setq flymake-check-start-time (float-time)) (let ((backend-args (and commit be3ab9f301bf741b0410c1f9fb1c5ce6dda1c39a Author: Juri Linkov Date: Sun May 5 23:05:01 2019 +0300 * lisp/progmodes/flymake.el: Rename flymake-start-on-newline (bug#34294) * lisp/progmodes/flymake.el (flymake-start-on-newline): Rename from flymake-start-syntax-check-on-newline. (flymake-start-syntax-check-on-newline): Define obsolete alias. (flymake-no-changes-timeout): Add customization option nil. * doc/misc/flymake.texi (Using Flymake): Rename variable. diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index 894203ca5a..4608d1c973 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -89,7 +89,7 @@ nil; @item a newline character is added to the buffer, unless -@code{flymake-start-syntax-check-on-newline} is nil; +@code{flymake-start-on-newline} is nil; @item some changes were made to the buffer more than @code{0.5} seconds ago @@ -222,7 +222,7 @@ If any changes are made to the buffer, syntax check is automatically started after this many seconds, unless the user makes another change, which resets the timer. -@item flymake-start-syntax-check-on-newline +@item flymake-start-on-newline A boolean flag indicating whether to start syntax check immediately after a newline character is inserted into the buffer. diff --git a/etc/NEWS b/etc/NEWS index baec8e7163..caaffc2281 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -704,6 +704,10 @@ Control whether Flymake starts checking the buffer on save. This enables more efficient backends. See the docstring of 'flymake-diagnostic-functions' or the Flymake manual for details. ++++ +*** The variable 'flymake-start-syntax-check-on-newline' is obsolete +and renamed to 'flymake-start-on-newline'. + ** Ruby *** The Rubocop Flymake diagnostic function will only run Lint cops if diff --git a/etc/TODO b/etc/TODO index ccb82cd296..dc594a007e 100644 --- a/etc/TODO +++ b/etc/TODO @@ -143,15 +143,6 @@ See the 'test' directory for examples. * Small but important fixes needed in existing features: -** Flymake's customization mechanism needs to be both simpler (fewer -levels of indirection) and better documented, so it is easier to -understand. I find it quite hard to figure out what compilation -command it will use. - -I suggest totally rewriting that part of Flymake, using the simplest -mechanism that suffices for the specific needs. That will be easy -for users to customize. - ** Distribute a bar cursor of width > 1 evenly between the two glyphs on each side of the bar (what to do at the edges?). diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index d6cd370dac..5c7a7cc070 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -4,7 +4,7 @@ ;; Author: Pavel Kobyakov ;; Maintainer: João Távora -;; Version: 1.0.5 +;; Version: 1.0.6 ;; Package-Requires: ((emacs "26.1")) ;; Keywords: c languages tools @@ -38,10 +38,9 @@ ;; The main interactive entry point is the `flymake-mode' minor mode, ;; which periodically and automatically initiates checks as the user ;; is editing the buffer. The variables `flymake-no-changes-timeout', -;; `flymake-start-syntax-check-on-newline' and -;; `flymake-start-on-flymake-mode' give finer control over the events -;; triggering a check, as does the interactive command -;; `flymake-start', which immediately starts a check. +;; `flymake-start-on-newline' and `flymake-start-on-flymake-mode' +;; give finer control over the events triggering a check, as does the +;; interactive command `flymake-start', which immediately starts a check. ;; ;; Shortly after each check, a summary of collected diagnostics should ;; appear in the mode-line. If it doesn't, there might not be a @@ -178,14 +177,19 @@ See `flymake-error-bitmap' and `flymake-warning-bitmap'." (const right-fringe) (const :tag "No fringe indicators" nil))) -(defcustom flymake-start-syntax-check-on-newline t +(define-obsolete-variable-alias 'flymake-start-syntax-check-on-newline + 'flymake-start-on-newline "27.1") + +(defcustom flymake-start-on-newline t "Start syntax check if newline char was added/removed from the buffer." :type 'boolean) (defcustom flymake-no-changes-timeout 0.5 "Time to wait after last change before automatically checking buffer. -If nil, never start checking buffer automatically like this." - :type 'number) +If nil, never start checking buffer automatically like this. +You may also want to disable `flymake-start-on-newline'." + :type '(choice (number :tag "Timeout in seconds") + (const :tag "No check on timeout" nil))) (defcustom flymake-gui-warnings-enabled t "Enables/disables GUI warnings." @@ -203,7 +207,7 @@ Specifically, start it when the buffer is actually displayed." :type 'boolean) (defcustom flymake-start-on-save-buffer t - "If non-nil start syntax check when a buffer is saved. + "If non-nil, start syntax check when a buffer is saved. Specifically, start it when the saved buffer is actually displayed." :version "27.1" :type 'boolean) @@ -940,12 +944,11 @@ Flymake collects diagnostic information from multiple sources, called backends, and visually annotates the buffer with the results. -Flymake performs these checks while the user is editing. The -customization variables `flymake-start-on-flymake-mode', -`flymake-no-changes-timeout' and -`flymake-start-syntax-check-on-newline' determine the exact -circumstances whereupon Flymake decides to initiate a check of -the buffer. +Flymake performs these checks while the user is editing. +The customization variables `flymake-start-on-flymake-mode', +`flymake-no-changes-timeout' and `flymake-start-on-newline' +determine the exact circumstances whereupon Flymake decides +to initiate a check of the buffer. The commands `flymake-goto-next-error' and `flymake-goto-prev-error' can be used to navigate among Flymake @@ -1039,7 +1042,7 @@ Do it only if `flymake-no-changes-timeout' is non-nil." START and STOP and LEN are as in `after-change-functions'." (let((new-text (buffer-substring start stop))) (push (list start stop new-text) flymake--recent-changes) - (when (and flymake-start-syntax-check-on-newline (equal new-text "\n")) + (when (and flymake-start-on-newline (equal new-text "\n")) (flymake-log :debug "starting syntax check as new-line has been seen") (flymake-start t)) (flymake--schedule-timer-maybe))) commit 4bfde2a79046519815e2bb8a8eb72e22eca0641f Author: Juri Linkov Date: Sun May 5 22:51:14 2019 +0300 * lisp/vc/ediff-ptch.el (ediff-fixup-patch-map): Remove Git prefixes. Strip possible source/destination prefixes such as a/ and b/ from directory names. (Bug#35420) (ediff-fixup-patch-map, ediff-dispatch-file-patching-job) (ediff-patch-file-internal): Replace string-match with string-match-p. diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el index 4178b5a8c0..70c03b5c01 100644 --- a/lisp/vc/ediff-ptch.el +++ b/lisp/vc/ediff-ptch.el @@ -297,11 +297,24 @@ program." ;; file names. This is a heuristic intended to improve guessing (let ((default-directory (file-name-directory filename))) (unless (or (file-name-absolute-p base-dir1) - (file-name-absolute-p base-dir2) - (not (file-exists-p base-dir1)) - (not (file-exists-p base-dir2))) - (setq base-dir1 "" - base-dir2 ""))) + (file-name-absolute-p base-dir2)) + (if (and (file-exists-p base-dir1) + (file-exists-p base-dir2)) + (setq base-dir1 "" + base-dir2 "") + ;; Strip possible source/destination prefixes + ;; such as a/ and b/ from dir names. + (save-match-data + (let ((m1 (when (string-match "^[^/]+/" base-dir1) + (cons (substring base-dir1 0 (match-end 0)) + (substring base-dir1 (match-end 0))))) + (m2 (when (string-match "^[^/]+/" base-dir2) + (cons (substring base-dir2 0 (match-end 0)) + (substring base-dir2 (match-end 0)))))) + (when (and (file-exists-p (cdr m1)) + (file-exists-p (cdr m2))) + (setq base-dir1 (car m1) + base-dir2 (car m2)))))))) (or (string= (car proposed-file-names) "/dev/null") (setcar proposed-file-names (ediff-file-name-sans-prefix @@ -325,8 +338,8 @@ program." (mapc (lambda (session-info) (let ((proposed-file-names (ediff-get-session-objA-name session-info))) - (if (and (string-match "^/null/" (car proposed-file-names)) - (string-match "^/null/" (cdr proposed-file-names))) + (if (and (string-match-p "^/null/" (car proposed-file-names)) + (string-match-p "^/null/" (cdr proposed-file-names))) ;; couldn't intuit the file name to patch, so ;; something is amiss (progn @@ -574,7 +587,7 @@ optional argument, then use it." (ediff-patch-file-internal patch-buf (if (and ediff-patch-map - (not (string-match + (not (string-match-p "^/dev/null" ;; this is the file to patch (ediff-get-session-objA-name (car ediff-patch-map)))) @@ -677,7 +690,7 @@ optional argument, then use it." target-buf buf-to-patch file-name-magic-p patch-return-code ctl-buf backup-style aux-wind) - (if (string-match "V" ediff-patch-options) + (if (string-match-p "V" ediff-patch-options) (error "Ediff doesn't take the -V option in `ediff-patch-options'--sorry")) commit 7bba702e1ad1ed343618e44cf5bbc2a1f079be0c Author: Juri Linkov Date: Sun May 5 22:43:27 2019 +0300 Use ngettext instead of dired-plural-s in Dired (bug#35287) * lisp/dired-aux.el (dired-map-over-marks-check): Use ngettext instead of dired-plural-s. (dired-create-files): Also add colon after operation name. (dired-compare-directories): Use ngettext and format-message. (dired-do-compress-to): Use ngettext. * lisp/dired.el (dired-internal-do-deletions) (dired-clean-up-after-deletion): Use ngettext instead of dired-plural-s. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index b81c0d1a4f..0cf9e6e2e9 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -246,9 +246,11 @@ Examples of PREDICATE: (lambda () (dired-mark-if (member (dired-get-filename nil t) file-list2) nil))) - (message "Marked in dir1: %s files, in dir2: %s files" - (length file-list1) - (length file-list2)))) + (message "Marked in dir1: %s, in dir2: %s" + (format-message (ngettext "%d file" "%d files" (length file-list1)) + (length file-list1)) + (format-message (ngettext "%d file" "%d files" (length file-list2)) + (length file-list2))))) (defun dired-file-set-difference (list1 list2 predicate) "Combine LIST1 and LIST2 using a set-difference operation. @@ -1065,7 +1067,9 @@ and `dired-compress-files-alist'." (shell-quote-argument (file-name-nondirectory file-desc))) in-files " ")))))) - (message "Compressed %d file(s) to %s" + (message (ngettext "Compressed %d file to %s" + "Compressed %d files to %s" + (length in-files)) (length in-files) (file-name-nondirectory out-file))))))) @@ -1193,12 +1197,14 @@ Return nil if no change in files." (string (if (eq op-symbol 'compress) "Compress or uncompress" (capitalize (symbol-name op-symbol))))) (if (not failures) - (message "%s: %d file%s." - string total (dired-plural-s total)) + (message (ngettext "%s: %d file." "%s: %d files." total) + string total) ;; end this bunch of errors: (dired-log-summary - (format "Failed to %s %d of %d file%s" - (downcase string) count total (dired-plural-s total)) + (format (ngettext "Failed to %s %d of %d file" + "Failed to %s %d of %d files" + total) + (downcase string) count total) failures))))) ;;;###autoload @@ -1798,32 +1804,36 @@ ESC or `q' to not overwrite any of the remaining files, (progn (push (dired-make-relative from) failures) - (dired-log "%s `%s' to `%s' failed:\n%s\n" + (dired-log "%s: `%s' to `%s' failed:\n%s\n" operation from to err)))))))) (cond (dired-create-files-failures (setq failures (nconc failures dired-create-files-failures)) (dired-log-summary - (format "%s failed for %d file%s in %d requests" - operation (length failures) - (dired-plural-s (length failures)) - total) + (format (ngettext "%s failed for %d file in %d requests" + "%s failed for %d files in %d requests" + (length failures)) + operation (length failures) total) failures)) (failures (dired-log-summary - (format "%s failed for %d of %d file%s" - operation (length failures) - total (dired-plural-s total)) + (format (ngettext "%s: %d of %d file failed" + "%s: %d of %d files failed" + total) + operation (length failures) total) failures)) (skipped (dired-log-summary - (format "%s: %d of %d file%s skipped" - operation (length skipped) total - (dired-plural-s total)) + (format (ngettext "%s: %d of %d file skipped" + "%s: %d of %d files skipped" + total) + operation (length skipped) total) skipped)) (t - (message "%s: %s file%s" - operation success-count (dired-plural-s success-count))))) + (message (ngettext "%s: %d file done" + "%s: %d files done" + success-count) + operation success-count)))) (dired-move-to-filename)) (defun dired-do-create-files (op-symbol file-creator operation arg diff --git a/lisp/dired.el b/lisp/dired.el index 63082fe392..385126514b 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3212,9 +3212,10 @@ non-empty directories is allowed." (if (not failures) (progress-reporter-done progress-reporter) (dired-log-summary - (format "%d of %d deletion%s failed" - (length failures) count - (dired-plural-s count)) + (format (ngettext "%d of %d deletion failed" + "%d of %d deletions failed" + count) + (length failures) count) failures))))) (message "(No deletions performed)"))) (dired-move-to-filename)) @@ -3267,8 +3268,9 @@ confirmation. To disable the confirmation, see (let ((buf-list (dired-buffers-for-dir (expand-file-name fn)))) (and buf-list (and dired-clean-confirm-killing-deleted-buffers - (y-or-n-p (format "Kill Dired buffer%s of %s, too? " - (dired-plural-s (length buf-list)) + (y-or-n-p (format (ngettext "Kill Dired buffer of %s, too? " + "Kill Dired buffers of %s, too? " + (length buf-list)) (file-name-nondirectory fn)))) (dolist (buf buf-list) (kill-buffer buf)))))) commit c64cb02cca320811032bb300ea6d12cf59acf65d Author: Juri Linkov Date: Sun May 5 22:34:03 2019 +0300 * lisp/emacs-lisp/lisp.el (insert-pair-alist): Precompute default value. Use unicode-property-table-internal with 'paired-bracket to append pairs of open/close characters to the default value (bug#35480). diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index d10d5f0d10..f73dbb269d 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -646,7 +646,13 @@ Interactively, the behavior depends on `narrow-to-defun-include-comments'." (narrow-to-region beg end)))) (defvar insert-pair-alist - '((?\( ?\)) (?\[ ?\]) (?\{ ?\}) (?\< ?\>) (?\" ?\") (?\' ?\') (?\` ?\')) + (append '((?\< ?\>) (?\" ?\") (?\' ?\') (?\` ?\')) + (let (alist) + (map-char-table + (lambda (open close) + (when (< open close) (push (list open close) alist))) + (unicode-property-table-internal 'paired-bracket)) + (nreverse alist))) "Alist of paired characters inserted by `insert-pair'. Each element looks like (OPEN-CHAR CLOSE-CHAR) or (COMMAND-CHAR OPEN-CHAR CLOSE-CHAR). The characters OPEN-CHAR and CLOSE-CHAR commit df9b56ecff43b64f39e98ab118fe9a0f299882c4 Author: Juri Linkov Date: Sun May 5 22:27:33 2019 +0300 Rename shell-command-width to async-shell-command-width (bug#35055) * lisp/simple.el (async-shell-command-width): * lisp/net/tramp.el (tramp-handle-shell-command): * test/lisp/net/tramp-tests.el (tramp-test32-shell-command): * doc/misc/tramp.texi (Remote processes): Rename this variable. * doc/emacs/misc.texi (Single Shell): Add async-shell-command-width. diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 7d7065a441..5f74392736 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -775,6 +775,13 @@ documentation for more possibilities. displayed only when the command generates output, set @code{async-shell-command-display-buffer} to @code{nil}. +@vindex async-shell-command-width + The option @code{async-shell-command-width} defines the number of display +columns available for output of asynchronous shell commands. +A positive integer tells the shell to use that number of columns for +command output. The default value is @code{nil} that means to use +the same number of columns as provided by the shell. + @kindex M-| @findex shell-command-on-region @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!}, but diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 0c51f15fbb..2eb5b45eb2 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -3093,9 +3093,9 @@ uses @file{/system/bin/sh}). Like the variables in the previous section, these variables can be changed via connection-local variables. -@vindex shell-command-width +@vindex async-shell-command-width @vindex COLUMNS@r{, environment variable} -If Emacs supports the variable @code{shell-command-width} (since Emacs +If Emacs supports the variable @code{async-shell-command-width} (since Emacs 27.1), @value{tramp} cares about its value for asynchronous shell commands. It specifies the number of display columns for command output. For synchronous shell commands, a similar effect can be diff --git a/etc/NEWS b/etc/NEWS index 6fcf5187e9..baec8e7163 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1119,8 +1119,8 @@ variable for remote shells. It still defaults to "/bin/sh". ** Single shell commands --- -*** 'shell-command-width' defines the number of display columns -available for output of asynchronous or remote shell commands. +*** 'async-shell-command-width' defines the number of display columns +available for output of asynchronous shell commands. ** Pcomplete diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 911fa91272..1f83756c32 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3640,10 +3640,10 @@ support symbolic links." (if (and (not current-buffer-p) (integerp asynchronous)) (let ((tramp-remote-process-environment - ;; `shell-command-width' has been introduced with Emacs 27.1. - (if (natnump (bound-and-true-p shell-command-width)) + ;; `async-shell-command-width' has been introduced with Emacs 27.1. + (if (natnump (bound-and-true-p async-shell-command-width)) (cons (format "COLUMNS=%d" - (bound-and-true-p shell-command-width)) + (bound-and-true-p async-shell-command-width)) tramp-remote-process-environment) tramp-remote-process-environment))) (prog1 diff --git a/lisp/simple.el b/lisp/simple.el index acea1f9ddc..4454791ad2 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3353,7 +3353,7 @@ is output." :group 'shell :version "26.1") -(defcustom shell-command-width nil +(defcustom async-shell-command-width nil "Number of display columns available for asynchronous shell command output. If nil, use the shell default number (usually 80 columns). If a positive integer, tell the shell to use that number of columns for @@ -3627,8 +3627,8 @@ impose the use of a shell (with its need to quote arguments)." (shell-command--save-pos-or-erase) (setq default-directory directory) (let ((process-environment - (if (natnump shell-command-width) - (cons (format "COLUMNS=%d" shell-command-width) + (if (natnump async-shell-command-width) + (cons (format "COLUMNS=%d" async-shell-command-width) process-environment) process-environment))) (setq proc diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index cba697da18..7d3c43408d 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4192,18 +4192,17 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Cleanup. (ignore-errors (delete-file tmp-name))) - ;; Test `shell-command-width' of `async-shell-command'. - ;; Since Emacs 27.1. - (when (and (boundp 'shell-command-width) + ;; Test `async-shell-command-width'. Since Emacs 27.1. + (when (and (boundp 'async-shell-command-width) (zerop (call-process "tput" nil nil nil "cols")) (zerop (process-file "tput" nil nil nil "cols"))) - (let (shell-command-width) + (let (async-shell-command-width) (should (string-equal (format "%s\n" (car (process-lines "tput" "cols"))) (tramp--test-shell-command-to-string-asynchronously "tput cols"))) - (setq shell-command-width 1024) + (setq async-shell-command-width 1024) (should (string-equal "1024\n" commit 81487bf89122ef0f369690e421740d38dbc17e23 Author: Paul Eggert Date: Sun May 5 09:07:44 2019 -0700 Port mod-test to --enable-gcc-warnings * test/data/emacs-module/mod-test.c (NDEBUG): Undef, to prevent GCC from complaining “error: unused variable ‘dummy’” and failing to build the test, if --enable-gcc-warnings. diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c index ad962d5f68..2891b73c1a 100644 --- a/test/data/emacs-module/mod-test.c +++ b/test/data/emacs-module/mod-test.c @@ -19,7 +19,9 @@ along with GNU Emacs. If not, see . */ #include "config.h" +#undef NDEBUG #include + #include #include #include commit f9939b24ebeb222b3ca6f076512b18ed634a9b64 Author: Eli Zaretskii Date: Sun May 5 18:10:15 2019 +0300 ; * doc/emacs/display.texi (Displaying Boundaries): Fix a typo. diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index c27b9e7081..4985fabd54 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1181,7 +1181,7 @@ When the mode is enabled through the functions @code{display-fill-column-indicator-mode} or @code{global-display-fill-column-indicator-mode}, the initialization functions check if this variable is @code{non-nil}, otherwise the -initialization tries to set it to U+2502 or @sampl{|}. +initialization tries to set it to U+2502 or @samp{|}. @item fill-column-indicator @vindex fill-column-indicator commit 6709240b7a36d7aab7a83d4ddd2765e45e687c5d Author: Eli Zaretskii Date: Sun May 5 18:07:26 2019 +0300 Fix compilation of mod-test.c on MinGW * test/data/emacs-module/mod-test.c (Fmod_test_nanoseconds) [__MINGW32__]: Use _Static_assert, not static_assert, as the latter is not available in mingw.org's MinGW's assert.h. diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c index fccc60fe4d..ad962d5f68 100644 --- a/test/data/emacs-module/mod-test.c +++ b/test/data/emacs-module/mod-test.c @@ -377,7 +377,11 @@ Fmod_test_nanoseconds (emacs_env *env, ptrdiff_t nargs, emacs_value *args, void struct emacs_mpz nanoseconds; assert (LONG_MIN <= time.tv_sec && time.tv_sec <= LONG_MAX); mpz_init_set_si (nanoseconds.value, time.tv_sec); +#ifdef __MINGW32__ + _Static_assert (1000000000 <= ULONG_MAX, "unsupported architecture"); +#else static_assert (1000000000 <= ULONG_MAX, "unsupported architecture"); +#endif mpz_mul_ui (nanoseconds.value, nanoseconds.value, 1000000000); assert (0 <= time.tv_nsec && time.tv_nsec <= ULONG_MAX); mpz_add_ui (nanoseconds.value, nanoseconds.value, time.tv_nsec); commit cca81f22d972f4bfc953534104e9e72da421f51e Author: Jimmy Aguilar Mena Date: Sun May 5 16:14:34 2019 +0200 Fixed fill-column-indicator face removing background. *lisp/faces.el: Removed background in default fill-column-indicator face. *src/xdisp.c: fill-column-indicator face merged with saved face. diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 34215699b4..c27b9e7081 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1186,7 +1186,8 @@ initialization tries to set it to U+2502 or @sampl{|}. @item fill-column-indicator @vindex fill-column-indicator Specifies the face used to display the indicator. It inherits its -default values from shadow and the default face. +default values from shadow but without background color. To change +the indicator color you need to set only the foreground color of this face. @end table @vindex indicate-buffer-boundaries diff --git a/lisp/faces.el b/lisp/faces.el index b933279064..207b627f25 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2502,7 +2502,9 @@ unwanted effects." ;; Definition stolen from display-line-numbers. (defface fill-column-indicator - '((t :inherit (shadow default))) + '((t :inherit shadow :weight normal :slant normal + :underline nil :overline nil :strike-through nil + :box nil :invert-video nil :stipple nil)) "Face for displaying fill column indicator. This face is used when `display-fill-column-indicator-mode' is non-nil." diff --git a/src/xdisp.c b/src/xdisp.c index 1782748144..a8604d58af 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20201,7 +20201,7 @@ append_space_for_newline (struct it *it, bool default_face_p) XFIXNAT (Vdisplay_fill_column_indicator_character); it->face_id = merge_faces (it->w, Qfill_column_indicator, - 0, DEFAULT_FACE_ID); + 0, saved_face_id); face = FACE_FROM_ID(it->f, it->face_id); goto produce_glyphs; } @@ -20494,7 +20494,7 @@ extend_face_to_end_of_line (struct it *it) XFIXNAT (Vdisplay_fill_column_indicator_character); it->face_id = merge_faces (it->w, Qfill_column_indicator, - 0, DEFAULT_FACE_ID); + 0, saved_face_id); PRODUCE_GLYPHS (it); } @@ -20656,13 +20656,13 @@ extend_face_to_end_of_line (struct it *it) { if (it->current_x == fill_column_indicator_column) { - const int saved_face = it->face_id; + const int saved_face_id = it->face_id; it->face_id = - merge_faces (it->w, Qfill_column_indicator, 0, DEFAULT_FACE_ID); + merge_faces (it->w, Qfill_column_indicator, 0, saved_face_id); it->c = it->char_to_display = XFIXNAT (Vdisplay_fill_column_indicator_character); PRODUCE_GLYPHS (it); - it->face_id = saved_face; + it->face_id = saved_face_id; it->c = it->char_to_display = ' '; } else commit a336300ccf024824fbf50298623e04f369952670 Author: Jimmy Aguilar Mena Date: Fri May 3 19:27:59 2019 +0200 ;Corrected display-fill-column-indicator mode. Small corrections in the documentation and code format to merge into master. diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index e1467a3e0b..34215699b4 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1181,10 +1181,11 @@ When the mode is enabled through the functions @code{display-fill-column-indicator-mode} or @code{global-display-fill-column-indicator-mode}, the initialization functions check if this variable is @code{non-nil}, otherwise the -initialization tries to set it to U+2502 or '|'. +initialization tries to set it to U+2502 or @sampl{|}. -@item fill-column-face -Specifies the face used to display the indicator it inherits its +@item fill-column-indicator +@vindex fill-column-indicator +Specifies the face used to display the indicator. It inherits its default values from shadow and the default face. @end table diff --git a/etc/NEWS b/etc/NEWS index 80d7f4f24c..6fcf5187e9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -340,7 +340,7 @@ longer. ** Multicolor fonts such as "Noto Color Emoji" can be displayed on Emacs configured with Cairo drawing and linked with cairo >= 1.16.0. ---- ++++ ** Emacs now optionally displays a fill column indicator. This is similar to what 'fill-column-indicator' package provides, but @@ -354,28 +354,7 @@ The indicator is not displayed at all in minibuffer windows and in tooltips, as it is not useful there. There are 2 new buffer local variables and 1 face to customize this -mode: - -*** 'display-fill-column-indicator-column' is the column where the - indicator should be set. It can take positive numerical values for - the column or the special value t. Any other value disables the - indicator. The default value is t. - - When the value is t it means that the variable 'fill-column' will - be used. - -*** 'display-fill-column-indicator-char' is the character used for the - indicator. This character can be any valid char including unicode - ones if the user's font supports them. - - When the mode is enabled throw the functions - 'display-fill-column-indicator-mode' and - 'global-display-fill-column-indicator-mode', they check if there - is a value non-nil for this variable, otherwise the initialization - tries to set it to U+2502 or '|'. - -*** 'fill-column-face' is the face used to display the indicator it - inherits it default values from shadow and the default faces. +mode they are described in the manual "(emacs) Display". * Editing Changes in Emacs 27.1 diff --git a/lisp/cus-start.el b/lisp/cus-start.el index b935776a2d..4c4d5ebb16 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -650,11 +650,14 @@ since it could result in memory overflow and make Emacs crash." "26.1") (display-fill-column-indicator display-fill-column-indicator - (choice - (const :tag "Off (nil)" :value nil) - (const :tag "On (t)" :value t)) - "27.1") + boolean "27.1") (display-fill-column-indicator-column display-fill-column-indicator + (choice + (const :tag "Use fill-column variable" + :value t) + (const :tag "Fixed column number" + :value 70 + :format "%v")) integer "27.1") (display-fill-column-indicator-character display-fill-column-indicator character "27.1") diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el index f6b7352c21..6d5f5a9f89 100644 --- a/lisp/display-fill-column-indicator.el +++ b/lisp/display-fill-column-indicator.el @@ -1,6 +1,6 @@ ;;; display-fill-column-indicator.el --- interface for display-fill-column-indicator -*- lexical-binding: t -*- -;; Copyright (C) 2017-2019 Free Software Foundation, Inc. +;; Copyright (C) 2019 Free Software Foundation, Inc. ;; Maintainer: emacs-devel@gnu.org ;; Keywords: convenience @@ -37,18 +37,18 @@ ;;; Code: (defgroup display-fill-column-indicator nil - "Display a fill column indicator in th buffer." + "Display a fill column indicator in the buffer." :group 'convenience :group 'display) ;;;###autoload (define-minor-mode display-fill-column-indicator-mode - "Toggle display fill column indicator. + "Toggle display of fill-column indicator. This uses `display-fill-column-indicator' internally. -To change the position of the column displayed by default, -customize `display-fill-column-indicator-column' you can change the +To change the position of the column displayed by default +customize `display-fill-column-indicator-column'. You can change the character for the indicator setting `display-fill-column-indicator-character'." :lighter nil (if display-fill-column-indicator-mode diff --git a/lisp/faces.el b/lisp/faces.el index 121cf7ef1d..b933279064 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2501,15 +2501,11 @@ unwanted effects." :group 'display-line-numbers) ;; Definition stolen from display-line-numbers. -(defface fill-column-face +(defface fill-column-indicator '((t :inherit (shadow default))) - "Face for displaying fill column indicator line. + "Face for displaying fill column indicator. This face is used when `display-fill-column-indicator-mode' is -non-nil. - -If you customize the font of this face, make sure it is a -monospaced font, otherwise the line's characters will not line -up horizontally." +non-nil." :version "27.1" :group 'basic-faces :group 'display-fill-column-indicator) diff --git a/src/xdisp.c b/src/xdisp.c index 080c40c3f3..1782748144 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -379,11 +379,14 @@ static Lisp_Object list_of_error; || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t')))) \ /* Test all the conditions needed to print the fill column indicator. */ -#define FILL_COLUMN_INDICATOR_NEEDED(it) \ - !NILP (Vdisplay_fill_column_indicator) \ - && (it->continuation_lines_width == 0) \ - && (!NILP (Vdisplay_fill_column_indicator_column)) \ - && FIXNATP (Vdisplay_fill_column_indicator_character) +#define FILL_COLUMN_INDICATOR_NEEDED(it) \ + Vdisplay_fill_column_indicator \ + && (it->continuation_lines_width == 0) \ + && (!NILP (Vdisplay_fill_column_indicator_column)) \ + && FIXNATP (Vdisplay_fill_column_indicator_character) \ + && ((EQ (Vdisplay_fill_column_indicator_column, Qt) \ + && FIXNATP (BVAR (current_buffer, fill_column))) \ + || (FIXNATP (Vdisplay_fill_column_indicator_column))) /* True means print newline to stdout before next mini-buffer message. */ @@ -20168,17 +20171,16 @@ append_space_for_newline (struct it *it, bool default_face_p) /* Corner case for when display-fill-column-indicator-mode is active and the extra character should be added in the - same place than the line */ + same place than the line. */ if ((it->w->pseudo_window_p == 0) && FILL_COLUMN_INDICATOR_NEEDED(it)) { int fill_column_indicator_column = -1; - if (EQ (Vdisplay_fill_column_indicator_column, Qt) - && FIXNATP (BVAR (current_buffer, fill_column))) + if (EQ (Vdisplay_fill_column_indicator_column, Qt)) fill_column_indicator_column = XFIXNAT (BVAR (current_buffer, fill_column)); - else if (FIXNATP (Vdisplay_fill_column_indicator_column)) + else fill_column_indicator_column = XFIXNAT (Vdisplay_fill_column_indicator_column); @@ -20198,7 +20200,7 @@ append_space_for_newline (struct it *it, bool default_face_p) it->c = it->char_to_display = XFIXNAT (Vdisplay_fill_column_indicator_character); it->face_id = - merge_faces (it->w, Qfill_column_face, + merge_faces (it->w, Qfill_column_indicator, 0, DEFAULT_FACE_ID); face = FACE_FROM_ID(it->f, it->face_id); goto produce_glyphs; @@ -20221,8 +20223,8 @@ append_space_for_newline (struct it *it, bool default_face_p) set. */ if (it->glyph_row->reversed_p /* But if the appended newline glyph goes all the way to - the end of the row, there will be no stretch glyph, - so leave the box flag set. */ + the end of the row, there will be no stretch glyph, + so leave the box flag set. */ && saved_x + FRAME_COLUMN_WIDTH (it->f) < it->last_visible_x) it->end_of_box_run_p = false; @@ -20376,7 +20378,7 @@ extend_face_to_end_of_line (struct it *it) && !face->stipple #endif && !it->glyph_row->reversed_p - && NILP (Vdisplay_fill_column_indicator)) + && !Vdisplay_fill_column_indicator) return; /* Set the glyph row flag indicating that the face of the last glyph @@ -20431,17 +20433,16 @@ extend_face_to_end_of_line (struct it *it) /* Display fill column indicator if not in modeline or toolbar and display fill column indicator mode is - active */ + active. */ if ((it->w->pseudo_window_p == 0) && FILL_COLUMN_INDICATOR_NEEDED(it)) { int fill_column_indicator_column = -1; - if (EQ (Vdisplay_fill_column_indicator_column, Qt) - && FIXNATP (BVAR (current_buffer, fill_column))) + if (EQ (Vdisplay_fill_column_indicator_column, Qt)) fill_column_indicator_column = XFIXNAT (BVAR (current_buffer, fill_column)); - else if (FIXNATP (Vdisplay_fill_column_indicator_column)) + else fill_column_indicator_column = XFIXNAT (Vdisplay_fill_column_indicator_column); @@ -20466,7 +20467,7 @@ extend_face_to_end_of_line (struct it *it) Lisp_Object save_object = it->object; /* The stretch width needs to considet the latter - added glyph */ + added glyph. */ const int stretch_width = column_x - it->current_x - char_width; @@ -20474,34 +20475,35 @@ extend_face_to_end_of_line (struct it *it) it->avoid_cursor_p = true; it->object = Qnil; - /* Only generate a stretch glysph if there is distance - between current_x and and the indicator position */ + /* Only generate a stretch glyph if there is distance + between current_x and and the indicator position. */ if (stretch_width > 0) { - int stretch_ascent = (((it->ascent + it->descent) + int stretch_ascent = (((it->ascent + it->descent) * FONT_BASE (font)) / FONT_HEIGHT (font)); append_stretch_glyph (it, Qnil, stretch_width, it->ascent + it->descent, stretch_ascent); } - /* Generate the glysph indicator only if - append_space_for_newline didn't already. */ + /* Generate the glyph indicator only if + append_space_for_newline didn't already. */ if (it->current_x < column_x) { it->char_to_display = XFIXNAT (Vdisplay_fill_column_indicator_character); it->face_id = - merge_faces (it->w, Qfill_column_face, + merge_faces (it->w, Qfill_column_indicator, 0, DEFAULT_FACE_ID); PRODUCE_GLYPHS (it); } - /* Restore the face after the indicator was generated */ + /* Restore the face after the indicator was generated. */ it->face_id = saved_face_id; /* If there is space after the indicator generate an - extra empty glysph to restore the face. */ + extra empty glyph to restore the face. Issue was + observed in X systems. */ it->char_to_display = ' '; PRODUCE_GLYPHS (it); @@ -20514,14 +20516,13 @@ extend_face_to_end_of_line (struct it *it) } } #ifdef HAVE_WINDOW_SYSTEM - if (it->glyph_row->reversed_p) { /* Prepend a stretch glyph to the row, such that the rightmost glyph will be drawn flushed all the way to the right margin of the window. The stretch glyph that will occupy the empty space, if any, to the left of the - glyphs. */ + glyph. */ struct font *font = face->font ? face->font : FRAME_FONT (f); struct glyph *row_start = it->glyph_row->glyphs[TEXT_AREA]; struct glyph *row_end = row_start + it->glyph_row->used[TEXT_AREA]; @@ -20635,18 +20636,19 @@ extend_face_to_end_of_line (struct it *it) else it->face_id = face->id; - /* Display fill-column-line if needed. */ + /* Display fill-column indicator if needed. */ if (FILL_COLUMN_INDICATOR_NEEDED(it)) { int fill_column_indicator_column = -1; /* Vdisplay_fill_column_indicator_column accepts the special - value t to use the default fill-column variable. */ - if (EQ (Vdisplay_fill_column_indicator_column, Qt) - && FIXNATP (BVAR (current_buffer, fill_column))) + value t to use the default fill-column variable. The + conditions are all defined in the macro + FILL_COLUMN_INDICATOR_NEEDED. */ + if (EQ (Vdisplay_fill_column_indicator_column, Qt)) fill_column_indicator_column = XFIXNAT (BVAR (current_buffer, fill_column)) + it->lnum_pixel_width; - else if (FIXNATP (Vdisplay_fill_column_indicator_column)) + else fill_column_indicator_column = XFIXNAT (Vdisplay_fill_column_indicator_column) + it->lnum_pixel_width; @@ -20656,7 +20658,7 @@ extend_face_to_end_of_line (struct it *it) { const int saved_face = it->face_id; it->face_id = - merge_faces (it->w, Qfill_column_face, 0, DEFAULT_FACE_ID); + merge_faces (it->w, Qfill_column_indicator, 0, DEFAULT_FACE_ID); it->c = it->char_to_display = XFIXNAT (Vdisplay_fill_column_indicator_character); PRODUCE_GLYPHS (it); @@ -32839,8 +32841,8 @@ be let-bound around code that needs to disable messages temporarily. */); /* Name of a text property which disables line-number display. */ DEFSYM (Qdisplay_line_numbers_disable, "display-line-numbers-disable"); - /* Names of the face used to display fill column indicator character. */ - DEFSYM (Qfill_column_face, "fill-column-face"); + /* Name of the face used to display fill column indicator character. */ + DEFSYM (Qfill_column_indicator, "fill-column-indicator"); /* Name and number of the face used to highlight escape glyphs. */ DEFSYM (Qescape_glyph, "escape-glyph"); @@ -33414,25 +33416,26 @@ either `relative' or `visual'. */); DEFSYM (Qdisplay_line_numbers_widen, "display-line-numbers-widen"); Fmake_variable_buffer_local (Qdisplay_line_numbers_widen); - DEFVAR_LISP ("display-fill-column-indicator", Vdisplay_fill_column_indicator, + DEFVAR_BOOL ("display-fill-column-indicator", Vdisplay_fill_column_indicator, doc: /* Non-nil means display the fill column indicator. */); - Vdisplay_fill_column_indicator = Qnil; + Vdisplay_fill_column_indicator = false; DEFSYM (Qdisplay_fill_column_indicator, "display-fill-column-indicator"); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator); DEFVAR_LISP ("display-fill-column-indicator-column", Vdisplay_fill_column_indicator_column, - doc: /* Column for indicator when `display-fill-column-indicator' is non-nil. -The default value is t which means that the indicator will use the `fill-column' variable. -If a numeric value is set, the indicator will be drawn in that column -independently of the `fill-column' value. */); + doc: /* Column for indicator when `display-fill-column-indicator' +is non-nil. The default value is t which means that the indicator +will use the `fill-column' variable. If it is set to an integer the +indicator will be drawn in that column. */); Vdisplay_fill_column_indicator_column = Qt; DEFSYM (Qdisplay_fill_column_indicator_column, "display-fill-column-indicator-column"); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_column); DEFVAR_LISP ("display-fill-column-indicator-character", Vdisplay_fill_column_indicator_character, - doc: /* Character to draw the indicator when `display-fill-column-indicator' is non-nil. -The default is U+2502 but a good alternative is (ascii 124) if -the font in fill-column-face does not support Unicode characters. */); + doc: /* Character to draw the indicator when +`display-fill-column-indicator' is non-nil. The default is U+2502 but +a good alternative is (ascii 124) if the font in fill-column-indicator +face does not support Unicode characters. */); Vdisplay_fill_column_indicator_character = Qnil; DEFSYM (Qdisplay_fill_column_indicator_character, "display-fill-column-indicator-character"); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_character); commit 5b842bd7820b952d65c480b856354a67d26f5b57 Author: Jimmy Aguilar Mena Date: Mon Apr 8 18:11:16 2019 +0200 *src/xdisp.c: Fixed fill column indicator position in terminal mode. diff --git a/src/xdisp.c b/src/xdisp.c index 31bb83c418..080c40c3f3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20645,10 +20645,10 @@ extend_face_to_end_of_line (struct it *it) if (EQ (Vdisplay_fill_column_indicator_column, Qt) && FIXNATP (BVAR (current_buffer, fill_column))) fill_column_indicator_column = - XFIXNAT (BVAR (current_buffer, fill_column)); + XFIXNAT (BVAR (current_buffer, fill_column)) + it->lnum_pixel_width; else if (FIXNATP (Vdisplay_fill_column_indicator_column)) fill_column_indicator_column = - XFIXNAT (Vdisplay_fill_column_indicator_column); + XFIXNAT (Vdisplay_fill_column_indicator_column) + it->lnum_pixel_width; do { commit 491e145f96aa0278d0a4cf0dc4c1e75550f67d25 Author: Jimmy Aguilar Mena Date: Fri Apr 5 12:37:59 2019 +0200 display-fill-column-indicator interface corrections *lisp/display-fill-column-indicator.el: Fixed character selection for the indicator based in the current faces. Extended condition to set display-fill-column-indicator-character in graphical displays. *src/xdisp.c: Fixed some long lines. diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 3f58eac63b..b935776a2d 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -649,6 +649,11 @@ since it could result in memory overflow and make Emacs crash." :value nil)) "26.1") + (display-fill-column-indicator display-fill-column-indicator + (choice + (const :tag "Off (nil)" :value nil) + (const :tag "On (t)" :value t)) + "27.1") (display-fill-column-indicator-column display-fill-column-indicator integer "27.1") (display-fill-column-indicator-character display-fill-column-indicator diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el index 7c1df531df..f6b7352c21 100644 --- a/lisp/display-fill-column-indicator.el +++ b/lisp/display-fill-column-indicator.el @@ -24,10 +24,9 @@ ;; Provides a minor mode interface for `display-fill-column-indicator'. ;; -;; Toggle display of line numbers with M-x -;; display-fill-column-indicator-mode. To enable line numbering in -;; all buffers, use M-x global-display-fill-column-indicator-mode. To -;; change the default line column +;; Toggle display of the column indicator with M-x +;; display-fill-column-indicator-mode. To enable the indicator in +;; all buffers, use M-x global-display-fill-column-indicator-mode. ;; NOTE: Customization variables for @@ -38,7 +37,7 @@ ;;; Code: (defgroup display-fill-column-indicator nil - "Display line numbers in the buffer." + "Display a fill column indicator in th buffer." :group 'convenience :group 'display) @@ -48,15 +47,18 @@ "Toggle display fill column indicator. This uses `display-fill-column-indicator' internally. -To change the position of the line displayed by default, +To change the position of the column displayed by default, customize `display-fill-column-indicator-column' you can change the -character for the line setting `display-fill-column-indicator-character'." +character for the indicator setting `display-fill-column-indicator-character'." :lighter nil (if display-fill-column-indicator-mode (progn (setq display-fill-column-indicator t) (unless display-fill-column-indicator-character - (if (char-displayable-p ?\u2502) + (if (and (char-displayable-p ?\u2502) + (or (not (display-graphic-p)) + (eq (aref (query-font (car (internal-char-font nil ?\u2502))) 0) + (face-font 'default)))) (setq display-fill-column-indicator-character ?\u2502) (setq display-fill-column-indicator-character ?|)))) (setq display-fill-column-indicator nil))) diff --git a/src/xdisp.c b/src/xdisp.c index 25ef98b49c..31bb83c418 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20183,19 +20183,23 @@ append_space_for_newline (struct it *it, bool default_face_p) XFIXNAT (Vdisplay_fill_column_indicator_column); struct font *font = - default_face->font ? default_face->font : FRAME_FONT (it->f); + default_face->font ? + default_face->font : FRAME_FONT (it->f); const int char_width = - font->average_width ? font->average_width : font->space_width; + font->average_width ? + font->average_width : font->space_width; const int column_x = - char_width * fill_column_indicator_column + it->lnum_pixel_width; + char_width * fill_column_indicator_column + + it->lnum_pixel_width; if (it->current_x == column_x) { it->c = it->char_to_display = XFIXNAT (Vdisplay_fill_column_indicator_character); it->face_id = - merge_faces (it->w, Qfill_column_face, 0, DEFAULT_FACE_ID); + merge_faces (it->w, Qfill_column_face, + 0, DEFAULT_FACE_ID); face = FACE_FROM_ID(it->f, it->face_id); goto produce_glyphs; } @@ -20444,10 +20448,12 @@ extend_face_to_end_of_line (struct it *it) struct font *font = default_face->font ? default_face->font : FRAME_FONT (f); const int char_width = - font->average_width ? font->average_width : font->space_width; + font->average_width ? + font->average_width : font->space_width; - const int column_x = char_width * fill_column_indicator_column + - it->lnum_pixel_width; + const int column_x = + char_width * fill_column_indicator_column + + it->lnum_pixel_width; if ((it->current_x <= column_x) && (column_x <= it->last_visible_x)) @@ -20459,39 +20465,43 @@ extend_face_to_end_of_line (struct it *it) const bool saved_box_start = it->start_of_box_run_p; Lisp_Object save_object = it->object; - /* The stretch width needs to considet the latter added glyph */ - const int stretch_width = column_x - it->current_x - char_width; + /* The stretch width needs to considet the latter + added glyph */ + const int stretch_width = + column_x - it->current_x - char_width; memset (&it->position, 0, sizeof it->position); it->avoid_cursor_p = true; it->object = Qnil; - /* Only generate a stretch glysph if there is distance between - current_x and and the indicator position */ + /* Only generate a stretch glysph if there is distance + between current_x and and the indicator position */ if (stretch_width > 0) - { - int stretch_ascent = (((it->ascent + it->descent) - * FONT_BASE (font)) / FONT_HEIGHT (font)); - append_stretch_glyph (it, Qnil, stretch_width, - it->ascent + it->descent, stretch_ascent); - } - - /* Generate the glysph indicator only if append_space_for_newline - didn't already. */ + { + int stretch_ascent = (((it->ascent + it->descent) + * FONT_BASE (font)) / FONT_HEIGHT (font)); + append_stretch_glyph (it, Qnil, stretch_width, + it->ascent + it->descent, + stretch_ascent); + } + + /* Generate the glysph indicator only if + append_space_for_newline didn't already. */ if (it->current_x < column_x) { - it->char_to_display = + it->char_to_display = XFIXNAT (Vdisplay_fill_column_indicator_character); it->face_id = - merge_faces (it->w, Qfill_column_face, 0, DEFAULT_FACE_ID); + merge_faces (it->w, Qfill_column_face, + 0, DEFAULT_FACE_ID); PRODUCE_GLYPHS (it); } /* Restore the face after the indicator was generated */ it->face_id = saved_face_id; - /* If there is space after the indicator generate an extra - empty glysph to restore the face. */ + /* If there is space after the indicator generate an + extra empty glysph to restore the face. */ it->char_to_display = ' '; PRODUCE_GLYPHS (it); @@ -20630,8 +20640,8 @@ extend_face_to_end_of_line (struct it *it) { int fill_column_indicator_column = -1; - /* Vdisplay_fill_column_indicator_column accepts the special value t - to use the default fill-column variable. */ + /* Vdisplay_fill_column_indicator_column accepts the special + value t to use the default fill-column variable. */ if (EQ (Vdisplay_fill_column_indicator_column, Qt) && FIXNATP (BVAR (current_buffer, fill_column))) fill_column_indicator_column = commit 18ea7605c06791641a465cd209a3de760d560863 Author: Jimmy Aguilar Mena Date: Wed Apr 3 12:36:46 2019 +0200 ;Small changes in the documentation *src/xdisp.c: Fixed docstring for display-fill-column-indicator-column *etc/NEWS: Concordance fix in the display-fill-column-indicator part. *doc/emacs/display.texi: Name mismatch fix. diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 38413a7543..e1467a3e0b 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1141,7 +1141,7 @@ right-to-left paragraphs. @node Displaying Boundaries @section Displaying Boundaries -@cindex mode, fill-column-indicator +@cindex mode, display-fill-column-indicator @findex display-fill-column-indicator-mode @findex global-display-fill-column-indicator-mode Emacs can add an indicator to display a fill column position. The diff --git a/etc/NEWS b/etc/NEWS index 444c059f05..80d7f4f24c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -350,7 +350,7 @@ Customize the buffer-local variables 'display-fill-column-indicator' and 'display-fill-column-indicator-character' to activate the indicator. -The indicators is not displayed at all in minibuffer windows and +The indicator is not displayed at all in minibuffer windows and in tooltips, as it is not useful there. There are 2 new buffer local variables and 1 face to customize this diff --git a/src/xdisp.c b/src/xdisp.c index 721e8ae125..25ef98b49c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -33411,10 +33411,9 @@ either `relative' or `visual'. */); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator); DEFVAR_LISP ("display-fill-column-indicator-column", Vdisplay_fill_column_indicator_column, - doc: /* Column to draw the fill column indicator when -`display-fill-column-indicator' is non-nil. The default value is t -which means that the indicator will use the `fill-column' variable. If -a numeric value is set, the indicator will be drawn in that column + doc: /* Column for indicator when `display-fill-column-indicator' is non-nil. +The default value is t which means that the indicator will use the `fill-column' variable. +If a numeric value is set, the indicator will be drawn in that column independently of the `fill-column' value. */); Vdisplay_fill_column_indicator_column = Qt; DEFSYM (Qdisplay_fill_column_indicator_column, "display-fill-column-indicator-column"); commit d8089ad2c2b2fdb1b4cb972646ab85bb7d1ea504 Author: Jimmy Aguilar Mena Date: Wed Apr 3 12:05:01 2019 +0200 Added correction in the texinfo manual. *doc/emacs/text.texi: Added a reference to the display-fill-column-indicator section. diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 62a4b62cfc..38413a7543 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1144,46 +1144,48 @@ right-to-left paragraphs. @cindex mode, fill-column-indicator @findex display-fill-column-indicator-mode @findex global-display-fill-column-indicator-mode - Emacs can add an indicator to display a fill column position. The + Emacs can add an indicator to display a fill column position. The fill column indicator is a useful functionality specially in prog-mode to indicate the position of an specific column. - You can set the buffer-local variables @code{display-fill-column-indicator} + You can set the buffer-local variables @code{display-fill-column-indicator} and @code{display-fill-column-indicator-character} to activate the indicator and controls how the indicator looks. -Alternatively you can type @kbd{M-x display-fill-column-indicator-mode} or -@kbd{M-x global-display-fill-column-indicator-mode} which enables the indicator -locally and globally respectively and also chooses the character to -use if none is set. It is possible to use the first one to activate the -indicator in a hook or the second one to enable it globally. +Alternatively you can type @w{@kbd{M-x display-fill-column-indicator-mode}} +or @w{@kbd{M-x global-display-fill-column-indicator-mode}} which enables the +indicator locally and globally respectively and also chooses the +character to use if none is set already. It is possible to use the +first one to activate the indicator in a hook or the second one to +enable it globally. -There are 2 new buffer local variables and 1 face to customize this -mode: +There are 2 buffer local variables and 1 face to customize this mode: @table @code @item display-fill-column-indicator-column @vindex display-fill-column-indicator-column -Is the column number where the indicator should be set. It can take -positive numerical values for the column or the special value t which -means that the variable 'fill-column' will be used. +Specifies the column number where the indicator should be set. It can +take positive numerical values for the column or the special value +@code{t} which means that the variable @code{fill-column} will be +used. -Any other value disables the indicator. The default value is t. +Any other value disables the indicator. The default value is @code{t}. @item display-fill-column-indicator-char @vindex display-fill-column-indicator-char -Is the character used for the indicator. This character can be any -valid char including unicode ones if the actual font supports them. - -When the mode is enabled throw the functions +Specifies the character used for the indicator. This character can be +any valid char including unicode ones if the actual font supports +them. + +When the mode is enabled through the functions @code{display-fill-column-indicator-mode} or @code{global-display-fill-column-indicator-mode}, the initialization -functions check if this variable is non-nil, otherwise the +functions check if this variable is @code{non-nil}, otherwise the initialization tries to set it to U+2502 or '|'. - -@item fill-column-face -Is the face used to display the indicator it inherits its default -values from shadow and the default face. + +@item fill-column-face +Specifies the face used to display the indicator it inherits its +default values from shadow and the default face. @end table @vindex indicate-buffer-boundaries diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 96492783b9..df2f6c0006 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi @@ -644,6 +644,10 @@ or before @samp{)}, @samp{:} or @samp{?}); and @code{fill-polish-nobreak-p} (don't break after a one letter word, even if preceded by a non-whitespace character). + Emacs can display an indicator in the @code{fill-column} position +using the Display fill column indicator mode +(@xref{Displaying Boundaries, display-fill-column-indicator}). + @node Fill Prefix @subsection The Fill Prefix commit c7ff15c6eb8412020ff527d847abdd4004dba0c4 Author: Jimmy Aguilar Mena Date: Tue Apr 2 22:52:41 2019 +0200 Added fill-column-indicator manual documentation *etc/NEWS: reduced the comments about fill-column-indicator *doc/emacs/display.texi: Added documentation for fill-column-indicator in this section in the manual diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index f464a3a59f..62a4b62cfc 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1141,6 +1141,51 @@ right-to-left paragraphs. @node Displaying Boundaries @section Displaying Boundaries +@cindex mode, fill-column-indicator +@findex display-fill-column-indicator-mode +@findex global-display-fill-column-indicator-mode + Emacs can add an indicator to display a fill column position. The +fill column indicator is a useful functionality specially in +prog-mode to indicate the position of an specific column. + + You can set the buffer-local variables @code{display-fill-column-indicator} +and @code{display-fill-column-indicator-character} to activate the +indicator and controls how the indicator looks. + +Alternatively you can type @kbd{M-x display-fill-column-indicator-mode} or +@kbd{M-x global-display-fill-column-indicator-mode} which enables the indicator +locally and globally respectively and also chooses the character to +use if none is set. It is possible to use the first one to activate the +indicator in a hook or the second one to enable it globally. + +There are 2 new buffer local variables and 1 face to customize this +mode: + +@table @code +@item display-fill-column-indicator-column +@vindex display-fill-column-indicator-column +Is the column number where the indicator should be set. It can take +positive numerical values for the column or the special value t which +means that the variable 'fill-column' will be used. + +Any other value disables the indicator. The default value is t. + +@item display-fill-column-indicator-char +@vindex display-fill-column-indicator-char +Is the character used for the indicator. This character can be any +valid char including unicode ones if the actual font supports them. + +When the mode is enabled throw the functions +@code{display-fill-column-indicator-mode} or +@code{global-display-fill-column-indicator-mode}, the initialization +functions check if this variable is non-nil, otherwise the +initialization tries to set it to U+2502 or '|'. + +@item fill-column-face +Is the face used to display the indicator it inherits its default +values from shadow and the default face. +@end table + @vindex indicate-buffer-boundaries On graphical displays, Emacs can indicate the buffer boundaries in the fringes. If you enable this feature, the first line and the last diff --git a/etc/NEWS b/etc/NEWS index e2eed9b419..444c059f05 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -343,21 +343,13 @@ Emacs configured with Cairo drawing and linked with cairo >= 1.16.0. --- ** Emacs now optionally displays a fill column indicator. -The fill column indicator is a usefull functionality specially in -prog-mode to indicate the position of a specific column. This is -similar to what 'fill-column-indicator' package provides, but much -faster and compatible with show-trailing-whitespace. +This is similar to what 'fill-column-indicator' package provides, but +much faster and compatible with show-trailing-whitespace. Customize the buffer-local variables 'display-fill-column-indicator' and 'display-fill-column-indicator-character' to activate the indicator. -Alternatively you can use the modes -'display-fill-column-indicator-mode' or the global -'global-display-fill-column-indicator-mode' which enables it locally -and globally respectively and also chooses the character to use if no -one is set. - The indicators is not displayed at all in minibuffer windows and in tooltips, as it is not useful there. commit c34f00b58cfb23dbd19b349cb2f24056ff8149ad Author: Jimmy Aguilar Mena Date: Tue Apr 2 16:17:41 2019 +0200 Fixed fill-column-indicator for continuation lines *src/xdisp.c: Grouped the test conditions for display-fill-column-indicator mode in a macro to simplify future modifications. diff --git a/src/xdisp.c b/src/xdisp.c index c6f8133a83..721e8ae125 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -378,6 +378,13 @@ static Lisp_Object list_of_error; && (*BYTE_POS_ADDR (IT_BYTEPOS (*it)) == ' ' \ || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t')))) \ +/* Test all the conditions needed to print the fill column indicator. */ +#define FILL_COLUMN_INDICATOR_NEEDED(it) \ + !NILP (Vdisplay_fill_column_indicator) \ + && (it->continuation_lines_width == 0) \ + && (!NILP (Vdisplay_fill_column_indicator_column)) \ + && FIXNATP (Vdisplay_fill_column_indicator_character) + /* True means print newline to stdout before next mini-buffer message. */ bool noninteractive_need_newline; @@ -20162,10 +20169,8 @@ append_space_for_newline (struct it *it, bool default_face_p) /* Corner case for when display-fill-column-indicator-mode is active and the extra character should be added in the same place than the line */ - if (!NILP (Vdisplay_fill_column_indicator) - && (it->w->pseudo_window_p == 0) - && (!NILP (Vdisplay_fill_column_indicator_column)) - && FIXNATP (Vdisplay_fill_column_indicator_character)) + if ((it->w->pseudo_window_p == 0) + && FILL_COLUMN_INDICATOR_NEEDED(it)) { int fill_column_indicator_column = -1; @@ -20423,10 +20428,8 @@ extend_face_to_end_of_line (struct it *it) /* Display fill column indicator if not in modeline or toolbar and display fill column indicator mode is active */ - if (!NILP (Vdisplay_fill_column_indicator) - && (it->w->pseudo_window_p == 0) - && (!NILP (Vdisplay_fill_column_indicator_column)) - && FIXNATP (Vdisplay_fill_column_indicator_character)) + if ((it->w->pseudo_window_p == 0) + && FILL_COLUMN_INDICATOR_NEEDED(it)) { int fill_column_indicator_column = -1; @@ -20622,13 +20625,13 @@ extend_face_to_end_of_line (struct it *it) else it->face_id = face->id; - /* Display fill-column-line if mode is active */ - if (!NILP (Vdisplay_fill_column_indicator) - && (!NILP (Vdisplay_fill_column_indicator_column)) - && FIXNATP (Vdisplay_fill_column_indicator_character)) + /* Display fill-column-line if needed. */ + if (FILL_COLUMN_INDICATOR_NEEDED(it)) { int fill_column_indicator_column = -1; + /* Vdisplay_fill_column_indicator_column accepts the special value t + to use the default fill-column variable. */ if (EQ (Vdisplay_fill_column_indicator_column, Qt) && FIXNATP (BVAR (current_buffer, fill_column))) fill_column_indicator_column = commit ab4619e7c37b3b9caa2aa24405585dc05292d961 Author: Jimmy Aguilar Mena Date: Tue Mar 19 00:03:12 2019 +0100 Display-fill-column-indicator NEWS info. *etc/NEWS: Added information about the fill-column-indicator mode. *lisp/faces.el: Added a face for the display fill column indicator. diff --git a/etc/NEWS b/etc/NEWS index 9e3559d27e..e2eed9b419 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -340,6 +340,51 @@ longer. ** Multicolor fonts such as "Noto Color Emoji" can be displayed on Emacs configured with Cairo drawing and linked with cairo >= 1.16.0. +--- +** Emacs now optionally displays a fill column indicator. + +The fill column indicator is a usefull functionality specially in +prog-mode to indicate the position of a specific column. This is +similar to what 'fill-column-indicator' package provides, but much +faster and compatible with show-trailing-whitespace. + +Customize the buffer-local variables 'display-fill-column-indicator' +and 'display-fill-column-indicator-character' to activate the +indicator. + +Alternatively you can use the modes +'display-fill-column-indicator-mode' or the global +'global-display-fill-column-indicator-mode' which enables it locally +and globally respectively and also chooses the character to use if no +one is set. + +The indicators is not displayed at all in minibuffer windows and +in tooltips, as it is not useful there. + +There are 2 new buffer local variables and 1 face to customize this +mode: + +*** 'display-fill-column-indicator-column' is the column where the + indicator should be set. It can take positive numerical values for + the column or the special value t. Any other value disables the + indicator. The default value is t. + + When the value is t it means that the variable 'fill-column' will + be used. + +*** 'display-fill-column-indicator-char' is the character used for the + indicator. This character can be any valid char including unicode + ones if the user's font supports them. + + When the mode is enabled throw the functions + 'display-fill-column-indicator-mode' and + 'global-display-fill-column-indicator-mode', they check if there + is a value non-nil for this variable, otherwise the initialization + tries to set it to U+2502 or '|'. + +*** 'fill-column-face' is the face used to display the indicator it + inherits it default values from shadow and the default faces. + * Editing Changes in Emacs 27.1 diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el index 6e0990839e..7c1df531df 100644 --- a/lisp/display-fill-column-indicator.el +++ b/lisp/display-fill-column-indicator.el @@ -55,8 +55,6 @@ character for the line setting `display-fill-column-indicator-character'." (if display-fill-column-indicator-mode (progn (setq display-fill-column-indicator t) - (unless display-fill-column-indicator-column - (setq display-fill-column-indicator-column fill-column)) (unless display-fill-column-indicator-character (if (char-displayable-p ?\u2502) (setq display-fill-column-indicator-character ?\u2502) diff --git a/lisp/faces.el b/lisp/faces.el index 67d963e349..121cf7ef1d 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2502,7 +2502,7 @@ unwanted effects." ;; Definition stolen from display-line-numbers. (defface fill-column-face - '((t :inherit (shadow default) :height 1.0)) + '((t :inherit (shadow default))) "Face for displaying fill column indicator line. This face is used when `display-fill-column-indicator-mode' is non-nil. diff --git a/src/xdisp.c b/src/xdisp.c index f160966427..c6f8133a83 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20164,17 +20164,26 @@ append_space_for_newline (struct it *it, bool default_face_p) same place than the line */ if (!NILP (Vdisplay_fill_column_indicator) && (it->w->pseudo_window_p == 0) - && FIXNATP (Vdisplay_fill_column_indicator_column) + && (!NILP (Vdisplay_fill_column_indicator_column)) && FIXNATP (Vdisplay_fill_column_indicator_character)) { + int fill_column_indicator_column = -1; + + if (EQ (Vdisplay_fill_column_indicator_column, Qt) + && FIXNATP (BVAR (current_buffer, fill_column))) + fill_column_indicator_column = + XFIXNAT (BVAR (current_buffer, fill_column)); + else if (FIXNATP (Vdisplay_fill_column_indicator_column)) + fill_column_indicator_column = + XFIXNAT (Vdisplay_fill_column_indicator_column); + struct font *font = default_face->font ? default_face->font : FRAME_FONT (it->f); const int char_width = font->average_width ? font->average_width : font->space_width; - const int fill_column = - XFIXNAT (Vdisplay_fill_column_indicator_column); + const int column_x = - char_width * fill_column + it->lnum_pixel_width; + char_width * fill_column_indicator_column + it->lnum_pixel_width; if (it->current_x == column_x) { @@ -20416,18 +20425,26 @@ extend_face_to_end_of_line (struct it *it) active */ if (!NILP (Vdisplay_fill_column_indicator) && (it->w->pseudo_window_p == 0) - && FIXNATP (Vdisplay_fill_column_indicator_column) + && (!NILP (Vdisplay_fill_column_indicator_column)) && FIXNATP (Vdisplay_fill_column_indicator_character)) { + int fill_column_indicator_column = -1; + + if (EQ (Vdisplay_fill_column_indicator_column, Qt) + && FIXNATP (BVAR (current_buffer, fill_column))) + fill_column_indicator_column = + XFIXNAT (BVAR (current_buffer, fill_column)); + else if (FIXNATP (Vdisplay_fill_column_indicator_column)) + fill_column_indicator_column = + XFIXNAT (Vdisplay_fill_column_indicator_column); + struct font *font = default_face->font ? default_face->font : FRAME_FONT (f); const int char_width = font->average_width ? font->average_width : font->space_width; - const int fill_column = - XFIXNAT (Vdisplay_fill_column_indicator_column); - - const int column_x = char_width * fill_column + it->lnum_pixel_width; + const int column_x = char_width * fill_column_indicator_column + + it->lnum_pixel_width; if ((it->current_x <= column_x) && (column_x <= it->last_visible_x)) @@ -20606,14 +20623,23 @@ extend_face_to_end_of_line (struct it *it) it->face_id = face->id; /* Display fill-column-line if mode is active */ - if (!NILP (Vdisplay_fill_column_indicator)) + if (!NILP (Vdisplay_fill_column_indicator) + && (!NILP (Vdisplay_fill_column_indicator_column)) + && FIXNATP (Vdisplay_fill_column_indicator_character)) { - const int fill_column_indicator_line = - XFIXNAT (Vdisplay_fill_column_indicator_column) - + it->lnum_pixel_width; + int fill_column_indicator_column = -1; + + if (EQ (Vdisplay_fill_column_indicator_column, Qt) + && FIXNATP (BVAR (current_buffer, fill_column))) + fill_column_indicator_column = + XFIXNAT (BVAR (current_buffer, fill_column)); + else if (FIXNATP (Vdisplay_fill_column_indicator_column)) + fill_column_indicator_column = + XFIXNAT (Vdisplay_fill_column_indicator_column); + do { - if (it->current_x == fill_column_indicator_line) + if (it->current_x == fill_column_indicator_column) { const int saved_face = it->face_id; it->face_id = @@ -33382,9 +33408,12 @@ either `relative' or `visual'. */); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator); DEFVAR_LISP ("display-fill-column-indicator-column", Vdisplay_fill_column_indicator_column, - doc: /* Column to draw the indicator when `display-fill-column-indicator' is non-nil. -The default value is the variable `fill-column' if not other value is given. */); - Vdisplay_fill_column_indicator_column = Qnil; + doc: /* Column to draw the fill column indicator when +`display-fill-column-indicator' is non-nil. The default value is t +which means that the indicator will use the `fill-column' variable. If +a numeric value is set, the indicator will be drawn in that column +independently of the `fill-column' value. */); + Vdisplay_fill_column_indicator_column = Qt; DEFSYM (Qdisplay_fill_column_indicator_column, "display-fill-column-indicator-column"); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_column); commit 245dff16e3e62c3b7458170a2436a5fa3e2945fd Author: Jimmy Aguilar Mena Date: Tue Mar 12 20:06:28 2019 +0100 Start display-fill-column-indicator-mode. diff --git a/lisp/cus-start.el b/lisp/cus-start.el index baa05d0a89..3f58eac63b 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -648,6 +648,11 @@ since it could result in memory overflow and make Emacs crash." (const :tag "Count lines from beginning of narrowed region" :value nil)) "26.1") + + (display-fill-column-indicator-column display-fill-column-indicator + integer "27.1") + (display-fill-column-indicator-character display-fill-column-indicator + character "27.1") ;; xfaces.c (scalable-fonts-allowed display boolean "22.1") ;; xfns.c diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el new file mode 100644 index 0000000000..6e0990839e --- /dev/null +++ b/lisp/display-fill-column-indicator.el @@ -0,0 +1,78 @@ +;;; display-fill-column-indicator.el --- interface for display-fill-column-indicator -*- lexical-binding: t -*- + +;; Copyright (C) 2017-2019 Free Software Foundation, Inc. + +;; Maintainer: emacs-devel@gnu.org +;; Keywords: convenience + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Provides a minor mode interface for `display-fill-column-indicator'. +;; +;; Toggle display of line numbers with M-x +;; display-fill-column-indicator-mode. To enable line numbering in +;; all buffers, use M-x global-display-fill-column-indicator-mode. To +;; change the default line column + + +;; NOTE: Customization variables for +;; `display-fill-column-indicator-column' and +;; `display-fill-column-indicator-char' itself are defined in +;; cus-start.el. + +;;; Code: + +(defgroup display-fill-column-indicator nil + "Display line numbers in the buffer." + :group 'convenience + :group 'display) + + +;;;###autoload +(define-minor-mode display-fill-column-indicator-mode + "Toggle display fill column indicator. +This uses `display-fill-column-indicator' internally. + +To change the position of the line displayed by default, +customize `display-fill-column-indicator-column' you can change the +character for the line setting `display-fill-column-indicator-character'." + :lighter nil + (if display-fill-column-indicator-mode + (progn + (setq display-fill-column-indicator t) + (unless display-fill-column-indicator-column + (setq display-fill-column-indicator-column fill-column)) + (unless display-fill-column-indicator-character + (if (char-displayable-p ?\u2502) + (setq display-fill-column-indicator-character ?\u2502) + (setq display-fill-column-indicator-character ?|)))) + (setq display-fill-column-indicator nil))) + +(defun display-fill-column-indicator--turn-on () + "Turn on `display-fill-column-indicator-mode'." + (unless (or (minibufferp) + (and (daemonp) (null (frame-parameter nil 'client)))) + (display-fill-column-indicator-mode))) + +;;;###autoload +(define-globalized-minor-mode global-display-fill-column-indicator-mode + display-fill-column-indicator-mode display-fill-column-indicator--turn-on) + +(provide 'display-fill-column-indicator) + +;;; display-fill-column-indicator.el ends here diff --git a/lisp/faces.el b/lisp/faces.el index fa526c3506..67d963e349 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2500,6 +2500,20 @@ unwanted effects." :group 'basic-faces :group 'display-line-numbers) +;; Definition stolen from display-line-numbers. +(defface fill-column-face + '((t :inherit (shadow default) :height 1.0)) + "Face for displaying fill column indicator line. +This face is used when `display-fill-column-indicator-mode' is +non-nil. + +If you customize the font of this face, make sure it is a +monospaced font, otherwise the line's characters will not line +up horizontally." + :version "27.1" + :group 'basic-faces + :group 'display-fill-column-indicator) + (defface escape-glyph '((((background dark)) :foreground "cyan") ;; See the comment in minibuffer-prompt for diff --git a/lisp/frame.el b/lisp/frame.el index 539a0f4dfc..a8c230cb7b 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2682,6 +2682,9 @@ See also `toggle-frame-maximized'." display-line-numbers-width display-line-numbers-current-absolute display-line-numbers-widen + display-fill-column-indicator + display-fill-column-indicator-column + display-fill-column-indicator-character bidi-paragraph-direction bidi-display-reordering)) diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index cb378ceaed..45c72ffbd4 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -7734,7 +7734,44 @@ See `display-line-numbers-mode' for more information on Display-Line-Numbers mod \(fn &optional ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "display-line-numbers" '("display-line-numbers-"))) +(if (fboundp 'register-definition-prefixes) + (register-definition-prefixes "display-line-numbers" '("display-line-numbers-"))) + +;;;*** + +;;;### (autoloads nil "display-fill-column-indicator" "display-fill-column-indicator.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from display-fill-column-indicator.el + +(autoload 'display-fill-column-indicator-mode "display-fill-column-indicator" "\ +Toggle display fill column indicator. +This uses `display-fill-column-indicator' internally. + +To change the position of the line displayed by default, +customize `display-fill-column-indicator-column'. + +\(fn &optional ARG)" t nil) + +(defvar global-display-fill-column-indicator-mode nil "\ +Non-nil if Global Display-fill-column-indicator mode is enabled. +See the `global-display-fill-column-indicator-mode' command +for a description of this minor mode.") + +(custom-autoload 'global-display-fill-column-indicator-mode + "display-fill-column-indicator" nil) + +(autoload 'global-display-fill-column-indicator-mode + "display-fill-column-indicator" "\ +Toggle display fill column indicator. +This uses `display-fill-column-indicator' internally. + +To change the position of the line displayed by default, +customize `display-fill-column-indicator-column'. + +\(fn &optional ARG)" t nil) + +(if (fboundp 'register-definition-prefixes) + (register-definition-prefixes "display-fill-column-indicator" '("display-fill-column-indicator-"))) ;;;*** diff --git a/src/xdisp.c b/src/xdisp.c index 3bdb8ea1b0..f160966427 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20152,15 +20152,49 @@ append_space_for_newline (struct it *it, bool default_face_p) it->what = IT_CHARACTER; memset (&it->position, 0, sizeof it->position); it->object = Qnil; - it->c = it->char_to_display = ' '; it->len = 1; + int local_default_face_id = + lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID); + struct face* default_face = + FACE_FROM_ID_OR_NULL (it->f, local_default_face_id); + + /* Corner case for when display-fill-column-indicator-mode + is active and the extra character should be added in the + same place than the line */ + if (!NILP (Vdisplay_fill_column_indicator) + && (it->w->pseudo_window_p == 0) + && FIXNATP (Vdisplay_fill_column_indicator_column) + && FIXNATP (Vdisplay_fill_column_indicator_character)) + { + struct font *font = + default_face->font ? default_face->font : FRAME_FONT (it->f); + const int char_width = + font->average_width ? font->average_width : font->space_width; + const int fill_column = + XFIXNAT (Vdisplay_fill_column_indicator_column); + const int column_x = + char_width * fill_column + it->lnum_pixel_width; + + if (it->current_x == column_x) + { + it->c = it->char_to_display = + XFIXNAT (Vdisplay_fill_column_indicator_character); + it->face_id = + merge_faces (it->w, Qfill_column_face, 0, DEFAULT_FACE_ID); + face = FACE_FROM_ID(it->f, it->face_id); + goto produce_glyphs; + } + } + + it->c = it->char_to_display = ' '; /* If the default face was remapped, be sure to use the remapped face for the appended newline. */ if (default_face_p) - it->face_id = lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID); + it->face_id = local_default_face_id; else if (it->face_before_selective_p) it->face_id = it->saved_face_id; + face = FACE_FROM_ID (it->f, it->face_id); it->face_id = FACE_FOR_CHAR (it->f, face, 0, -1, Qnil); /* In R2L rows, we will prepend a stretch glyph that will @@ -20169,11 +20203,12 @@ append_space_for_newline (struct it *it, bool default_face_p) set. */ if (it->glyph_row->reversed_p /* But if the appended newline glyph goes all the way to - the end of the row, there will be no stretch glyph, - so leave the box flag set. */ + the end of the row, there will be no stretch glyph, + so leave the box flag set. */ && saved_x + FRAME_COLUMN_WIDTH (it->f) < it->last_visible_x) it->end_of_box_run_p = false; + produce_glyphs: PRODUCE_GLYPHS (it); #ifdef HAVE_WINDOW_SYSTEM @@ -20322,7 +20357,8 @@ extend_face_to_end_of_line (struct it *it) #ifdef HAVE_WINDOW_SYSTEM && !face->stipple #endif - && !it->glyph_row->reversed_p) + && !it->glyph_row->reversed_p + && NILP (Vdisplay_fill_column_indicator)) return; /* Set the glyph row flag indicating that the face of the last glyph @@ -20374,8 +20410,81 @@ extend_face_to_end_of_line (struct it *it) default_face->id; it->glyph_row->used[RIGHT_MARGIN_AREA] = 1; } + + /* Display fill column indicator if not in modeline or + toolbar and display fill column indicator mode is + active */ + if (!NILP (Vdisplay_fill_column_indicator) + && (it->w->pseudo_window_p == 0) + && FIXNATP (Vdisplay_fill_column_indicator_column) + && FIXNATP (Vdisplay_fill_column_indicator_character)) + { + struct font *font = + default_face->font ? default_face->font : FRAME_FONT (f); + const int char_width = + font->average_width ? font->average_width : font->space_width; + + const int fill_column = + XFIXNAT (Vdisplay_fill_column_indicator_column); + + const int column_x = char_width * fill_column + it->lnum_pixel_width; + + if ((it->current_x <= column_x) + && (column_x <= it->last_visible_x)) + { + const char saved_char = it->char_to_display; + const struct text_pos saved_pos = it->position; + const bool saved_avoid_cursor = it->avoid_cursor_p; + const int saved_face_id = it->face_id; + const bool saved_box_start = it->start_of_box_run_p; + Lisp_Object save_object = it->object; + + /* The stretch width needs to considet the latter added glyph */ + const int stretch_width = column_x - it->current_x - char_width; + + memset (&it->position, 0, sizeof it->position); + it->avoid_cursor_p = true; + it->object = Qnil; + + /* Only generate a stretch glysph if there is distance between + current_x and and the indicator position */ + if (stretch_width > 0) + { + int stretch_ascent = (((it->ascent + it->descent) + * FONT_BASE (font)) / FONT_HEIGHT (font)); + append_stretch_glyph (it, Qnil, stretch_width, + it->ascent + it->descent, stretch_ascent); + } + + /* Generate the glysph indicator only if append_space_for_newline + didn't already. */ + if (it->current_x < column_x) + { + it->char_to_display = + XFIXNAT (Vdisplay_fill_column_indicator_character); + it->face_id = + merge_faces (it->w, Qfill_column_face, 0, DEFAULT_FACE_ID); + PRODUCE_GLYPHS (it); + } + + /* Restore the face after the indicator was generated */ + it->face_id = saved_face_id; + + /* If there is space after the indicator generate an extra + empty glysph to restore the face. */ + it->char_to_display = ' '; + PRODUCE_GLYPHS (it); + + it->char_to_display = saved_char; + it->position = saved_pos; + it->avoid_cursor_p = saved_avoid_cursor; + it->start_of_box_run_p = saved_box_start; + it->object = save_object; + } + } } #ifdef HAVE_WINDOW_SYSTEM + if (it->glyph_row->reversed_p) { /* Prepend a stretch glyph to the row, such that the @@ -20495,10 +20604,37 @@ extend_face_to_end_of_line (struct it *it) it->face_id = default_face->id; else it->face_id = face->id; - PRODUCE_GLYPHS (it); - while (it->current_x <= it->last_visible_x) - PRODUCE_GLYPHS (it); + /* Display fill-column-line if mode is active */ + if (!NILP (Vdisplay_fill_column_indicator)) + { + const int fill_column_indicator_line = + XFIXNAT (Vdisplay_fill_column_indicator_column) + + it->lnum_pixel_width; + do + { + if (it->current_x == fill_column_indicator_line) + { + const int saved_face = it->face_id; + it->face_id = + merge_faces (it->w, Qfill_column_face, 0, DEFAULT_FACE_ID); + it->c = it->char_to_display = + XFIXNAT (Vdisplay_fill_column_indicator_character); + PRODUCE_GLYPHS (it); + it->face_id = saved_face; + it->c = it->char_to_display = ' '; + } + else + PRODUCE_GLYPHS (it); + } while (it->current_x <= it->last_visible_x); + } + else + { + do + { + PRODUCE_GLYPHS (it); + } while (it->current_x <= it->last_visible_x); + } if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 && (it->glyph_row->used[RIGHT_MARGIN_AREA] @@ -20588,7 +20724,8 @@ highlight_trailing_whitespace (struct it *it) if (!row->reversed_p) { while (glyph >= start - && glyph->type == CHAR_GLYPH + && (glyph->type == CHAR_GLYPH + || glyph->type == STRETCH_GLYPH) && NILP (glyph->object)) --glyph; } @@ -32663,6 +32800,9 @@ be let-bound around code that needs to disable messages temporarily. */); /* Name of a text property which disables line-number display. */ DEFSYM (Qdisplay_line_numbers_disable, "display-line-numbers-disable"); + /* Names of the face used to display fill column indicator character. */ + DEFSYM (Qfill_column_face, "fill-column-face"); + /* Name and number of the face used to highlight escape glyphs. */ DEFSYM (Qescape_glyph, "escape-glyph"); @@ -33235,6 +33375,27 @@ either `relative' or `visual'. */); DEFSYM (Qdisplay_line_numbers_widen, "display-line-numbers-widen"); Fmake_variable_buffer_local (Qdisplay_line_numbers_widen); + DEFVAR_LISP ("display-fill-column-indicator", Vdisplay_fill_column_indicator, + doc: /* Non-nil means display the fill column indicator. */); + Vdisplay_fill_column_indicator = Qnil; + DEFSYM (Qdisplay_fill_column_indicator, "display-fill-column-indicator"); + Fmake_variable_buffer_local (Qdisplay_fill_column_indicator); + + DEFVAR_LISP ("display-fill-column-indicator-column", Vdisplay_fill_column_indicator_column, + doc: /* Column to draw the indicator when `display-fill-column-indicator' is non-nil. +The default value is the variable `fill-column' if not other value is given. */); + Vdisplay_fill_column_indicator_column = Qnil; + DEFSYM (Qdisplay_fill_column_indicator_column, "display-fill-column-indicator-column"); + Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_column); + + DEFVAR_LISP ("display-fill-column-indicator-character", Vdisplay_fill_column_indicator_character, + doc: /* Character to draw the indicator when `display-fill-column-indicator' is non-nil. +The default is U+2502 but a good alternative is (ascii 124) if +the font in fill-column-face does not support Unicode characters. */); + Vdisplay_fill_column_indicator_character = Qnil; + DEFSYM (Qdisplay_fill_column_indicator_character, "display-fill-column-indicator-character"); + Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_character); + DEFVAR_BOOL ("inhibit-eval-during-redisplay", inhibit_eval_during_redisplay, doc: /* Non-nil means don't eval Lisp during redisplay. */); inhibit_eval_during_redisplay = false; commit f8625bc8f7573162b1c6b136f4791d8facecd836 Author: Michael Albinus Date: Sun May 5 16:20:14 2019 +0200 Describe, how to adapt shell command output width in Tramp * doc/misc/tramp.texi (Quick Start Guide, GVFS based methods): Fix @cindex. (Remote processes): Add some @vindex. Describe shell command output width. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index ca86458e90..0c51f15fbb 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -545,7 +545,7 @@ file system), @file{@trampfn{dav,user@@host,/path/to/file}} and @cindex google drive @cindex method @option{nextcloud} @cindex @option{nextcloud} method -@cindex owncloud +@cindex nextcloud GVFS-based methods include also @acronym{GNOME} Online Accounts, which support the @option{Files} service. These are the Google Drive file @@ -1208,7 +1208,7 @@ directory have the same @code{display-name}, such a situation must be avoided. @cindex @acronym{GNOME} Online Accounts @cindex method @option{nextcloud} @cindex @option{nextcloud} method -@cindex owncloud +@cindex nextcloud As the name indicates, the method @option{nextcloud} allows you to access OwnCloud or NextCloud hosted files and directories. Like the @@ -3083,6 +3083,8 @@ host. Example: @kbd{M-x auto-revert-tail-mode @key{RET}} runs similarly showing continuous output. +@vindex shell-file-name +@vindex shell-command-switch @code{shell-command} uses the variables @code{shell-file-name} and @code{shell-command-switch} in order to determine which shell to run. For remote hosts, their default values are @file{/bin/sh} and @@ -3091,6 +3093,15 @@ uses @file{/system/bin/sh}). Like the variables in the previous section, these variables can be changed via connection-local variables. +@vindex shell-command-width +@vindex COLUMNS@r{, environment variable} +If Emacs supports the variable @code{shell-command-width} (since Emacs +27.1), @value{tramp} cares about its value for asynchronous shell +commands. It specifies the number of display columns for command +output. For synchronous shell commands, a similar effect can be +achieved by adding the environment variable @env{COLUMNS} to +@code{tramp-remote-process-environment}. + @subsection Running @code{eshell} on a remote host @cindex @code{eshell} commit d45d5c339cda613b70431ab51af7ee53f21ef4bf Author: Eli Zaretskii Date: Sun May 5 17:17:24 2019 +0300 Avoid compiler warning in print.c * src/print.c (print_vectorlike): Don't use %hh, as that is not portable enough; we don't yet assume a C99-compliant library. diff --git a/src/print.c b/src/print.c index 57aac5f547..08c39d3466 100644 --- a/src/print.c +++ b/src/print.c @@ -1808,7 +1808,7 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, enum { digits = (CHAR_BIT + 4 - 1) / 4 }; char buffer[digits + 1]; int needed - = snprintf (buffer, sizeof buffer, "%0*hhx", digits, b); + = snprintf (buffer, sizeof buffer, "%0*x", digits, b); eassert (needed == digits); print_c_string (buffer, printcharfun); } commit 708d117a85107331c8a06a9a4887abffcc18ec24 Author: Eli Zaretskii Date: Sun May 5 17:06:01 2019 +0300 Avoid crashes in read_integer * src/lread.c (read_integer): Always allocate a buffer, since we need to use it even when the radix is invalid. (Bug#35576) diff --git a/src/lread.c b/src/lread.c index 1c97805ca7..c37719e0d2 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2660,11 +2660,12 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix) Also, room for invalid syntax diagnostic. */ size_t len = max (1 + 1 + UINTMAX_WIDTH + 1, sizeof "integer, radix " + INT_STRLEN_BOUND (EMACS_INT)); - char *buf = NULL; + char *buf = xmalloc (len); char *p = buf; int valid = -1; /* 1 if valid, 0 if not, -1 if incomplete. */ ptrdiff_t count = SPECPDL_INDEX (); + record_unwind_protect_ptr (free_contents, &buf); if (radix < 2 || radix > 36) valid = 0; @@ -2672,8 +2673,6 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix) { int c, digit; - buf = xmalloc (len); - record_unwind_protect_ptr (free_contents, &buf); p = buf; c = READCHAR; commit 64f95e4011242110fb51ae52d3c19a70000de1e6 Author: Stefan Monnier Date: Sun May 5 08:57:04 2019 -0400 * lisp/files.el (hack-local-variables): Don't burp when files-x isn't loaded diff --git a/lisp/files.el b/lisp/files.el index c05d70a00e..518394fdcd 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3590,7 +3590,9 @@ local variables, but directory-local variables may still be applied." result) (unless (eq handle-mode t) (setq file-local-variables-alist nil) - (when (file-remote-p default-directory) + (when (and (file-remote-p default-directory) + (fboundp 'hack-connection-local-variables) + (fboundp 'connection-local-criteria-for-default-directory)) (with-demoted-errors "Connection-local variables error: %s" ;; Note this is a no-op if enable-local-variables is nil. (hack-connection-local-variables commit 10aa44a1ddef86a6a8e3ac01d339fd8a3872818d Author: Michael Albinus Date: Sun May 5 13:34:26 2019 +0200 ; SOme changes in filenotify-tests.el for EMBA * test/lisp/filenotify-tests.el (file-notify-test03-events) (file-notify-test05-file-validity) (file-notify-test09-watched-file-in-watched-dir): Adapt for EMBA. diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index b0273741bc..9dfa794e30 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -684,8 +684,8 @@ delivered." (created deleted stopped))) ;; On emba, `deleted' and `stopped' events of the ;; directory are not detected. -; ((getenv "EMACS_EMBA_CI") -; '(created changed deleted)) + ((getenv "EMACS_EMBA_CI") + '(created changed deleted)) ;; There are two `deleted' events, for the file and for ;; the directory. Except for cygwin, kqueue and remote ;; files. And cygwin does not raise a `changed' event. @@ -741,8 +741,8 @@ delivered." '(created changed created changed deleted stopped)) ;; On emba, `deleted' and `stopped' events of the ;; directory are not detected. -; ((getenv "EMACS_EMBA_CI") -; '(created changed created changed deleted deleted)) + ((getenv "EMACS_EMBA_CI") + '(created changed created changed deleted deleted)) ;; Remote files return two `deleted' events. ((file-remote-p temporary-file-directory) '(created changed created changed deleted deleted stopped)) @@ -792,8 +792,8 @@ delivered." (created deleted stopped))) ;; On emba, `deleted' and `stopped' events of the ;; directory are not detected. -; ((getenv "EMACS_EMBA_CI") -; '(created changed renamed deleted)) + ((getenv "EMACS_EMBA_CI") + '(created changed renamed deleted)) ;; There are two `deleted' events, for the file and for ;; the directory. Except for cygwin, kqueue and remote ;; files. And cygwin raises `created' and `deleted' @@ -1413,8 +1413,8 @@ the file watch." '()) ;; On emba, `deleted' and `stopped' events of the ;; directory are not detected. -; ((getenv "EMACS_EMBA_CI") -; '()) + ((getenv "EMACS_EMBA_CI") + '()) ;; Remote files send just one `stopped' event. ((file-remote-p temporary-file-directory) '(stopped)) commit f82e0e5b76da7f0374100628a5e439a0189b0255 Author: Michael Albinus Date: Sun May 5 12:20:44 2019 +0200 Adapt tests for recent file-notification changes in Tramp * lisp/net/tramp.el (tramp-file-notify-process-sentinel): Pacify byte compiler. * test/lisp/autorevert-tests.el (auto-revert-test02-auto-revert-deleted-file): * test/lisp/filenotify-tests.el (file-notify-test03-events) (file-notify-test05-file-validity) (file-notify-test09-watched-file-in-watched-dir): Adapt for remote files. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index c1fe413e36..911fa91272 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3859,7 +3859,7 @@ of." "Call `file-notify-rm-watch'." (unless (process-live-p proc) (tramp-message proc 5 "Sentinel called: `%S' `%s'" proc event) - (file-notify-rm-watch proc))) + (tramp-compat-funcall 'file-notify-rm-watch proc))) ;;; Functions for establishing connection: diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index d98c11658f..af9edac1be 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -309,9 +309,7 @@ This expects `auto-revert--messages' to be bound by ;; polling. (should (string-match "any text" (buffer-string))) ;; With w32notify, the 'stopped' events are not sent. - ;; Same for remote file name handlers. Why? (or (eq file-notify--library 'w32notify) - (file-remote-p temporary-file-directory) (should-not auto-revert-notify-watch-descriptor)) ;; Once the file has been recreated, the buffer shall be diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index af2d0b33e0..b0273741bc 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -682,17 +682,18 @@ delivered." (file-notify--test-library) "gvfs-monitor-dir.exe") '((deleted stopped) (created deleted stopped))) + ;; On emba, `deleted' and `stopped' events of the + ;; directory are not detected. +; ((getenv "EMACS_EMBA_CI") +; '(created changed deleted)) ;; There are two `deleted' events, for the file and for - ;; the directory. Except for cygwin and kqueue. And - ;; cygwin does not raise a `changed' event. + ;; the directory. Except for cygwin, kqueue and remote + ;; files. And cygwin does not raise a `changed' event. ((eq system-type 'cygwin) '(created deleted stopped)) - ((string-equal (file-notify--test-library) "kqueue") + ((or (string-equal (file-notify--test-library) "kqueue") + (file-remote-p temporary-file-directory)) '(created changed deleted stopped)) - ;; On emba, `deleted' and `stopped' events of the - ;; directory are not detected. - ((getenv "EMACS_EMBA_CI") - '(created changed deleted)) (t '(created changed deleted deleted stopped))) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) @@ -740,8 +741,11 @@ delivered." '(created changed created changed deleted stopped)) ;; On emba, `deleted' and `stopped' events of the ;; directory are not detected. - ((getenv "EMACS_EMBA_CI") - '(created changed created changed deleted deleted)) +; ((getenv "EMACS_EMBA_CI") +; '(created changed created changed deleted deleted)) + ;; Remote files return two `deleted' events. + ((file-remote-p temporary-file-directory) + '(created changed created changed deleted deleted stopped)) (t '(created changed created changed deleted deleted deleted stopped))) (write-region @@ -786,18 +790,19 @@ delivered." (file-notify--test-library) "gvfs-monitor-dir.exe") '((deleted stopped) (created deleted stopped))) + ;; On emba, `deleted' and `stopped' events of the + ;; directory are not detected. +; ((getenv "EMACS_EMBA_CI") +; '(created changed renamed deleted)) ;; There are two `deleted' events, for the file and for - ;; the directory. Except for cygwin and kqueue. And - ;; cygwin raises `created' and `deleted' events instead - ;; of a `renamed' event. + ;; the directory. Except for cygwin, kqueue and remote + ;; files. And cygwin raises `created' and `deleted' + ;; events instead of a `renamed' event. ((eq system-type 'cygwin) '(created created deleted deleted stopped)) - ((string-equal (file-notify--test-library) "kqueue") + ((or (string-equal (file-notify--test-library) "kqueue") + (file-remote-p temporary-file-directory)) '(created changed renamed deleted stopped)) - ;; On emba, `deleted' and `stopped' events of the - ;; directory are not detected. - ((getenv "EMACS_EMBA_CI") - '(created changed renamed deleted)) (t '(created changed renamed deleted deleted stopped))) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) @@ -1041,11 +1046,12 @@ delivered." '((deleted stopped) (created deleted stopped))) ;; There are two `deleted' events, for the file and for - ;; the directory. Except for cygwin and kqueue. And - ;; cygwin does not raise a `changed' event. + ;; the directory. Except for cygwin, kqueue and remote + ;; files. And cygwin does not raise a `changed' event. ((eq system-type 'cygwin) '(created deleted stopped)) - ((string-equal (file-notify--test-library) "kqueue") + ((or (string-equal (file-notify--test-library) "kqueue") + (file-remote-p temporary-file-directory)) '(created changed deleted stopped)) (t '(created changed deleted deleted stopped))) (write-region @@ -1261,7 +1267,8 @@ delivered." (file-notify--test-with-events (cond ;; On cygwin we only get the `changed' event. - ((eq system-type 'cygwin) '(changed)) + ((eq system-type 'cygwin) + '(changed)) (t '(renamed created changed))) ;; The file is renamed when creating a backup. It shall ;; still be watched. @@ -1402,11 +1409,15 @@ the file watch." (cond ;; w32notify does not raise `deleted' and `stopped' ;; events for the watched directory. - ((string-equal (file-notify--test-library) "w32notify") '()) + ((string-equal (file-notify--test-library) "w32notify") + '()) ;; On emba, `deleted' and `stopped' events of the ;; directory are not detected. - ((getenv "EMACS_EMBA_CI") - '()) +; ((getenv "EMACS_EMBA_CI") +; '()) + ;; Remote files send just one `stopped' event. + ((file-remote-p temporary-file-directory) + '(stopped)) (t '(deleted stopped)))))) (delete-directory file-notify--test-tmpfile 'recursive)) (unless (getenv "EMACS_EMBA_CI") commit ab64228883126791cba85de0641592203d5ae820 Author: Mattias Engdegård Date: Tue Apr 30 22:35:56 2019 +0200 Reorganise (auto-)revert nodes in the manual Put all information about auto-revert into a section of its own, and organise the text in a more logical way. Previously it was mainly described in the section about reverting (bug#35418). * doc/emacs/files.texi (Files): Adjust menu. (Reverting, Auto Revert, Autorevert): Add node `Auto Revert' and move text on that topic from `Reverting', rearranged. Turn the old `Autorevert' node into a subsection under `Auto Revert'. * doc/emacs/arevert-xtra.texi (Autorevert): Rename and turn into subsubsection. * doc/emacs/buffers.texi (Several Buffers): Adjust references. * doc/emacs/emacs.texi (Top): Adjust menu. * doc/emacs/emacs-xtra.texi (Top): Adjust menu. (Non-File Buffers): Add node and section lines. diff --git a/doc/emacs/arevert-xtra.texi b/doc/emacs/arevert-xtra.texi index cd7c1ff895..9e01a10ace 100644 --- a/doc/emacs/arevert-xtra.texi +++ b/doc/emacs/arevert-xtra.texi @@ -4,8 +4,9 @@ @c @c This file is included either in emacs-xtra.texi (when producing the @c printed version) or in the main Emacs manual (for the on-line version). -@node Autorevert -@section Auto Reverting Non-File Buffers + +@node Non-File Buffers +@subsection Auto Reverting Non-File Buffers Global Auto Revert Mode normally only reverts file buffers. There are two ways to auto-revert certain non-file buffers: by enabling Auto @@ -43,7 +44,7 @@ explained in the corresponding sections. @end menu @node Auto Reverting the Buffer Menu -@subsection Auto Reverting the Buffer Menu +@subsubsection Auto Reverting the Buffer Menu If auto-reverting of non-file buffers is enabled, the Buffer Menu @iftex @@ -65,7 +66,7 @@ adding marks sets the buffer's modified flag prevents Auto Revert from automatically erasing the marks. @node Auto Reverting Dired -@subsection Auto Reverting Dired buffers +@subsubsection Auto Reverting Dired buffers Dired buffers only auto-revert when the file list of the buffer's main directory changes (e.g., when a new file is added or deleted). They diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index 27fcb7369a..14a0a01ca8 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi @@ -568,10 +568,10 @@ mode in this buffer, as long as it is not marked modified. Global Auto Revert mode applies to the @file{*Buffer List*} buffer only if @code{global-auto-revert-non-file-buffers} is non-@code{nil}. @iftex -@inforef{Autorevert,, emacs-xtra}, for details. +@inforef{Auto Reverting the Buffer Menu,, emacs-xtra}, for details. @end iftex @ifnottex -@xref{Autorevert, global-auto-revert-non-file-buffers}, for details. +@xref{Auto Reverting the Buffer Menu, global-auto-revert-non-file-buffers}, for details. @end ifnottex @node Indirect Buffers diff --git a/doc/emacs/emacs-xtra.texi b/doc/emacs/emacs-xtra.texi index dcd8fae1b6..e9231b4e3a 100644 --- a/doc/emacs/emacs-xtra.texi +++ b/doc/emacs/emacs-xtra.texi @@ -59,7 +59,7 @@ modify this GNU manual.'' * Picture Mode:: Editing pictures made up of characters using the quarter-plane screen model. -* Autorevert:: Auto Reverting non-file buffers. +* Non-File Buffers:: Auto Reverting non-file buffers. * Subdir Switches:: Subdirectory switches in Dired. * Advanced Calendar/Diary Usage:: Advanced Calendar/Diary customization. * Emerge:: A convenient way of merging two versions of a program. diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 58ec373029..a34cef221e 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -443,9 +443,7 @@ File Handling * Visiting:: Visiting a file prepares Emacs to edit the file. * Saving:: Saving makes your changes permanent. * Reverting:: Reverting cancels all the changes not saved. -@ifnottex -* Autorevert:: Auto Reverting non-file buffers. -@end ifnottex +* Auto Revert:: Keeping buffers automatically up-to-date. * Auto Save:: Auto Save periodically protects against loss of data. * File Aliases:: Handling multiple names for one file. * Directories:: Creating, deleting, and listing file directories. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 990b8f1679..c51d076fa2 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -25,9 +25,7 @@ on file directories. * Visiting:: Visiting a file prepares Emacs to edit the file. * Saving:: Saving makes your changes permanent. * Reverting:: Reverting cancels all the changes not saved. -@ifnottex -* Autorevert:: Auto Reverting non-file buffers. -@end ifnottex +* Auto Revert:: Keeping buffers automatically up-to-date. * Auto Save:: Auto Save periodically protects against loss of data. * File Aliases:: Handling multiple names for one file. * Directories:: Creating, deleting, and listing file directories. @@ -955,6 +953,11 @@ revert it automatically if it has changed---provided the buffer itself is not modified. (If you have edited the text, it would be wrong to discard your changes.) + You can also tell Emacs to revert buffers automatically when their +visited files change on disk; @pxref{Auto Revert}. + +@node Auto Revert +@section Auto Revert: Keeping buffers automatically up-to-date @cindex Global Auto Revert mode @cindex mode, Global Auto Revert @cindex Auto Revert mode @@ -962,22 +965,39 @@ discard your changes.) @findex global-auto-revert-mode @findex auto-revert-mode @findex auto-revert-tail-mode -@vindex auto-revert-interval -@vindex auto-revert-remote-files + + A buffer can get out of sync with respect to its visited file on +disk if that file is changed by another program. To keep it up to +date, you can enable Auto Revert mode by typing @kbd{M-x auto-revert-mode}. +This automatically reverts the buffer when its visited file changes on +disk. To do the same for all file buffers, type +@kbd{M-x global-auto-revert-mode} to enable Global Auto Revert mode. + + Auto Revert will not revert a buffer if it has unsaved changes, or if +its file on disk is deleted or renamed. + + One use of Auto Revert mode is to ``tail'' a file such as a system +log, so that changes made to that file by other programs are +continuously displayed. To do this, just move the point to the end of +the buffer, and it will stay there as the file contents change. +However, if you are sure that the file will only change by growing at +the end, use Auto Revert Tail mode instead +(@code{auto-revert-tail-mode}). It is more efficient for this. +Auto Revert Tail mode also works for remote files. + @vindex auto-revert-verbose - You can also tell Emacs to revert buffers periodically. To do this -for a specific buffer, enable the minor mode Auto-Revert mode by -typing @kbd{M-x auto-revert-mode}. This automatically reverts the -current buffer when its visited file changes on disk. To do the same -for all file buffers, type @kbd{M-x global-auto-revert-mode} to enable -Global Auto-Revert mode. These minor modes do not check or revert -remote files, because that is usually too slow. This behavior can be -changed by setting the variable @code{auto-revert-remote-files} to -non-@code{nil}. + When a buffer is auto-reverted, a message is generated. This can be +suppressed by setting @code{auto-revert-verbose} to @code{nil}. + +@vindex auto-revert-remote-files + The Auto Revert modes do not check or revert remote files, because +that is usually too slow. This behavior can be changed by setting the +variable @code{auto-revert-remote-files} to non-@code{nil}. @cindex file notifications @vindex auto-revert-use-notify - By default, Auto-Revert mode works using @dfn{file notifications}, +@vindex auto-revert-interval + By default, Auto Revert mode works using @dfn{file notifications}, whereby changes in the filesystem are reported to Emacs by the OS. You can disable use of file notifications by customizing the variable @code{auto-revert-use-notify} to a @code{nil} value, then Emacs will @@ -990,31 +1010,20 @@ default. @vindex auto-revert-avoid-polling @vindex auto-revert-notify-exclude-dir-regexp - By default, Auto-Revert mode will poll files for changes -periodically even when file notifications are used. Such polling is -usually unnecessary, and turning it off may save power by relying on -notifications only. To do so, set the variable + By default, Auto Revert mode will poll files for changes +periodically even when file notifications are used. Polling is +unnecessary in many cases, and turning it off may save power by +relying on notifications only. To do so, set the variable @code{auto-revert-avoid-polling} to non-@code{nil}. However, notification is ineffective on certain file systems; mainly network file system on Unix-like machines, where files can be altered from -other machines. To force polling when +other machines. For such file systems, polling may be necessary. +To force polling when @code{auto-revert-avoid-polling} is non-@code{nil}, set @code{auto-revert-notify-exclude-dir-regexp} to match files that should be excluded from using notification. - One use of Auto-Revert mode is to ``tail'' a file such as a system -log, so that changes made to that file by other programs are -continuously displayed. To do this, just move the point to the end of -the buffer, and it will stay there as the file contents change. -However, if you are sure that the file will only change by growing at -the end, use Auto-Revert Tail mode instead -(@code{auto-revert-tail-mode}). It is more efficient for this. -Auto-Revert Tail mode works also for remote files. - - When a buffer is auto-reverted, a message is generated. This can be -suppressed by setting @code{auto-revert-verbose} to @code{nil}. - - In Dired buffers (@pxref{Dired}), Auto-Revert mode refreshes the + In Dired buffers (@pxref{Dired}), Auto Revert mode refreshes the buffer when a file is created or deleted in the buffer's directory. @xref{VC Undo}, for commands to revert to earlier versions of files commit b5aeb86a7ef4c5cbfbbd95e72568b4b5e48e9bae Author: Philipp Stephani Date: Sun May 5 01:56:15 2019 +0200 Avoid suppressing -Wcast-function-type warning. GCC special-cases the type ‘void (*)(void)’ to not emit warnings when cast, see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcast-function-type. Make use of this to remove a warning suppression. * src/dynlib.h: Use void (*)(void) as generic function pointer type. * src/emacs-module.c: Remove warning suppression. diff --git a/src/dynlib.h b/src/dynlib.h index 2688712a13..43a0e045f5 100644 --- a/src/dynlib.h +++ b/src/dynlib.h @@ -29,7 +29,7 @@ const char *dynlib_error (void); ATTRIBUTE_MAY_ALIAS void *dynlib_sym (dynlib_handle_ptr h, const char *sym); -typedef struct dynlib_function_ptr_nonce *(ATTRIBUTE_MAY_ALIAS *dynlib_function_ptr) (void); +typedef void (ATTRIBUTE_MAY_ALIAS *dynlib_function_ptr) (void); dynlib_function_ptr dynlib_func (dynlib_handle_ptr h, const char *sym); /* Sets *FILE to the file name from which PTR was loaded, and *SYM to diff --git a/src/emacs-module.c b/src/emacs-module.c index 1a7a21a4a8..907a5d8225 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -101,11 +101,6 @@ To add a new module function, proceed as follows: # pragma GCC diagnostic ignored "-Wclobbered" #endif -/* This module is lackadaisical about function casts. */ -#if GNUC_PREREQ (8, 0, 0) -# pragma GCC diagnostic ignored "-Wcast-function-type" -#endif - /* We use different strategies for allocating the user-visible objects (struct emacs_runtime, emacs_env, emacs_value), depending on whether the user supplied the -module-assertions flag. If commit a976602066211f8820c0a2976afe81cad691a2c9 Author: Philipp Stephani Date: Sun May 5 01:30:23 2019 +0200 Fix compilation of test module. Because all other objects are compiled without -fPIC, we can’t use them when linking the test module. Instead, use the source files directly. * test/Makefile.in (HYBRID_MALLOC, LIBEGNU_ARCHIVE): Remove. ($(test_module)): Use source files instead of objects and archives. diff --git a/test/Makefile.in b/test/Makefile.in index bf5ba101bd..c18099587c 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -254,8 +254,6 @@ else FPIC_CFLAGS = -fPIC endif -HYBRID_MALLOC = @HYBRID_MALLOC@ -LIBEGNU_ARCHIVE = ../lib/lib$(if $(HYBRID_MALLOC),e)gnu.a GMP_LIB = @GMP_LIB@ GMP_OBJ = $(if @GMP_OBJ@, ../src/@GMP_OBJ@) @@ -267,10 +265,15 @@ MODULE_CFLAGS = -I../src -I$(srcdir)/../lib \ test_module = $(test_module_dir)/mod-test${SO} src/emacs-module-tests.log src/emacs-module-tests.elc: $(test_module) -$(test_module): $(test_module:${SO}=.c) ../src/emacs-module.h $(LIBEGNU_ARCHIVE) + +# In the compilation command, we can't use any object or archive file +# as source because those are not compiled with -fPIC. Therefore we +# use only source files. +$(test_module): $(test_module:${SO}=.c) ../src/emacs-module.h $(AM_V_at)${MKDIR_P} $(dir $@) $(AM_V_CCLD)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \ - -o $@ $< $(LIBEGNU_ARCHIVE) $(GMP_LIB) $(GMP_OBJ) + -o $@ $< $(GMP_LIB) $(GMP_OBJ:.o=.c) \ + $(srcdir)/../lib/timespec.c $(srcdir)/../lib/gettime.c endif ## Check that there is no 'automated' subdirectory, which would commit e95ecbe14681d86cb4ddd17edbb77559fdc9bc09 Author: Philipp Stephani Date: Sun May 5 01:23:44 2019 +0200 Use extract_time in test module. * test/data/emacs-module/mod-test.c (Fmod_test_sleep_until): Use extract_time for time argument. (signal_wrong_type_argument): Remove unused function. * test/src/emacs-module-tests.el (mod-test-sleep-until): Remove unnecessary ‘float-time’. diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c index a9154fa167..fccc60fe4d 100644 --- a/test/data/emacs-module/mod-test.c +++ b/test/data/emacs-module/mod-test.c @@ -315,16 +315,6 @@ Fmod_test_invalid_finalizer (emacs_env *env, ptrdiff_t nargs, emacs_value *args, return env->intern (env, "nil"); } -static void -signal_wrong_type_argument (emacs_env *env, const char *predicate, - emacs_value arg) -{ - emacs_value symbol = env->intern (env, "wrong-type-argument"); - emacs_value elements[2] = {env->intern (env, predicate), arg}; - emacs_value data = env->funcall (env, env->intern (env, "list"), 2, elements); - env->non_local_exit_signal (env, symbol, data); -} - static void signal_errno (emacs_env *env, const char *function) { @@ -345,16 +335,10 @@ Fmod_test_sleep_until (emacs_env *env, ptrdiff_t nargs, emacs_value *args, void *data) { assert (nargs == 2); - const double until_seconds = env->extract_float (env, args[0]); + const struct timespec until = env->extract_time (env, args[0]); if (env->non_local_exit_check (env)) return NULL; - if (until_seconds <= 0) - { - signal_wrong_type_argument (env, "cl-plusp", args[0]); - return NULL; - } const bool process_input = env->is_not_nil (env, args[1]); - const struct timespec until = dtotimespec (until_seconds); const struct timespec amount = make_timespec(0, 10000000); while (true) { diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 60ba71c57b..5349de055e 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -313,7 +313,7 @@ Interactively, you can try hitting \\[keyboard-quit] to quit." ;; Interactively, run for 5 seconds to give the ;; user time to quit. In batch mode, run only ;; briefly since the user can't quit. - (float-time (time-add nil (if noninteractive 0.1 5))) + (time-add nil (if noninteractive 0.1 5)) ;; should_quit or process_input arg)) 'finished)) commit 27a9377d4235462ba61e51fdb1239b61133b5aee Author: Philipp Stephani Date: Sun May 5 00:27:19 2019 +0200 * test/Makefile.in (src/emacs-module-tests.elc): Require test module diff --git a/test/Makefile.in b/test/Makefile.in index ec20a427ba..bf5ba101bd 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -266,7 +266,7 @@ MODULE_CFLAGS = -I../src -I$(srcdir)/../lib \ $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) test_module = $(test_module_dir)/mod-test${SO} -src/emacs-module-tests.log: $(test_module) +src/emacs-module-tests.log src/emacs-module-tests.elc: $(test_module) $(test_module): $(test_module:${SO}=.c) ../src/emacs-module.h $(LIBEGNU_ARCHIVE) $(AM_V_at)${MKDIR_P} $(dir $@) $(AM_V_CCLD)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \ commit 9684296a5d3405885e44d0b422deef19329567ef Author: Philipp Stephani Date: Sat May 4 23:31:40 2019 +0200 Refactoring: Factor out a function to set an mpz_t from a Lisp int. * src/bignum.h (mpz_set_integer): New function. * src/emacs-module.c (module_make_big_integer): Use it. diff --git a/src/bignum.h b/src/bignum.h index 4c670bd906..743a18fc0f 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -94,6 +94,18 @@ bignum_integer (mpz_t *tmp, Lisp_Object i) return &XBIGNUM (i)->value; } +/* Set RESULT to the value stored in the Lisp integer I. If I is a + big integer, copy it to RESULT. RESULT must already be + initialized. */ +INLINE void +mpz_set_integer (mpz_t result, Lisp_Object i) +{ + if (FIXNUMP (i)) + mpz_set_intmax (result, XFIXNUM (i)); + else + mpz_set (result, XBIGNUM (i)->value); +} + INLINE_HEADER_END #endif /* BIGNUM_H */ diff --git a/src/emacs-module.c b/src/emacs-module.c index 6b56146ca0..1a7a21a4a8 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -785,10 +785,7 @@ module_extract_big_integer (emacs_env *env, emacs_value value, MODULE_FUNCTION_BEGIN (); Lisp_Object o = value_to_lisp (value); CHECK_INTEGER (o); - if (FIXNUMP (o)) - mpz_set_intmax (result->value, XFIXNUM (o)); - else - mpz_set (result->value, XBIGNUM (o)->value); + mpz_set_integer (result->value, o); } static emacs_value commit 1242a63671f3fc3d427d9d8061338f826e585031 Author: Philipp Stephani Date: Sat May 4 22:59:46 2019 +0200 Avoid undefined behavior when printing function pointers. * src/print.c (print_vectorlike): Don’t pass a function pointer to ‘snprintf’, as that is undefined behavior. Instead, print the individual bytes making up the function pointer. diff --git a/src/print.c b/src/print.c index 68ed6781c8..57aac5f547 100644 --- a/src/print.c +++ b/src/print.c @@ -1794,17 +1794,24 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, if (symbol == NULL) { - print_c_string ("at ", printcharfun); - enum { pointer_bufsize = sizeof ptr * 16 / CHAR_BIT + 2 + 1 }; - char buffer[pointer_bufsize]; - int needed = snprintf (buffer, sizeof buffer, "%p", ptr); - const char p0x[] = "0x"; - eassert (needed <= sizeof buffer); - /* ANSI C doesn't guarantee that %p produces a string that - begins with a "0x". */ - if (c_strncasecmp (buffer, p0x, sizeof (p0x) - 1) != 0) - print_c_string (p0x, printcharfun); - print_c_string (buffer, printcharfun); + print_c_string ("at 0x", printcharfun); + /* See https://stackoverflow.com/a/2741896 for how to + portably print a function pointer. */ + const unsigned char *p = (const unsigned char *) &ptr; + for (size_t i = 0; i < sizeof ptr; ++i) + { +#ifdef WORDS_BIGENDIAN + unsigned char b = p[i]; +#else + unsigned char b = p[sizeof ptr - i - 1]; +#endif + enum { digits = (CHAR_BIT + 4 - 1) / 4 }; + char buffer[digits + 1]; + int needed + = snprintf (buffer, sizeof buffer, "%0*hhx", digits, b); + eassert (needed == digits); + print_c_string (buffer, printcharfun); + } } else print_c_string (symbol, printcharfun); commit 2e0947abbc384a55411880c6d49020b43fe8b5f5 Author: Michael Albinus Date: Sat May 4 22:29:27 2019 +0200 Notify broken file notification from Tramp * lisp/net/tramp.el (tramp-file-notify-process-sentinel): New defun. * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch): * lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch): Set process sentinel. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 8fea82d97c..52eaf686ea 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1187,6 +1187,7 @@ If FILE-SYSTEM is non-nil, return file system attributes." (process-put p 'adjust-window-size-function #'ignore) (set-process-query-on-exit-flag p nil) (set-process-filter p #'tramp-gvfs-monitor-process-filter) + (set-process-sentinel p #'tramp-file-notify-process-sentinel) ;; There might be an error if the monitor is not supported. ;; Give the filter a chance to read the output. (while (tramp-accept-process-output p 0)) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 37ff14a5eb..c4c439885c 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3645,6 +3645,7 @@ Fall back to normal file name handler if no Tramp handler exists." (process-put p 'watch-name localname) (set-process-query-on-exit-flag p nil) (set-process-filter p filter) + (set-process-sentinel p #'tramp-file-notify-process-sentinel) ;; There might be an error if the monitor is not supported. ;; Give the filter a chance to read the output. (while (tramp-accept-process-output p 0)) @@ -5957,5 +5958,7 @@ function cell is returned to be applied on a buffer." ;; * Implement detaching/re-attaching remote sessions. By this, a ;; session could be reused after a connection loss. Use dtach, or ;; screen, or tmux, or mosh. +;; +;; * Implement `:stderr' of `make-process' as pipe process. ;;; tramp-sh.el ends here diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 427b3c41e3..c1fe413e36 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -9,6 +9,7 @@ ;; Package: tramp ;; Version: 2.4.2-pre ;; Package-Requires: ((emacs "24.1")) +;; URL: https://savannah.gnu.org/projects/tramp ;; This file is part of GNU Emacs. @@ -3854,6 +3855,12 @@ of." (concat (file-remote-p default-directory) (process-get proc 'watch-name)))))) +(defun tramp-file-notify-process-sentinel (proc event) + "Call `file-notify-rm-watch'." + (unless (process-live-p proc) + (tramp-message proc 5 "Sentinel called: `%S' `%s'" proc event) + (file-notify-rm-watch proc))) + ;;; Functions for establishing connection: ;; The following functions are actions to be taken when seeing certain commit ebecafbd19e2ba55ba90bfc9f7de88f4742479ad Author: Paul Eggert Date: Sat May 4 13:15:29 2019 -0700 Port new fingerprinting scheme to clang + LTO * lib-src/make-fingerprint.c (main): Don't consider multiple instances of the fingerprint to be an error, as this can happen with clang and -flto. Instead, replace all instances of the fingerprint. There is a tiny chance that this will silently corrupt the Emacs executable. This patch suggests that we should go back to fingerprinting the inputs to the linker instead of its output, as the new fingerprinting scheme is unnecessarily complicated and this complexity reduces reliability. The old scheme (i.e., before commit 2019-05-14T23:31:24Z!eggert@cs.ucla.edu) was simpler and more portable and good enough, and it's looking like it would be less trouble in practice than the new scheme. diff --git a/lib-src/make-fingerprint.c b/lib-src/make-fingerprint.c index 79bd007a5f..5779e0d274 100644 --- a/lib-src/make-fingerprint.c +++ b/lib-src/make-fingerprint.c @@ -140,29 +140,25 @@ main (int argc, char **argv) } else { - char *finger = memmem (buf, chunksz, fingerprint, sizeof fingerprint); - if (!finger) - { - fprintf (stderr, "%s: %s: missing fingerprint\n", prog, file); - return EXIT_FAILURE; - } - else if (memmem (finger + 1, buf + chunksz - (finger + 1), - fingerprint, sizeof fingerprint)) - { - fprintf (stderr, "%s: %s: two occurrences of fingerprint\n", - prog, file); - return EXIT_FAILURE; - } + bool fingered = false; - if (fseeko (f, finger - buf, SEEK_SET) != 0) + for (char *finger = buf; + (finger = memmem (finger, buf + chunksz - finger, + fingerprint, sizeof fingerprint)); + finger++) { - perror (file); - return EXIT_FAILURE; + if (! (fseeko (f, finger - buf, SEEK_SET) == 0 + && fwrite (digest, 1, sizeof digest, f) == sizeof digest)) + { + perror (file); + return EXIT_FAILURE; + } + fingered = true; } - if (fwrite (digest, 1, sizeof digest, f) != sizeof digest) + if (!fingered) { - perror (file); + fprintf (stderr, "%s: %s: missing fingerprint\n", prog, file); return EXIT_FAILURE; } } commit 4fd9048e940d38364caf4abe9b209f9288c78544 Author: Noam Postavsky Date: Sat May 4 14:47:29 2019 -0400 Avoid slow overlay ansi coloring in eshell (Bug#29854) * lisp/ansi-color.el (ansi-color-apply-on-region): Reset temporary markers after finishing with them. (ansi-color-apply-text-property-face): New function. * lisp/eshell/esh-mode.el (eshell-handle-ansi-color): * lisp/man.el (Man-fontify-manpage): Use it as the `ansi-color-apply-face-function' while calling `ansi-color-apply-on-region'. Use `font-lock-face' to propertize instead of `face'. diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index d3b8d06604..136e69f9a7 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -415,7 +415,11 @@ this." ;; if the rest of the region should have a face, put it there (funcall ansi-color-apply-face-function start-marker end-marker (ansi-color--find-face codes)) - (setq ansi-color-context-region (if codes (list codes))))))) + (setq ansi-color-context-region (if codes (list codes))))) + ;; Clean up our temporary markers. + (unless (eq start-marker (cadr ansi-color-context-region)) + (set-marker start-marker nil)) + (set-marker end-marker nil))) (defun ansi-color-apply-overlay-face (beg end face) "Make an overlay from BEG to END, and apply face FACE. @@ -425,6 +429,12 @@ If FACE is nil, do nothing." (ansi-color-make-extent beg end) face))) +(defun ansi-color-apply-text-property-face (beg end face) + "Set the `font-lock-face' property to FACE in region BEG..END. +If FACE is nil, do nothing." + (when face + (put-text-property beg end 'font-lock-face face))) + ;; This function helps you look for overlapping overlays. This is ;; useful in comint-buffers. Overlapping overlays should not happen! ;; A possible cause for bugs are the markers. If you create an overlay diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index cff29bed1b..a36ac969e5 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -1014,11 +1014,13 @@ This function could be in the list `eshell-output-filter-functions'." 'eshell-handle-control-codes) (autoload 'ansi-color-apply-on-region "ansi-color") +(defvar ansi-color-apply-face-function) (defun eshell-handle-ansi-color () "Handle ANSI color codes." - (ansi-color-apply-on-region eshell-last-output-start - eshell-last-output-end)) + (let ((ansi-color-apply-face-function #'ansi-color-apply-text-property-face)) + (ansi-color-apply-on-region eshell-last-output-start + eshell-last-output-end))) (custom-add-option 'eshell-output-filter-functions 'eshell-handle-ansi-color) diff --git a/lisp/man.el b/lisp/man.el index b1d0fd3d17..d52ca2156d 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1206,10 +1206,7 @@ Same for the ANSI bold and normal escape sequences." (interactive) (goto-char (point-min)) ;; Fontify ANSI escapes. - (let ((ansi-color-apply-face-function - (lambda (beg end face) - (when face - (put-text-property beg end 'face face)))) + (let ((ansi-color-apply-face-function #'ansi-color-apply-text-property-face) (ansi-color-map Man-ansi-color-map)) (ansi-color-apply-on-region (point-min) (point-max))) ;; Other highlighting. @@ -1220,31 +1217,33 @@ Same for the ANSI bold and normal escape sequences." (goto-char (point-min)) (while (and (search-forward "__\b\b" nil t) (not (eobp))) (backward-delete-char 4) - (put-text-property (point) (1+ (point)) 'face 'Man-underline)) + (put-text-property (point) (1+ (point)) + 'font-lock-face 'Man-underline)) (goto-char (point-min)) (while (search-forward "\b\b__" nil t) (backward-delete-char 4) - (put-text-property (1- (point)) (point) 'face 'Man-underline)))) + (put-text-property (1- (point)) (point) + 'font-lock-face 'Man-underline)))) (goto-char (point-min)) (while (and (search-forward "_\b" nil t) (not (eobp))) (backward-delete-char 2) - (put-text-property (point) (1+ (point)) 'face 'Man-underline)) + (put-text-property (point) (1+ (point)) 'font-lock-face 'Man-underline)) (goto-char (point-min)) (while (search-forward "\b_" nil t) (backward-delete-char 2) - (put-text-property (1- (point)) (point) 'face 'Man-underline)) + (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)) (goto-char (point-min)) (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t) (replace-match "\\1") - (put-text-property (1- (point)) (point) 'face 'Man-overstrike)) + (put-text-property (1- (point)) (point) 'font-lock-face 'Man-overstrike)) (goto-char (point-min)) (while (re-search-forward "o\b\\+\\|\\+\bo" nil t) (replace-match "o") - (put-text-property (1- (point)) (point) 'face 'bold)) + (put-text-property (1- (point)) (point) 'font-lock-face 'bold)) (goto-char (point-min)) (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t) (replace-match "+") - (put-text-property (1- (point)) (point) 'face 'bold)) + (put-text-property (1- (point)) (point) 'font-lock-face 'bold)) ;; When the header is longer than the manpage name, groff tries to ;; condense it to a shorter line interspersed with ^H. Remove ^H with ;; their preceding chars (but don't put Man-overstrike). (Bug#5566) @@ -1258,7 +1257,7 @@ Same for the ANSI bold and normal escape sequences." (while (re-search-forward Man-heading-regexp nil t) (put-text-property (match-beginning 0) (match-end 0) - 'face 'Man-overstrike)))) + 'font-lock-face 'Man-overstrike)))) (defun Man-highlight-references (&optional xref-man-type) "Highlight the references on mouse-over. commit 37963ed4991823fd1ee5cd2c485f22ac988259e2 Author: Paul Eggert Date: Sat May 4 10:16:46 2019 -0700 Fix bytecode optimization typo Problem reported by Simon Frankau (Bug#35562). * src/bytecode.c (exec_byte_code): Fix typo when optimizing varset. diff --git a/src/bytecode.c b/src/bytecode.c index 40977799bf..6f601cf0cd 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -562,7 +562,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, /* Inline the most common case. */ if (SYMBOLP (sym) && !EQ (val, Qunbound) - && !XSYMBOL (sym)->u.s.redirect + && XSYMBOL (sym)->u.s.redirect == SYMBOL_PLAINVAL && !SYMBOL_TRAPPED_WRITE_P (sym)) SET_SYMBOL_VAL (XSYMBOL (sym), val); else commit eec3ed05e3376d83df5501ca557edffaf2261b24 Author: John Shahid Date: Sat May 4 18:25:51 2019 +0200 Fix Bug#35506 * lisp/net/tramp.el (tramp-interrupt-process): Kill the entire process group. (Bug#35506) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 2e1a0960d7..427b3c41e3 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4870,7 +4870,7 @@ Only works for Bourne-like shells." (tramp-compat-funcall 'tramp-send-command (process-get proc 'vector) - (format "kill -2 %d" pid)) + (format "kill -2 -%d" pid)) ;; Wait, until the process has disappeared. If it doesn't, ;; fall back to the default implementation. (with-timeout (1 (ignore)) commit 5d3030910f111e991e5050339faf16b99b401e6a Author: Eli Zaretskii Date: Sat May 4 19:19:58 2019 +0300 Minor fix in .gdbinit * src/.gdbinit (xprintsym): Don't attempt to print the symbol's name if it is not yet set. This happens with built-in symbols at the beginning of 'main'. diff --git a/src/.gdbinit b/src/.gdbinit index b8b303104f..8c9a227ee3 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -1059,8 +1059,10 @@ end define xprintsym xsymname $arg0 xgetptr $symname - set $sym_name = (struct Lisp_String *) $ptr - xprintstr $sym_name + if $ptr != 0 + set $sym_name = (struct Lisp_String *) $ptr + xprintstr $sym_name + end end document xprintsym Print argument as a symbol. commit a90ad2297391cf5fe284a4c6e81724360ed018a4 Author: Eli Zaretskii Date: Sat May 4 12:47:03 2019 +0300 ; * src/minibuf.c (Fread_buffer): Doc fix. (Bug#35361) diff --git a/src/minibuf.c b/src/minibuf.c index 10fd5e56ac..2bf6bc2594 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1062,7 +1062,8 @@ Optional second arg DEF is value to return if user enters an empty line, Optional third arg REQUIRE-MATCH has the same meaning as the REQUIRE-MATCH argument of `completing-read'. Optional arg PREDICATE, if non-nil, is a function limiting the buffers that -can be considered. It will be called with each potential candidate, and +can be considered. It will be called with each potential candidate, in +the form of either a string or a cons cell whose `car' is a string, and should return non-nil to accept the candidate for completion, nil otherwise. If `read-buffer-completion-ignore-case' is non-nil, completion ignores case while reading the buffer name. commit e93d651b492bdf4432d5ea8b885de93a171c8dd5 Author: Eli Zaretskii Date: Sat May 4 09:52:11 2019 +0300 ; * src/xfaces.c (merge_face_ref): Improve commentary. diff --git a/src/xfaces.c b/src/xfaces.c index 7e04c0e995..5c2414b7b0 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2265,11 +2265,12 @@ filter_face_ref (Lisp_Object face_ref, } /* Merge face attributes from the lisp `face reference' FACE_REF on - frame F into the face attribute vector TO. If ERR_MSGS, - problems with FACE_REF cause an error message to be shown. Return - true if no errors occurred (regardless of the value of ERR_MSGS). - Use NAMED_MERGE_POINTS to detect loops in face inheritance or - list structure; it may be 0 for most callers. + frame F into the face attribute vector TO as appropriate for + window W; W is used only for filtering face specs. If ERR_MSGS + is non-zero, problems with FACE_REF cause an error message to be + shown. Return true if no errors occurred (regardless of the value + of ERR_MSGS). Use NAMED_MERGE_POINTS to detect loops in face + inheritance or list structure; it may be 0 for most callers. FACE_REF may be a single face specification or a list of such specifications. Each face specification can be: @@ -2286,9 +2287,10 @@ filter_face_ref (Lisp_Object face_ref, 4. Conses of the form (:filtered (:window PARAMETER VALUE) FACE-SPECIFICATION), - which applies FACE-SPECIFICATION only if the - given face attributes are being evaluated in the context of a - window with a parameter named PARAMETER being EQ VALUE. + which applies FACE-SPECIFICATION only if the given face attributes + are being evaluated in the context of a window with a parameter + named PARAMETER being EQ VALUE. In this case, W specifies the window + for which the filtered face spec is to be evaluated. 5. nil, which means to merge nothing. commit b5376e0ebd7b62f00c1b64aef87cd8d96cfbc71a Author: Paul Eggert Date: Fri May 3 14:19:26 2019 -0700 Skip tests if test subdir is missing Problem reported by Jeffrey Walton in: https://lists.gnu.org/r/emacs-devel/2019-05/msg00041.html * Makefile.in (CHECK_TARGETS): New macro; use it to simplify 'check' and similar rules. ($(CHECK_TARGETS)): If tests are missing, do not fail after issuing a diagnostic. Just skip the tests. diff --git a/Makefile.in b/Makefile.in index 06da415a4a..21362a9196 100644 --- a/Makefile.in +++ b/Makefile.in @@ -950,17 +950,15 @@ extraclean: $(extraclean_dirs:=_extraclean) TAGS tags: lib lib-src # src $(MAKE) -C src tags -.PHONY: have-tests -have-tests: - @if test ! -d test; then \ - echo "You do not seem to have the test/ directory."; \ - echo "Maybe you are using a release tarfile, rather than a repository checkout."; \ - exit 1; \ - fi - -.PHONY: check check-maybe check-expensive check-all -check check-maybe check-expensive check-all: have-tests all +CHECK_TARGETS = check check-maybe check-expensive check-all +.PHONY: $(CHECK_TARGETS) +$(CHECK_TARGETS): all +ifeq ($(wildcard test),test) $(MAKE) -C test $@ +else + @echo "You do not seem to have the test/ directory." + @echo "Maybe you used a release tarfile that lacks tests." +endif dist: cd ${srcdir}; ./make-dist commit dae48faec640bba57a42c1a81cc0ab6703a2ddbd Author: Paul Eggert Date: Fri May 3 13:58:09 2019 -0700 Modernize INSTALL a bit * INSTALL: Omit filesystem space estimates. These estimates were (1) wrong and (2) no longer important nowadays, as people have plenty of space. Instead, start with how to get and unpack an Emacs tarball. Don’t say "disk" as it’s often not disk nowadays. Update URLs. diff --git a/INSTALL b/INSTALL index 8022385010..e38635c60b 100644 --- a/INSTALL +++ b/INSTALL @@ -34,11 +34,12 @@ some of the steps manually. The more detailed description in the other sections of this guide will help you do that, so please refer to those sections if you need to. - 1. Unpacking the Emacs release requires about 200 MB of free - disk space. Building Emacs uses about another 200 MB of space. - The final installed Emacs uses about 150 MB of disk space. - This includes the space-saving that comes from automatically - compressing the Lisp source files on installation. + 1. Obtain and unpack the Emacs release, with commands like this: + + wget https://ftp.gnu.org/gnu/emacs/emacs-VERSION.tar.xz + tar -xf emacs-VERSION.tar.xz + + where VERSION is the Emacs version number. 2a. 'cd' to the directory where you unpacked Emacs and invoke the 'configure' script: @@ -87,7 +88,7 @@ sections if you need to. make install - You are now ready to use Emacs. If you wish to conserve disk space, + You are now ready to use Emacs. If you wish to conserve space, you may remove the program binaries and object files from the directory where you built Emacs: @@ -118,7 +119,7 @@ packages. Note that if there is a separate 'dev' or 'devel' package, for use at compilation time rather than run time, you will need that as well as the corresponding run time package; typically the dev package will contain header files and a library archive. Otherwise, -you can download the libraries from . +you can download the libraries from . Note that Emacs cannot support complex scripts on a TTY, unless the terminal includes such a support. @@ -162,14 +163,14 @@ can be found (in the unlikely event that your distribution does not provide them). By default, libraries marked with an X are required if X11 is being used. - libXaw3d https://directory.fsf.org/project/xaw3d/ - X libxpm for XPM: http://www.x.org/releases/current/src/lib/ + libXaw3d https://directory.fsf.org/project/Xaw3d + X libxpm for XPM: https://www.x.org/releases/current/src/lib/ X libpng for PNG: http://www.libpng.org/ - libz (for PNG): http://www.zlib.net/ - X libjpeg for JPEG: http://www.ijg.org/ - X libtiff for TIFF: http://www.remotesensing.org/libtiff/ - X libgif for GIF: http://sourceforge.net/projects/giflib/ - librsvg2 for SVG: http://wiki.gnome.org/action/show/Projects/LibRsvg + libz (for PNG): https://www.zlib.net/ + X libjpeg for JPEG: https://www.ijg.org/ + X libtiff for TIFF: http://www.simplesystems.org/libtiff/ + X libgif for GIF: http://giflib.sourceforge.net/ + librsvg2 for SVG: https://wiki.gnome.org/Projects/LibRsvg If you supply the appropriate --without-LIB option, 'configure' will omit the corresponding library from Emacs, even if that makes for a @@ -213,7 +214,7 @@ DETAILED BUILDING AND INSTALLATION: see nextstep/INSTALL. For non-ancient versions of MS Windows, see the file nt/INSTALL. For MS-DOS and MS Windows 3.X, see msdos/INSTALL.) -1) See the basic installation summary above for the disk space requirements. +1) See BASIC INSTALLATION above for getting and configuring Emacs. 2) In the unlikely event that 'configure' does not detect your system type correctly, consult './etc/MACHINES' to see what --host, --build @@ -352,7 +353,7 @@ Use --enable-link-time-optimization to enable link-time optimization. With GCC, you need GCC 4.5.0 and later, and 'configure' arranges for linking to be parallelized if possible. With Clang, you need GNU binutils with the gold linker and plugin support, along with the LLVM -gold plugin . Link time +gold plugin . Link time optimization is not the default as it tends to cause crashes and to make Emacs slower. commit 6caf9be6cacad2da36f2a1303304df588325d38b Author: Paul Eggert Date: Fri May 3 12:38:28 2019 -0700 Simplify use of NDEBUG in etags.c * lib-src/etags.c [!DEBUG]: Do not define NDEBUG, as that’s conf_post.h’s job now. [NDEBUG]: Do not redefine ‘assert’, as that works around ancient bugs (e.g., sunos4 pcc) that don’t matter any more, as can be seen that other Emacs source files that successfully use assert.h without this workaround. diff --git a/lib-src/etags.c b/lib-src/etags.c index 362897fb0c..949ab5a2c6 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -84,10 +84,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; # undef DEBUG # define DEBUG true #else -# define DEBUG false -# ifndef NDEBUG -# define NDEBUG /* disable assert */ -# endif +# define DEBUG false #endif #include @@ -131,11 +128,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; #include #include -#ifdef NDEBUG -# undef assert /* some systems have a buggy assert.h */ -# define assert(x) ((void) 0) -#endif - #include #include commit da3897abf1e45741b122b52df37a5cbc68b2ad5d Author: Paul Eggert Date: Fri May 3 12:16:33 2019 -0700 Pacify librsvg 2.45.1 and later * src/image.c (svg_load_image): Pacify librsvg 2.45.1 and later, and add a FIXME comment about the deprecated librsvg functions. diff --git a/src/image.c b/src/image.c index bf594987eb..3d724a773b 100644 --- a/src/image.c +++ b/src/image.c @@ -6735,7 +6735,7 @@ my_error_exit (j_common_ptr cinfo) /* Init source method for JPEG data source manager. Called by - jpeg_read_header() before any data is actually read. See + jpeg_read_header before any data is actually read. See libjpeg.doc from the JPEG lib distribution. */ static void @@ -6745,7 +6745,7 @@ our_common_init_source (j_decompress_ptr cinfo) /* Method to terminate data source. Called by - jpeg_finish_decompress() after all data has been processed. */ + jpeg_finish_decompress after all data has been processed. */ static void our_common_term_source (j_decompress_ptr cinfo) @@ -9456,7 +9456,18 @@ svg_load_image (struct frame *f, struct image *img, char *contents, See rsvg bug 596114 - "image refs are relative to curdir, not .svg file" . */ if (filename) - rsvg_handle_set_base_uri(rsvg_handle, filename); + rsvg_handle_set_base_uri (rsvg_handle, filename); + + /* Suppress GCC deprecation warnings starting in librsvg 2.45.1 for + rsvg_handle_write and rsvg_handle_close. FIXME: Use functions + like rsvg_handle_new_from_gfile_sync on newer librsvg versions, + and remove this hack. */ + #if GNUC_PREREQ (4, 6, 0) + #pragma GCC diagnostic push + #endif + #if LIBRSVG_CHECK_VERSION (2, 45, 1) && GNUC_PREREQ (4, 2, 0) + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif /* Parse the contents argument and fill in the rsvg_handle. */ rsvg_handle_write (rsvg_handle, (unsigned char *) contents, size, &err); @@ -9467,6 +9478,10 @@ svg_load_image (struct frame *f, struct image *img, char *contents, rsvg_handle_close (rsvg_handle, &err); if (err) goto rsvg_error; + #if GNUC_PREREQ (4, 6, 0) + #pragma GCC diagnostic pop + #endif + rsvg_handle_get_dimensions (rsvg_handle, &dimension_data); if (! check_image_size (f, dimension_data.width, dimension_data.height)) { commit 74e17c23ae085026cb089cbbb89c56e890bb29c4 Author: Paul Eggert Date: Fri May 3 12:14:38 2019 -0700 Simplify xd_signature to pacify GCC 9 * src/dbusbind.c (xd_signature): Use simpler way to set up the subsignature. This also pacifies GCC 9 on Fedora 30 x86-64. diff --git a/src/dbusbind.c b/src/dbusbind.c index 0afae6b05a..850d176c08 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -346,7 +346,6 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object) int subtype; Lisp_Object elt; char const *subsig; - int subsiglen; char x[DBUS_MAXIMUM_SIGNATURE_LENGTH]; elt = object; @@ -430,10 +429,9 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object) elt = CDR_SAFE (XD_NEXT_VALUE (elt)); } - subsiglen = snprintf (signature, DBUS_MAXIMUM_SIGNATURE_LENGTH, - "%c%s", dtype, subsig); - if (! (0 <= subsiglen && subsiglen < DBUS_MAXIMUM_SIGNATURE_LENGTH)) - string_overflow (); + signature[0] = dtype; + signature[1] = '\0'; + xd_signature_cat (signature, subsig); break; case DBUS_TYPE_VARIANT: commit 57a1d378ff148328a65b70bb80c092dad58adac4 Author: Paul Eggert Date: Fri May 3 12:12:43 2019 -0700 Update from Gnulib This incorporates: 2019-05-03 Port manywarnings to GCC 9 * m4/manywarnings.m4: Copy from Gnulib. diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4 index e0488a5cb3..6bb9f8f84e 100644 --- a/m4/manywarnings.m4 +++ b/m4/manywarnings.m4 @@ -1,4 +1,4 @@ -# manywarnings.m4 serial 17 +# manywarnings.m4 serial 18 dnl Copyright (C) 2008-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -112,16 +112,19 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)], gl_manywarn_set= for gl_manywarn_item in -fno-common \ -W \ + -Wabsolute-value \ -Waddress \ + -Waddress-of-packed-member \ -Waggressive-loop-optimizations \ -Wall \ - -Wattribute-alias \ + -Wattribute-warning \ -Wattributes \ -Wbad-function-cast \ -Wbool-compare \ -Wbool-operation \ -Wbuiltin-declaration-mismatch \ -Wbuiltin-macro-redefined \ + -Wcannot-profile \ -Wcast-align \ -Wcast-align=strict \ -Wcast-function-type \ @@ -186,6 +189,7 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)], -Wmissing-field-initializers \ -Wmissing-include-dirs \ -Wmissing-parameter-type \ + -Wmissing-profile \ -Wmissing-prototypes \ -Wmultichar \ -Wmultistatement-macros \ @@ -292,6 +296,7 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)], AC_MSG_RESULT([$gl_alloc_max]) gl_manywarn_set="$gl_manywarn_set -Walloc-size-larger-than=$gl_alloc_max" gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2" + gl_manywarn_set="$gl_manywarn_set -Wattribute-alias=2" gl_manywarn_set="$gl_manywarn_set -Wformat-overflow=2" gl_manywarn_set="$gl_manywarn_set -Wformat-truncation=2" gl_manywarn_set="$gl_manywarn_set -Wimplicit-fallthrough=5" commit d0fe28cb1d33daa059990d62556a8de20a385387 Author: Michael Albinus Date: Fri May 3 17:18:13 2019 +0200 Add tests for remote files in auto-revert-tests * lisp/autorevert.el (auto-revert-debug): New defvar. (auto-revert-notify-handler): Write traces. * lisp/filenotify.el (file-notify-debug): New defvar. (file-notify-handle-event, file-notify-callback): Write traces. * lisp/net/tramp-sh.el (tramp-sh-handle-vc-registered): Handle nil `vc-handled-backends'. * test/lisp/autorevert-tests.el (auto-revert-test-remote-temporary-file-directory): New defconst. Handle also $REMOTE_FILE_NOTIFY_LIBRARY. (auto-revert--test-enabled-remote-checked): New defvar. (auto-revert--test-enabled-remote): New defun. (auto-revert--wait-for-revert): Rewrite without timeout. (auto-revert--deftest-remote): New defmacro. (auto-revert-test01-auto-revert-several-files): (auto-revert-test02-auto-revert-deleted-file): Adapt for remote files. (auto-revert-test02-auto-revert-deleted-file): Use `auto-revert-debug' for debug messages. (auto-revert-test00-auto-revert-mode-remote) (auto-revert-test01-auto-revert-several-files-mode-remote) (auto-revert-test02-auto-revert-deleted-file-mode-remote) (auto-revert-test03-auto-revert-tail-mode-mode-remote) (auto-revert-test04-auto-revert-mode-dired-mode-remote): New tests. * test/lisp/filenotify-tests.el (file-notify--test-event-handler): Use `file-notify-debug' for debug messages. diff --git a/lisp/autorevert.el b/lisp/autorevert.el index cdd8223fff..7cd5e7ee8b 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -126,8 +126,6 @@ Global Auto-Revert Mode does so in all buffers." ;; Variables: -;;; What's this?: ;; Autoload for the benefit of `make-mode-line-mouse-sensitive'. -;;; What's this?: ;;;###autoload (defvar auto-revert-mode nil "Non-nil when Auto-Revert Mode is active. Never set this variable directly, use the command `auto-revert-mode' instead.") @@ -365,6 +363,9 @@ buffer.") "Non-nil when file has been modified on the file system. This has been reported by a file notification event.") +(defvar auto-revert-debug nil + "Use for debug messages.") + ;; Functions: (defun auto-revert-remove-current-buffer (&optional buffer) @@ -634,6 +635,8 @@ system.") ;; Since we watch a directory, a file name must be returned. (cl-assert (stringp file)) (when (eq action 'renamed) (cl-assert (stringp file1))) + (when auto-revert-debug + (message "auto-revert-notify-handler %S" event)) (if (eq action 'stopped) ;; File notification has stopped. Continue with polling. diff --git a/lisp/filenotify.el b/lisp/filenotify.el index 4d22061138..a6054c175f 100644 --- a/lisp/filenotify.el +++ b/lisp/filenotify.el @@ -30,6 +30,9 @@ (require 'cl-lib) (eval-when-compile (require 'subr-x)) +(defvar file-notify-debug nil + "Use for debug messages.") + (defconst file-notify--library (cond ((featurep 'inotify) 'inotify) @@ -93,7 +96,8 @@ If EVENT is a filewatch event, call its callback. It has the format Otherwise, signal a `file-notify-error'." (interactive "e") - ;;(message "file-notify-handle-event %S" event) + (when file-notify-debug + (message "file-notify-handle-event %S" event)) (if (and (consp event) (eq (car event) 'file-notify) (>= (length event) 3)) @@ -242,11 +246,12 @@ EVENT is the cadr of the event in `file-notify-handle-event' (string-equal (file-notify--watch-filename watch) (file-name-nondirectory file1))))) - ;;(message - ;;"file-notify-callback %S %S %S %S %S %S %S" - ;;desc action file file1 watch - ;;(file-notify--event-watched-file event) - ;;(file-notify--watch-directory watch)) + (when file-notify-debug + (message + "file-notify-callback %S %S %S %S %S %S %S" + desc action file file1 watch + (file-notify--event-watched-file event) + (file-notify--watch-directory watch))) (funcall (file-notify--watch-callback watch) (if file1 `(,desc ,action ,file ,file1) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index dc64726e21..37ff14a5eb 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3444,88 +3444,89 @@ the result will be a local, non-Tramp, file name." ;; any other remote command. (defun tramp-sh-handle-vc-registered (file) "Like `vc-registered' for Tramp files." - (with-temp-message "" - (with-parsed-tramp-file-name file nil - (with-tramp-progress-reporter - v 3 (format-message "Checking `vc-registered' for %s" file) - - ;; There could be new files, created by the vc backend. We - ;; cannot reuse the old cache entries, therefore. In - ;; `tramp-get-file-property', `remote-file-name-inhibit-cache' - ;; could also be a timestamp as `current-time' returns. This - ;; means invalidate all cache entries with an older timestamp. - (let (tramp-vc-registered-file-names - (remote-file-name-inhibit-cache (current-time)) - (file-name-handler-alist - `((,tramp-file-name-regexp . tramp-vc-file-name-handler)))) - - ;; Here we collect only file names, which need an operation. - (tramp-with-demoted-errors - v "Error in 1st pass of `vc-registered': %s" - (tramp-run-real-handler #'vc-registered (list file))) - (tramp-message v 10 "\n%s" tramp-vc-registered-file-names) - - ;; Send just one command, in order to fill the cache. - (when tramp-vc-registered-file-names - (tramp-maybe-send-script - v - (format tramp-vc-registered-read-file-names - (tramp-get-file-exists-command v) - (format "%s -r" (tramp-get-test-command v))) - "tramp_vc_registered_read_file_names") - - (dolist - (elt - (ignore-errors - ;; We cannot use `tramp-send-command-and-read', - ;; because this does not cooperate well with - ;; heredoc documents. - (tramp-send-command - v - (format - "tramp_vc_registered_read_file_names <<'%s'\n%s\n%s\n" - tramp-end-of-heredoc - (mapconcat #'tramp-shell-quote-argument - tramp-vc-registered-file-names - "\n") - tramp-end-of-heredoc)) - (with-current-buffer (tramp-get-connection-buffer v) - ;; Read the expression. - (goto-char (point-min)) - (read (current-buffer))))) - - (tramp-set-file-property - v (car elt) (cadr elt) (cadr (cdr elt)))))) - - ;; Second run. Now all `file-exists-p' or `file-readable-p' - ;; calls shall be answered from the file cache. We unset - ;; `process-file-side-effects' and `remote-file-name-inhibit-cache' - ;; in order to keep the cache. - (let ((vc-handled-backends vc-handled-backends) - remote-file-name-inhibit-cache process-file-side-effects) - ;; Reduce `vc-handled-backends' in order to minimize process calls. - (when (and (memq 'Bzr vc-handled-backends) - (boundp 'vc-bzr-program) - (not (with-tramp-connection-property v vc-bzr-program - (tramp-find-executable - v vc-bzr-program (tramp-get-remote-path v))))) - (setq vc-handled-backends (remq 'Bzr vc-handled-backends))) - (when (and (memq 'Git vc-handled-backends) - (boundp 'vc-git-program) - (not (with-tramp-connection-property v vc-git-program - (tramp-find-executable - v vc-git-program (tramp-get-remote-path v))))) - (setq vc-handled-backends (remq 'Git vc-handled-backends))) - (when (and (memq 'Hg vc-handled-backends) - (boundp 'vc-hg-program) - (not (with-tramp-connection-property v vc-hg-program - (tramp-find-executable - v vc-hg-program (tramp-get-remote-path v))))) - (setq vc-handled-backends (remq 'Hg vc-handled-backends))) - ;; Run. - (tramp-with-demoted-errors - v "Error in 2nd pass of `vc-registered': %s" - (tramp-run-real-handler #'vc-registered (list file)))))))) + (when vc-handled-backends + (with-temp-message "" + (with-parsed-tramp-file-name file nil + (with-tramp-progress-reporter + v 3 (format-message "Checking `vc-registered' for %s" file) + + ;; There could be new files, created by the vc backend. We + ;; cannot reuse the old cache entries, therefore. In + ;; `tramp-get-file-property', `remote-file-name-inhibit-cache' + ;; could also be a timestamp as `current-time' returns. This + ;; means invalidate all cache entries with an older timestamp. + (let (tramp-vc-registered-file-names + (remote-file-name-inhibit-cache (current-time)) + (file-name-handler-alist + `((,tramp-file-name-regexp . tramp-vc-file-name-handler)))) + + ;; Here we collect only file names, which need an operation. + (tramp-with-demoted-errors + v "Error in 1st pass of `vc-registered': %s" + (tramp-run-real-handler #'vc-registered (list file))) + (tramp-message v 10 "\n%s" tramp-vc-registered-file-names) + + ;; Send just one command, in order to fill the cache. + (when tramp-vc-registered-file-names + (tramp-maybe-send-script + v + (format tramp-vc-registered-read-file-names + (tramp-get-file-exists-command v) + (format "%s -r" (tramp-get-test-command v))) + "tramp_vc_registered_read_file_names") + + (dolist + (elt + (ignore-errors + ;; We cannot use `tramp-send-command-and-read', + ;; because this does not cooperate well with + ;; heredoc documents. + (tramp-send-command + v + (format + "tramp_vc_registered_read_file_names <<'%s'\n%s\n%s\n" + tramp-end-of-heredoc + (mapconcat #'tramp-shell-quote-argument + tramp-vc-registered-file-names + "\n") + tramp-end-of-heredoc)) + (with-current-buffer (tramp-get-connection-buffer v) + ;; Read the expression. + (goto-char (point-min)) + (read (current-buffer))))) + + (tramp-set-file-property + v (car elt) (cadr elt) (cadr (cdr elt)))))) + + ;; Second run. Now all `file-exists-p' or `file-readable-p' + ;; calls shall be answered from the file cache. We unset + ;; `process-file-side-effects' and `remote-file-name-inhibit-cache' + ;; in order to keep the cache. + (let ((vc-handled-backends vc-handled-backends) + remote-file-name-inhibit-cache process-file-side-effects) + ;; Reduce `vc-handled-backends' in order to minimize process calls. + (when (and (memq 'Bzr vc-handled-backends) + (boundp 'vc-bzr-program) + (not (with-tramp-connection-property v vc-bzr-program + (tramp-find-executable + v vc-bzr-program (tramp-get-remote-path v))))) + (setq vc-handled-backends (remq 'Bzr vc-handled-backends))) + (when (and (memq 'Git vc-handled-backends) + (boundp 'vc-git-program) + (not (with-tramp-connection-property v vc-git-program + (tramp-find-executable + v vc-git-program (tramp-get-remote-path v))))) + (setq vc-handled-backends (remq 'Git vc-handled-backends))) + (when (and (memq 'Hg vc-handled-backends) + (boundp 'vc-hg-program) + (not (with-tramp-connection-property v vc-hg-program + (tramp-find-executable + v vc-hg-program (tramp-get-remote-path v))))) + (setq vc-handled-backends (remq 'Hg vc-handled-backends))) + ;; Run. + (tramp-with-demoted-errors + v "Error in 2nd pass of `vc-registered': %s" + (tramp-run-real-handler #'vc-registered (list file))))))))) ;;;###tramp-autoload (defun tramp-sh-file-name-handler (operation &rest args) diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index 6e8219d238..d98c11658f 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -19,6 +19,33 @@ ;;; Commentary: +;; Some of the tests require access to a remote host files. Since +;; this could be problematic, a mock-up connection method "mock" is +;; used. Emulating a remote connection, it simply calls "sh -i". +;; Tramp's file name handlers still run, so this test is sufficient +;; except for connection establishing. + +;; If you want to test a real Tramp connection, set +;; $REMOTE_TEMPORARY_FILE_DIRECTORY to a suitable value in order to +;; overwrite the default value. If you want to skip tests accessing a +;; remote host, set this environment variable to "/dev/null" or +;; whatever is appropriate on your system. + +;; For the remote file-notify library, Tramp checks for the existence +;; of a respective command. The first command found is used. In +;; order to use a dedicated one, the environment variable +;; $REMOTE_FILE_NOTIFY_LIBRARY shall be set, possible values are +;; "inotifywait", "gio-monitor" and "gvfs-monitor-dir". + +;; Local file-notify libraries are auto-detected during Emacs +;; configuration. This can be changed with a respective configuration +;; argument, like +;; +;; --with-file-notification=inotify +;; --with-file-notification=kqueue +;; --with-file-notification=gfile +;; --with-file-notification=w32 + ;; A whole test run can be performed calling the command `auto-revert-test-all'. ;;; Code: @@ -26,8 +53,14 @@ (require 'ert) (require 'ert-x) (require 'autorevert) -(setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded" - auto-revert-stop-on-user-input nil) +(require 'tramp) + +(setq auto-revert-debug nil + auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded" + auto-revert-stop-on-user-input nil + file-notify-debug nil + tramp-verbose 0 + tramp-message-show-message nil) (defconst auto-revert--timeout 10 "Time to wait for a message.") @@ -35,19 +68,88 @@ (defvar auto-revert--messages nil "Used to collect messages issued during a section of a test.") +;; There is no default value on w32 systems, which could work out of the box. +(defconst auto-revert-test-remote-temporary-file-directory + (cond + ((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY")) + ((eq system-type 'windows-nt) null-device) + (t (add-to-list + 'tramp-methods + '("mock" + (tramp-login-program "sh") + (tramp-login-args (("-i"))) + (tramp-remote-shell "/bin/sh") + (tramp-remote-shell-args ("-c")) + (tramp-connection-timeout 10))) + (add-to-list + 'tramp-default-host-alist + `("\\`mock\\'" nil ,(system-name))) + ;; Emacs' Makefile sets $HOME to a nonexistent value. Needed in + ;; batch mode only, therefore. `temporary-file-directory' might + ;; be quoted, so we unquote it just in case. + (unless (and (null noninteractive) (file-directory-p "~/")) + (setenv "HOME" (file-name-unquote temporary-file-directory))) + (format "/mock::%s" temporary-file-directory))) + "Temporary directory for Tramp tests.") + +;; Filter suppressed remote file-notify libraries. +(when (stringp (getenv "REMOTE_FILE_NOTIFY_LIBRARY")) + (dolist (lib '("inotifywait" "gio-monitor" "gvfs-monitor-dir")) + (unless (string-equal (getenv "REMOTE_FILE_NOTIFY_LIBRARY") lib) + (add-to-list 'tramp-connection-properties `(nil ,lib nil))))) + +(defvar auto-revert--test-enabled-remote-checked nil + "Cached result of `auto-revert--test-enabled-remote'. +If the function did run, the value is a cons cell, the `cdr' +being the result.") + +(defun auto-revert--test-enabled-remote () + "Whether remote file access is enabled." + (unless (consp auto-revert--test-enabled-remote-checked) + (setq + auto-revert--test-enabled-remote-checked + (cons + t (ignore-errors + (and + (file-remote-p auto-revert-test-remote-temporary-file-directory) + (file-directory-p auto-revert-test-remote-temporary-file-directory) + (file-writable-p + auto-revert-test-remote-temporary-file-directory)))))) + ;; Return result. + (cdr auto-revert--test-enabled-remote-checked)) + (defun auto-revert--wait-for-revert (buffer) "Wait until a message reports reversion of BUFFER. This expects `auto-revert--messages' to be bound by `ert-with-message-capture' before calling." - (with-timeout (auto-revert--timeout nil) - (while - (null (string-match - (format-message "Reverting buffer `%s'." (buffer-name buffer)) - auto-revert--messages)) + ;; Remote files do not cooperate well with timers. So we count ourselves. + (let ((ct (current-time))) + (while (and (< (float-time (time-subtract (current-time) ct)) + auto-revert--timeout) + (null (string-match + (format-message + "Reverting buffer `%s'\\." (buffer-name buffer)) + auto-revert--messages))) (if (with-current-buffer buffer auto-revert-use-notify) (read-event nil nil 0.1) (sleep-for 0.1))))) +(defmacro auto-revert--deftest-remote (test docstring) + "Define ert `TEST-remote' for remote files." + (declare (indent 1)) + `(ert-deftest ,(intern (concat (symbol-name test) "-remote")) () + ,docstring + :tags '(:expensive-test) + (let ((temporary-file-directory + auto-revert-test-remote-temporary-file-directory) + (auto-revert-remote-files t) + (ert-test (ert-get-test ',test)) + vc-handled-backends) + (skip-unless (auto-revert--test-enabled-remote)) + (tramp-cleanup-connection + (tramp-dissect-file-name temporary-file-directory) nil 'keep-password) + (funcall (ert-test-body ert-test))))) + (ert-deftest auto-revert-test00-auto-revert-mode () "Check autorevert for a file." ;; `auto-revert-buffers' runs every 5". And we must wait, until the @@ -93,13 +195,16 @@ This expects `auto-revert--messages' to be bound by (kill-buffer buf)) (ignore-errors (delete-file tmpfile))))) +(auto-revert--deftest-remote auto-revert-test00-auto-revert-mode + "Check autorevert for a remote file.") + ;; This is inspired by Bug#21841. (ert-deftest auto-revert-test01-auto-revert-several-files () "Check autorevert for several files at once." :tags '(:expensive-test) - (skip-unless (executable-find "cp")) + (skip-unless (executable-find "cp" (file-remote-p temporary-file-directory))) - (let* ((cp (executable-find "cp")) + (let* ((cp (executable-find "cp" (file-remote-p temporary-file-directory))) (tmpdir1 (make-temp-file "auto-revert-test" 'dir)) (tmpdir2 (make-temp-file "auto-revert-test" 'dir)) (tmpfile1 @@ -139,7 +244,9 @@ This expects `auto-revert--messages' to be bound by ;; Strange, that `copy-directory' does not work as expected. ;; The following shell command is not portable on all ;; platforms, unfortunately. - (shell-command (format "%s -f %s/* %s" cp tmpdir2 tmpdir1)) + (shell-command + (format "%s -f %s/* %s" + cp (file-local-name tmpdir2) (file-local-name tmpdir1))) ;; Check, that the buffers have been reverted. (dolist (buf (list buf1 buf2)) @@ -155,6 +262,9 @@ This expects `auto-revert--messages' to be bound by (ignore-errors (delete-directory tmpdir1 'recursive)) (ignore-errors (delete-directory tmpdir2 'recursive))))) +(auto-revert--deftest-remote auto-revert-test01-auto-revert-several-files + "Check autorevert for several remote files at once.") + ;; This is inspired by Bug#23276. (ert-deftest auto-revert-test02-auto-revert-deleted-file () "Check autorevert for a deleted file." @@ -185,8 +295,8 @@ This expects `auto-revert--messages' to be bound by (add-hook 'before-revert-hook (lambda () - ;; Temporarily. - (message "%s deleted" buffer-file-name) + (when auto-revert-debug + (message "%s deleted" buffer-file-name)) (delete-file buffer-file-name)) nil t) @@ -199,7 +309,9 @@ This expects `auto-revert--messages' to be bound by ;; polling. (should (string-match "any text" (buffer-string))) ;; With w32notify, the 'stopped' events are not sent. + ;; Same for remote file name handlers. Why? (or (eq file-notify--library 'w32notify) + (file-remote-p temporary-file-directory) (should-not auto-revert-notify-watch-descriptor)) ;; Once the file has been recreated, the buffer shall be @@ -231,6 +343,9 @@ This expects `auto-revert--messages' to be bound by (kill-buffer buf)) (ignore-errors (delete-file tmpfile))))) +(auto-revert--deftest-remote auto-revert-test02-auto-revert-deleted-file + "Check autorevert for a deleted remote file.") + (ert-deftest auto-revert-test03-auto-revert-tail-mode () "Check autorevert tail mode." ;; `auto-revert-buffers' runs every 5". And we must wait, until the @@ -266,6 +381,9 @@ This expects `auto-revert--messages' to be bound by (ignore-errors (kill-buffer buf)) (ignore-errors (delete-file tmpfile))))) +(auto-revert--deftest-remote auto-revert-test03-auto-revert-tail-mode + "Check remote autorevert tail mode.") + (ert-deftest auto-revert-test04-auto-revert-mode-dired () "Check autorevert for dired." ;; `auto-revert-buffers' runs every 5". And we must wait, until the @@ -314,6 +432,9 @@ This expects `auto-revert--messages' to be bound by (kill-buffer buf)) (ignore-errors (delete-file tmpfile))))) +(auto-revert--deftest-remote auto-revert-test04-auto-revert-mode-dired + "Check remote autorevert for dired.") + (defun auto-revert-test-all (&optional interactive) "Run all tests for \\[auto-revert]." (interactive "p") diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index a40dc72078..af2d0b33e0 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -195,7 +195,8 @@ Return nil when any other file notification watch is still active." file-notify--test-events nil file-notify--test-monitors nil)) -(setq password-cache-expiry nil +(setq file-notify-debug nil + password-cache-expiry nil tramp-verbose 0 tramp-message-show-message nil) @@ -515,8 +516,9 @@ and the event to `file-notify--test-events'." (unless (string-match (regexp-quote ".#") (file-notify--event-file-name file-notify--test-event)) - ;;(message "file-notify--test-event-handler result: %s event: %S" - ;;(null (ert-test-failed-p result)) file-notify--test-event) + (when file-notify-debug + (message "file-notify--test-event-handler result: %s event: %S" + (null (ert-test-failed-p result)) file-notify--test-event)) (setq file-notify--test-events (append file-notify--test-events `(,file-notify--test-event)) file-notify--test-results commit 24a1d5a0b5c0debd8256d71242bfa6f8448bf5af Author: Basil L. Contovounesios Date: Thu May 2 22:06:02 2019 +0100 Fix Gnus inline attachment decoding (bug#35507) Proposed by Andy Moreton and Noam Postavsky . * lisp/gnus/mm-view.el (mm-display-inline-fontify): Always decode handle text, falling back on 'undecided' coding system. diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el index 1e1d264b99..849488293a 100644 --- a/lisp/gnus/mm-view.el +++ b/lisp/gnus/mm-view.el @@ -472,10 +472,8 @@ If MODE is not set, try to find mode automatically." (buffer-string))) (coding-system (decode-coding-string text coding-system)) - (charset - (mm-decode-string text charset)) - (t - text))) + (t + (mm-decode-string text (or charset 'undecided))))) (let ((font-lock-verbose nil) ; font-lock is a bit too verbose. (enable-local-variables nil)) ;; We used to set font-lock-mode-hook to nil to avoid enabling commit b663c8372495eb98eec15fea463635f4a4da2fad Author: Stefan Monnier Date: Fri May 3 09:49:38 2019 -0400 * lisp/server.el: Cosmetic changes Remove redundant :group args. (server-temp-file-regexp): Fix ^$ to \`\'. diff --git a/lisp/server.el b/lisp/server.el index 1e5c57a1c5..d8c7c313ef 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -96,7 +96,6 @@ (unless load-in-progress (message "Local sockets unsupported, using TCP sockets"))) (set-default sym val)) - :group 'server :type 'boolean :version "22.1") @@ -108,7 +107,6 @@ DO NOT give this a non-nil value unless you know what you are doing! On unsecured networks, accepting remote connections is very dangerous, because server-client communication (including session authentication) is not encrypted." - :group 'server :type '(choice (string :tag "Name or IP address") (const :tag "Local" nil)) @@ -121,7 +119,6 @@ is not encrypted." This variable only takes effect when the Emacs server is using TCP instead of local sockets. A nil value means to use a random port number." - :group 'server :type '(choice (string :tag "Port number") (const :tag "Random" nil)) @@ -138,7 +135,6 @@ NOTE: On FAT32 filesystems, directories are not secure; files can be read and modified by any user or process. It is strongly suggested to set `server-auth-dir' to a directory residing in a NTFS partition instead." - :group 'server :type 'directory :version "22.1") ;;;###autoload @@ -166,7 +162,6 @@ communications are unencrypted, still apply. The key must consist of 64 ASCII printable characters except for space (this means characters from ! to ~; or from code 33 to 126). You can use \\[server-generate-key] to get a random key." - :group 'server :type '(choice (const :tag "Random" nil) (string :tag "Password")) @@ -174,30 +169,25 @@ space (this means characters from ! to ~; or from code 33 to (defcustom server-raise-frame t "If non-nil, raise frame when switching to a buffer." - :group 'server :type 'boolean :version "22.1") (defcustom server-visit-hook nil "Hook run when visiting a file for the Emacs server." - :group 'server :type 'hook) (defcustom server-switch-hook nil "Hook run when switching to a buffer for the Emacs server." - :group 'server :type 'hook) (defcustom server-after-make-frame-hook nil "Hook run when the Emacs server creates a client frame. The created frame is selected when the hook is called." - :group 'server :type 'hook :version "27.1") (defcustom server-done-hook nil "Hook run when done editing a buffer for the Emacs server." - :group 'server :type 'hook) (defvar server-process nil @@ -223,7 +213,6 @@ If it is a frame, use the frame's selected window. It is not meaningful to set this to a specific frame or window with Custom. Only programs can do so." - :group 'server :version "22.1" :type '(choice (const :tag "Use selected window" :match (lambda (widget value) @@ -233,11 +222,10 @@ Only programs can do so." (function-item :tag "Use pop-to-buffer" pop-to-buffer) (function :tag "Other function"))) -(defcustom server-temp-file-regexp "^/tmp/Re\\|/draft$" +(defcustom server-temp-file-regexp "\\`/tmp/Re\\|/draft\\'" "Regexp matching names of temporary files. These are deleted and reused after each edit by the programs that invoke the Emacs server." - :group 'server :type 'regexp) (defcustom server-kill-new-buffers t @@ -248,7 +236,6 @@ it with the Emacs server. If nil, kill only buffers as specified by Please note that only buffers that still have a client are killed, i.e. buffers visited with \"emacsclient --no-wait\" are never killed in this way." - :group 'server :type 'boolean :version "21.1") @@ -278,7 +265,6 @@ If this is an absolute file name, it specifies where the socket file will be created. To have emacsclient connect to the same socket, use the \"-s\" switch for local non-TCP sockets, and the \"-f\" switch otherwise." - :group 'server :type 'string :version "23.1") @@ -381,7 +367,7 @@ Updates `server-clients'." (server-log "Deleted" proc)))) -(defvar server-log-time-function 'current-time-string +(defvar server-log-time-function #'current-time-string "Function to generate timestamps for `server-buffer'.") (defconst server-buffer " *server*" @@ -549,6 +535,16 @@ Creates the directory if necessary and makes sure: (cl-letf (((default-file-modes) ?\700)) (make-directory dir t)) (setq attrs (file-attributes dir 'integer))) + (let ((olddir (or (getenv "TMPDIR") "/tmp"))) + (when (and (equal dir (format "%s/emacs" (getenv "XDG_RUNTIME_DIR"))) + (file-writable-p olddir)) + (let ((link (format "%s/emacs%d" olddir (user-uid)))) + (unless (file-directory-p link) + ;; We're using the new location, so try and setup a symlink from + ;; the old location, in case we want to use an old emacsclient. + ;; FIXME: Check that it's safe to use! + (make-symbolic-link dir link t))))) + ;; Check that it's safe for use. (let* ((uid (file-attribute-user-id attrs)) (w32 (eq system-type 'windows-nt)) @@ -684,16 +680,16 @@ server or call `\\[server-force-delete]' to forcibly disconnect it.")) (when server-process (server-log (message "Restarting server"))) (cl-letf (((default-file-modes) ?\700)) - (add-hook 'suspend-tty-functions 'server-handle-suspend-tty) - (add-hook 'delete-frame-functions 'server-handle-delete-frame) + (add-hook 'suspend-tty-functions #'server-handle-suspend-tty) + (add-hook 'delete-frame-functions #'server-handle-delete-frame) (add-hook 'kill-emacs-query-functions - 'server-kill-emacs-query-function) + #'server-kill-emacs-query-function) ;; We put server's kill-emacs-hook after the others, so that ;; frames are not deleted too early, because doing that ;; would severely degrade our abilities to communicate with ;; the user, while some hooks may wish to ask the user ;; questions (e.g., desktop-kill). - (add-hook 'kill-emacs-hook 'server-force-stop t) ;Cleanup upon exit. + (add-hook 'kill-emacs-hook #'server-force-stop t) ;Cleanup upon exit. (setq server-process (apply #'make-network-process :name server-name @@ -792,7 +788,6 @@ Server mode runs a process that accepts commands from the `emacsclient' program. See Info node `Emacs server' and `server-start' for details." :global t - :group 'server :version "22.1" ;; Fixme: Should this check for an existing server socket and do ;; nothing if there is one (for multiple Emacs sessions)? @@ -1118,7 +1113,7 @@ The following commands are accepted by the client: ;; Remove this line from STRING. (setq string (substring string (match-end 0))) (setq args-left - (mapcar 'server-unquote-arg (split-string request " " t))) + (mapcar #'server-unquote-arg (split-string request " " t))) (while args-left (pcase (pop args-left) ;; -version CLIENT-VERSION: obsolete at birth. @@ -1341,7 +1336,7 @@ The following commands are accepted by the client: (when initial-buffer (switch-to-buffer initial-buffer 'norecord)))))) - (mapc 'funcall (nreverse commands)) + (mapc #'funcall (nreverse commands)) ;; Delete the client if necessary. (cond @@ -1441,7 +1436,7 @@ so don't mark these buffers specially, just visit them normally." (run-hooks 'post-command-hook)) (unless nowait ;; When the buffer is killed, inform the clients. - (add-hook 'kill-buffer-hook 'server-kill-buffer nil t) + (add-hook 'kill-buffer-hook #'server-kill-buffer nil t) (push proc server-buffer-clients)) (push (current-buffer) client-record))) (unless nowait @@ -1552,8 +1547,8 @@ specifically for the clients and did not exist before their request for it." "Ask before exiting Emacs if it has live clients." (or (not (let (live-client) (dolist (proc server-clients) - (when (memq t (mapcar 'buffer-live-p (process-get - proc 'buffers))) + (when (memq t (mapcar #'buffer-live-p + (process-get proc 'buffers))) (setq live-client t))) live-client)) (yes-or-no-p "This Emacs session has clients; exit anyway? "))) @@ -1589,7 +1584,7 @@ starts server process and that is all. Invoked by \\[server-edit]." (not server-process) (memq (process-status server-process) '(signal exit))) (server-mode 1)) - (server-clients (apply 'server-switch-buffer (server-done))) + (server-clients (apply #'server-switch-buffer (server-done))) (t (message "No server editing buffers exist")))) (defun server-switch-buffer (&optional next-buffer killed-one filepos) @@ -1622,7 +1617,7 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)." (if (not (buffer-live-p next-buffer)) ;; If NEXT-BUFFER is a dead buffer, remove the server records for it ;; and try the next surviving server buffer. - (apply 'server-switch-buffer (server-buffer-done next-buffer)) + (apply #'server-switch-buffer (server-buffer-done next-buffer)) ;; OK, we know next-buffer is live, let's display and select it. (if (functionp server-window) (funcall server-window next-buffer) @@ -1701,7 +1696,7 @@ only these files will be asked to be saved." (save-current-buffer (dolist (buffer (buffer-list)) (set-buffer buffer) - (remove-hook 'kill-buffer-hook 'server-kill-buffer t))) + (remove-hook 'kill-buffer-hook #'server-kill-buffer t))) ;; continue standard unloading nil) commit d5497ec3096b3ff42fd1028b5a677cafa6386712 Author: Eli Zaretskii Date: Fri May 3 12:22:55 2019 +0300 Improve documentation of 'isearch-regexp-function' * lisp/isearch.el (isearch-regexp-function): Doc fix. (Bug#35498) diff --git a/lisp/isearch.el b/lisp/isearch.el index 6280afebdc..bb29c2914b 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -832,12 +832,20 @@ This is like `describe-bindings', but displays only Isearch keys." 'isearch-regexp-function "25.1") (defvar isearch-regexp-function nil "Regexp-based search mode for words/symbols. -If the value is a function (e.g. `isearch-symbol-regexp'), it is -called to convert a plain search string to a regexp used by -regexp search functions. +If non-nil, a function to convert a search string to a regexp +used by regexp search functions. + +The function should accept 1 or 2 arguments: the original string +to convert, and a flag, whose non-nil value means the match +doesn't have to start or end on a word boundary. The function +should return the corresponding regexp, a string. + The symbol property `isearch-message-prefix' put on this function specifies the prefix string displayed in the search message. +Existing functions you could use as values are `word-search-regexp', +`isearch-symbol-regexp', and `char-fold-to-regexp'. + This variable is set and changed during isearch. To change the default behavior used for searches, see `search-default-mode' instead.")