commit f113ae59222dbb0961a34c1e0913cf0f3104a567 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Sun Oct 13 10:59:18 2019 +0300 ; Minor copyedits in a recent ELisp manual change. * doc/lispref/tips.texi (Coding Conventions): Make the guideline against '-p' in variable names less mandatory and more constructive. diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index 9f6420949d..eb03816475 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -158,9 +158,10 @@ If the purpose of a function is to tell you whether a certain condition is true or false, give the function a name that ends in @samp{p} (which stands for ``predicate''). If the name is one word, add just @samp{p}; if the name is multiple words, add @samp{-p}. -Examples are @code{framep} and @code{frame-live-p}. This predicate -suffix should not be used in variable names (i.e., you should name a -variable @code{foo-feature} instead of @code{foo-feature-p}). +Examples are @code{framep} and @code{frame-live-p}. We recommend to +avoid using this @code{-p} suffix in boolean variable names, unless +the variable is bound to a predicate function; instead, use a +@code{-flag} suffix or names like @code{is-foo}. @item If the purpose of a variable is to store a single function, give it a commit 0fcd6e320dbb7ee7614d432b7d6b5fca5b8960bc Author: Eli Zaretskii Date: Sun Oct 13 10:50:30 2019 +0300 ; Fix recent additions to ELisp manual * doc/lispref/files.texi (Contents of Directories): Fix recently added documentation of 'locate-dominating-file'. diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 130282c582..32297e9875 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -2923,8 +2923,8 @@ An error is signaled if @var{directory} is not the name of a directory that can be read. @end defun +@cindex recursive traverse of directory tree @defun directory-files-recursively directory regexp &optional include-directories predicate follow-symlinks -@cindex recursing downwards in directories Return all files under @var{directory} whose names match @var{regexp}. This function searches the specified @var{directory} and its sub-directories, recursively, for files whose basenames (i.e., without @@ -2950,17 +2950,23 @@ Symbolic links to subdirectories are not followed by default, but if @var{follow-symlinks} is non-@code{nil}, they are followed. @end defun + @defun locate-dominating-file file name -@cindex recursing upwards in directories -Starting at @var{file}, recurse up the directory hierarchy looking for -the first directory where @var{name} exists, which is then the return -value of this function. @var{file} can be a file or a directory. If -it's a file, its directory will serve as the starting point for -searching the hierarchy of directories. - -@code{name} can be either a string or a predicate. The predicate -takes one argument (the directory) and should return non-@code{nil} if -we've found the directory we're looking for. +Starting at @var{file}, go up the directory tree hierarchy looking for +the first directory where @var{name}, a string, exists, and return that +directory. If @var{file} is a file, its directory will serve as the +starting point for the search; otherwise @var{file} should be a +directory from which to start. The function looks in the starting +directory, then in its parent, then in its parent's parent, etc., +until it either finds a directory with @var{name} or reaches the root +directory of the filesystem without finding @var{name} -- in the +latter case the function returns @code{nil}. + +The argument @code{name} can also be a predicate function. The +predicate is called for every directory examined by the function, +starting from @var{file} (even if @var{file} is not a directory). It +is called with one argument (the file or directory) and should return +non-@code{nil} if that directory is the one it is looking for. @end defun @defun directory-files-and-attributes directory &optional full-name match-regexp nosort id-format commit f4424ca11f256f4dc7b44b1eddc3f9b0a82e14ce Author: Lars Ingebrigtsen Date: Sun Oct 13 07:14:03 2019 +0200 Make the previous-matching-history-element prompt clearer * lisp/simple.el (previous-matching-history-element): Put the default into the prompt (bug#380). diff --git a/lisp/simple.el b/lisp/simple.el index 44ab8e125d..4d80c4c1b4 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2002,12 +2002,15 @@ makes the search case-sensitive. See also `minibuffer-history-case-insensitive-variables'." (interactive (let* ((enable-recursive-minibuffers t) - (regexp (read-from-minibuffer "Previous element matching (regexp): " - nil - minibuffer-local-map - nil - 'minibuffer-history-search-history - (car minibuffer-history-search-history)))) + (regexp (read-from-minibuffer + (format "Previous element matching regexp%s: " + (if minibuffer-history-search-history + (format " (default %s)" + (car minibuffer-history-search-history)) + "")) + nil minibuffer-local-map nil + 'minibuffer-history-search-history + (car minibuffer-history-search-history)))) ;; Use the last regexp specified, by default, if input is empty. (list (if (string= regexp "") (if minibuffer-history-search-history commit f0002b2d84d7605d113b0b8124959e23f90d1b08 Author: Konstantin Kharlamov Date: Sun Oct 13 05:52:21 2019 +0200 Make diff-mode understand git-format-patch separators * lisp/vc/diff-mode.el (diff-prev-line-if-patch-separator): A function to return prev. line if it has git-format-patch separator. (diff-end-of-hunk): Make use of diff-prev-line-if-patch-separator diff-buffer-type: whether a buffer is a git-diff (define-derived-mode): set diff-buffer-type to appropriate value (bug#37395). diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 19f9c802d4..c86f15cee0 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -504,6 +504,7 @@ See https://lists.gnu.org/r/emacs-devel/2007-11/msg01990.html") (defconst diff-separator-re "^--+ ?$") (defvar diff-narrowed-to nil) +(defvar diff-buffer-type nil) (defun diff-hunk-style (&optional style) (when (looking-at diff-hunk-header-re) @@ -511,6 +512,18 @@ See https://lists.gnu.org/r/emacs-devel/2007-11/msg01990.html") (goto-char (match-end 0))) style) +(defun diff-prev-line-if-patch-separator () + "Return previous line if it has patch separator as produced by git." + (pcase diff-buffer-type + ('git + (save-excursion + (let ((old-point (point))) + (forward-line -1) + (if (looking-at "^-- $") + (point) + old-point)))) + (_ (point)))) + (defun diff-end-of-hunk (&optional style donttrustheader) "Advance to the end of the current hunk, and return its position." (let (end) @@ -561,7 +574,8 @@ See https://lists.gnu.org/r/emacs-devel/2007-11/msg01990.html") (goto-char (or end (point-max))) (while (eq ?\n (char-before (1- (point)))) (forward-char -1) - (setq end (point))))) + (setq end (point)))) + (setq end (diff-prev-line-if-patch-separator))) ;; The return value is used by easy-mmode-define-navigation. (goto-char (or end (point-max))))) @@ -1491,7 +1505,12 @@ a diff with \\[diff-reverse-direction]. (add-function :filter-return (local 'filter-buffer-substring-function) #'diff--filter-substring) (unless buffer-file-name - (hack-dir-local-variables-non-file-buffer))) + (hack-dir-local-variables-non-file-buffer)) + (save-excursion + (setq-local diff-buffer-type + (if (re-search-forward "^diff --git" nil t) + 'git + nil)))) ;;;###autoload (define-minor-mode diff-minor-mode commit 518ff50f7a245f437576c5f7e716be9cba336287 Author: Rolf Ade Date: Sun Oct 13 05:18:36 2019 +0200 TCL indentation fix outside functions * lisp/progmodes/tcl.el (tcl-calculate-indent): Indent code correctly outside of function definitions (bug#23565). Copyright-paperwork-exempt: yes diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el index 0fd3d6d1bf..0788725055 100644 --- a/lisp/progmodes/tcl.el +++ b/lisp/progmodes/tcl.el @@ -815,9 +815,14 @@ Returns nil if line starts inside a string, t if in a comment." state containing-sexp found-next-line) - (if parse-start - (goto-char parse-start) - (beginning-of-defun)) + (cond + (parse-start + (goto-char parse-start)) + ((not (beginning-of-defun)) + ;; If we're not in a function, don't use + ;; `tcl-beginning-of-defun-function'. + (let ((beginning-of-defun-function nil)) + (beginning-of-defun)))) (while (< (point) indent-point) (setq parse-start (point)) (setq state (parse-partial-sexp (point) indent-point 0)) commit de88ed8646383301f20f8340e13d43e5918310fa Author: Lars Ingebrigtsen Date: Sun Oct 13 05:15:18 2019 +0200 Hide passwords more in `read-password' * lisp/subr.el (read-password--hide-password): Factor out (bug#17127). (read-passwd): Use it in post-command-hook instead of after-change-functions to ensure that we hide the password no matter what inserts text. diff --git a/lisp/subr.el b/lisp/subr.el index 76b0e4b394..1a4a2e8b81 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2463,6 +2463,12 @@ some sort of escape sequence, the ambiguity is resolved via `read-key-delay'." map) "Keymap used while reading passwords.") +(defun read-password--hide-password () + (let ((beg (minibuffer-prompt-end))) + (dotimes (i (1+ (- (buffer-size) beg))) + (put-text-property (+ i beg) (+ 1 i beg) + 'display (string (or read-hide-char ?*)))))) + (defun read-passwd (prompt &optional confirm default) "Read a password, prompting with PROMPT, and return it. If optional CONFIRM is non-nil, read the password twice to make sure. @@ -2487,15 +2493,7 @@ by doing (clear-string STRING)." (message "Password not repeated accurately; please start over") (sit-for 1)))) success) - (let ((hide-chars-fun - (lambda (beg end _len) - (clear-this-command-keys) - (setq beg (min end (max (minibuffer-prompt-end) - beg))) - (dotimes (i (- end beg)) - (put-text-property (+ i beg) (+ 1 i beg) - 'display (string (or read-hide-char ?*)))))) - minibuf) + (let (minibuf) (minibuffer-with-setup-hook (lambda () (setq minibuf (current-buffer)) @@ -2506,7 +2504,7 @@ by doing (clear-string STRING)." (use-local-map read-passwd-map) (setq-local inhibit-modification-hooks nil) ;bug#15501. (setq-local show-paren-mode nil) ;bug#16091. - (add-hook 'after-change-functions hide-chars-fun nil 'local)) + (add-hook 'post-command-hook 'read-password--hide-password nil t)) (unwind-protect (let ((enable-recursive-minibuffers t) (read-hide-char (or read-hide-char ?*))) @@ -2516,7 +2514,8 @@ by doing (clear-string STRING)." ;; Not sure why but it seems that there might be cases where the ;; minibuffer is not always properly reset later on, so undo ;; whatever we've done here (bug#11392). - (remove-hook 'after-change-functions hide-chars-fun 'local) + (remove-hook 'after-change-functions 'read-password--hide-password + 'local) (kill-local-variable 'post-self-insert-hook) ;; And of course, don't keep the sensitive data around. (erase-buffer)))))))) commit 4d74b2b9539964758fc433480ad93ce912b6f3db Author: Andreas Politz Date: Sun Oct 13 05:08:37 2019 +0200 Use quit-window in some functions * lisp/strokes.el: * lisp/startup.el (fancy-startup-tail): * lisp/progmodes/verilog-mode.el (verilog-complete-word) (verilog-show-completions): * lisp/progmodes/idlwave.el (idlwave-quit-help): Use `quit-window' (bug#24213). diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index 1b4b55c94f..3535a7b4aa 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -8271,7 +8271,7 @@ If we do not know about MODULE, just return KEYWORD literally." (select-window olh-window) (idlwave-help-quit)) (when (window-live-p ri-window) - (delete-window ri-window)))) + (quit-window nil ri-window)))) (defun idlwave-display-calling-sequence (name type class &optional initial-class) diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index baeaf8b95d..5bfa5f837a 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -7598,8 +7598,7 @@ and `verilog-separator-keywords'.)" (display-completion-list allcomp)) ;; Wait for a key press. Then delete *Completion* window (momentary-string-display "" (point)) - (delete-window (get-buffer-window (get-buffer "*Completions*"))) - ))))) + (quit-window nil (get-buffer-window "*Completions*"))))))) (defun verilog-show-completions () "Show all possible completions at current point." @@ -7611,7 +7610,8 @@ and `verilog-separator-keywords'.)" (display-completion-list (nth 2 (verilog-completion-at-point)))) ;; Wait for a key press. Then delete *Completion* window (momentary-string-display "" (point)) - (delete-window (get-buffer-window (get-buffer "*Completions*")))) + (quit-window nil (get-buffer-window "*Completions*"))) + (defun verilog-get-default-symbol () "Return symbol around current point as a string." diff --git a/lisp/startup.el b/lisp/startup.el index 393d787256..48b483415a 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1856,9 +1856,7 @@ a face or button specification." (customize-set-variable 'inhibit-startup-screen t) (customize-mark-to-save 'inhibit-startup-screen) (custom-save-all)) - (let ((w (get-buffer-window "*GNU Emacs*"))) - (and w (not (one-window-p)) (delete-window w))) - (kill-buffer "*GNU Emacs*"))) + (quit-windows-on "*GNU Emacs*" t))) " ") (when (or user-init-file custom-file) (let ((checked (create-image "checked.xpm" diff --git a/lisp/strokes.el b/lisp/strokes.el index 6edf58c7b6..2c88b1eefd 100644 --- a/lisp/strokes.el +++ b/lisp/strokes.el @@ -1216,9 +1216,7 @@ the stroke as a character in some language." ;;(defun strokes-edit-quit () ;; (interactive) -;; (or (one-window-p t 0) -;; (delete-window)) -;; (kill-buffer "*Strokes List*")) +;; (quit-windows-on "*Strokes List*" t)) ;;(define-derived-mode edit-strokes-mode list-mode ;; "Edit-Strokes" commit e1a4ed67b3cf232c7a05169db32141ca0a682a11 Author: Lars Ingebrigtsen Date: Sun Oct 13 04:59:44 2019 +0200 Add -unknown to version-regexp-alist * lisp/epg-config.el (epg-find-configuration): Remove the -unknown hack, because it led to further problems later when comparing versions. * lisp/subr.el (version-regexp-alist): Rate -unknown versions the same as -alpha releases (bug#37556). diff --git a/lisp/epg-config.el b/lisp/epg-config.el index 4a9cc7744c..54328290c8 100644 --- a/lisp/epg-config.el +++ b/lisp/epg-config.el @@ -148,11 +148,7 @@ Otherwise, it tries the programs listed in the entry until the version requirement is met." (unless program-alist (setq program-alist epg-config--program-alist)) - (let ((entry (assq protocol program-alist)) - ;; In many gnupg distributions (especially on Windows), the - ;; version string is "gpg (GnuPG) 2.2.15-unknown" or the like. - (version-regexp-alist (cons '("^[-._+ ]?unknown$" . -4) - version-regexp-alist))) + (let ((entry (assq protocol program-alist))) (unless entry (error "Unknown protocol %S" protocol)) (cl-destructuring-bind (symbol . alist) diff --git a/lisp/subr.el b/lisp/subr.el index e50a52e2f5..76b0e4b394 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -5325,6 +5325,8 @@ Usually the separator is \".\", but it can be any other string.") ("^[-._+]$" . -4) ;; treat "1.2.3-CVS" as snapshot release ("^[-._+ ]?\\(cvs\\|git\\|bzr\\|svn\\|hg\\|darcs\\)$" . -4) + ;; treat "-unknown" the same as snapshots. + ("^[-._+ ]?unknown$" . -4) ("^[-._+ ]?alpha$" . -3) ("^[-._+ ]?beta$" . -2) ("^[-._+ ]?\\(pre\\|rc\\)$" . -1)) commit db443618eae74822f96d9adc3c7152355ac749b3 Author: Raimon Grau Date: Sun Oct 13 04:26:39 2019 +0200 Add "next" and "previous" shortcuts in eww-history buffers * lisp/net/eww.el (eww-history-mode-map): Add "n" and "p" for "next-line" and "previous-line" (bug#37648). diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 0756c6088b..f5dedd52b2 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1919,8 +1919,8 @@ If CHARSET is nil then use UTF-8." (defvar eww-history-mode-map (let ((map (make-sparse-keymap))) (define-key map "\r" 'eww-history-browse) -;; (define-key map "n" 'next-error-no-select) -;; (define-key map "p" 'previous-error-no-select) + (define-key map "n" 'next-line) + (define-key map "p" 'previous-line) (easy-menu-define nil map "Menu for `eww-history-mode-map'." commit db9ba7ca014a3437fc571b0890fa9ab16c08cfe0 Author: Lars Ingebrigtsen Date: Sun Oct 13 03:12:11 2019 +0200 Protect against segfaults in copy-keymap * src/keymap.c (copy_keymap_1): Factor out and refuse to recurse infinitely (bug#7496). (Fcopy_keymap): ... from here. (copy_keymap_item): Pass on the depth parameter. diff --git a/src/keymap.c b/src/keymap.c index da2786c844..5aed4129bb 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -912,8 +912,10 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx, Lisp_Object def) return def; } +static Lisp_Object copy_keymap_1 (Lisp_Object keymap, int depth); + static Lisp_Object -copy_keymap_item (Lisp_Object elt) +copy_keymap_item (Lisp_Object elt, int depth) { Lisp_Object res, tem; @@ -943,7 +945,7 @@ copy_keymap_item (Lisp_Object elt) elt = XCDR (elt); tem = XCAR (elt); if (CONSP (tem) && EQ (XCAR (tem), Qkeymap)) - XSETCAR (elt, Fcopy_keymap (tem)); + XSETCAR (elt, copy_keymap_1 (tem, depth)); tem = XCDR (elt); } } @@ -964,40 +966,29 @@ copy_keymap_item (Lisp_Object elt) tem = XCDR (elt); } if (CONSP (tem) && EQ (XCAR (tem), Qkeymap)) - XSETCDR (elt, Fcopy_keymap (tem)); + XSETCDR (elt, copy_keymap_1 (tem, depth)); } else if (EQ (XCAR (tem), Qkeymap)) - res = Fcopy_keymap (elt); + res = copy_keymap_1 (elt, depth); } return res; } static void -copy_keymap_1 (Lisp_Object chartable, Lisp_Object idx, Lisp_Object elt) +copy_keymap_set_char_table (Lisp_Object chartable, Lisp_Object idx, + Lisp_Object elt) { - Fset_char_table_range (chartable, idx, copy_keymap_item (elt)); + Fset_char_table_range (chartable, idx, copy_keymap_item (elt, 0)); } -DEFUN ("copy-keymap", Fcopy_keymap, Scopy_keymap, 1, 1, 0, - doc: /* Return a copy of the keymap KEYMAP. - -Note that this is almost never needed. If you want a keymap that's like -another yet with a few changes, you should use map inheritance rather -than copying. I.e. something like: - - (let ((map (make-sparse-keymap))) - (set-keymap-parent map ) - (define-key map ...) - ...) - -After performing `copy-keymap', the copy starts out with the same definitions -of KEYMAP, but changing either the copy or KEYMAP does not affect the other. -Any key definitions that are subkeymaps are recursively copied. -However, a key definition which is a symbol whose definition is a keymap -is not copied. */) - (Lisp_Object keymap) +static Lisp_Object +copy_keymap_1 (Lisp_Object keymap, int depth) { Lisp_Object copy, tail; + + if (depth > 100) + error ("Possible infinite recursion when copying keymap"); + keymap = get_keymap (keymap, 1, 0); copy = tail = list1 (Qkeymap); keymap = XCDR (keymap); /* Skip the `keymap' symbol. */ @@ -1008,22 +999,22 @@ is not copied. */) if (CHAR_TABLE_P (elt)) { elt = Fcopy_sequence (elt); - map_char_table (copy_keymap_1, Qnil, elt, elt); + map_char_table (copy_keymap_set_char_table, Qnil, elt, elt); } else if (VECTORP (elt)) { int i; elt = Fcopy_sequence (elt); for (i = 0; i < ASIZE (elt); i++) - ASET (elt, i, copy_keymap_item (AREF (elt, i))); + ASET (elt, i, copy_keymap_item (AREF (elt, i), depth + 1)); } else if (CONSP (elt)) { if (EQ (XCAR (elt), Qkeymap)) /* This is a sub keymap. */ - elt = Fcopy_keymap (elt); + elt = copy_keymap_1 (elt, depth + 1); else - elt = Fcons (XCAR (elt), copy_keymap_item (XCDR (elt))); + elt = Fcons (XCAR (elt), copy_keymap_item (XCDR (elt), depth + 1)); } XSETCDR (tail, list1 (elt)); tail = XCDR (tail); @@ -1032,6 +1023,29 @@ is not copied. */) XSETCDR (tail, keymap); return copy; } + +DEFUN ("copy-keymap", Fcopy_keymap, Scopy_keymap, 1, 1, 0, + doc: /* Return a copy of the keymap KEYMAP. + +Note that this is almost never needed. If you want a keymap that's like +another yet with a few changes, you should use map inheritance rather +than copying. I.e. something like: + + (let ((map (make-sparse-keymap))) + (set-keymap-parent map ) + (define-key map ...) + ...) + +After performing `copy-keymap', the copy starts out with the same definitions +of KEYMAP, but changing either the copy or KEYMAP does not affect the other. +Any key definitions that are subkeymaps are recursively copied. +However, a key definition which is a symbol whose definition is a keymap +is not copied. */) + (Lisp_Object keymap) +{ + return copy_keymap_1 (keymap, 0); +} + /* Simple Keymap mutators and accessors. */ commit 297f333a13b1f126e3f9c378ab856b970ee80283 Author: Lars Ingebrigtsen Date: Sun Oct 13 01:29:32 2019 +0200 Document let-alist * doc/lispref/lists.texi (Association Lists): Document let-alist (bug#34842). diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 746b4643c1..c06e95640d 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1781,6 +1781,41 @@ compares the @sc{cdr} of each @var{alist} association instead of the @sc{car}. @end defun +@defmac let-alist alist body +Creates a binding for each symbol used as keys the association list +@var{alist}, prefixed with dot. This can be useful when accessing +several items in the same association list, and it's best understood +through a simple example: + +@lisp +(setq colors '((rose . red) (lily . white) (buttercup . yellow))) +(let-alist colors + (if (eq .rose 'red) + .lily)) +=> white +@end lisp + +The @var{body} is inspected at compilation time, and only the symbols +that appear in @var{body} with a @samp{.} as the first character in +the symbol name will be bound. Finding the keys is done with +@code{assq}, and the @code{cdr} of the return value of this +@code{assq} is assigned as the value for the binding. + +Nested association lists is supported: + +@lisp +(setq colors '((rose . red) (lily (belladonna . yellow) (brindisi . pink)))) +(let-alist colors + (if (eq .rose 'red) + .lily.belladonna)) +=> yellow +@end lisp + +Nesting @code{let-alist} inside each other is allowed, but the code in +the inner @code{let-alist} can't access the variables bound by the +outer @code{let-alist}. +@end defmac + @node Property Lists @section Property Lists @cindex property list commit b37fa09337b1f095e8d393d22d3d51ba2567c15c Author: Lars Ingebrigtsen Date: Sun Oct 13 00:49:09 2019 +0200 Don't claim that the default height is precisely 36 characters * doc/emacs/cmdargs.texi (Window Size X): * doc/man/emacs.1.in: Be more vague about what the default height is (bug#33921). diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi index 3f008ecc8e..2b403b4a33 100644 --- a/doc/emacs/cmdargs.texi +++ b/doc/emacs/cmdargs.texi @@ -1053,11 +1053,12 @@ specifies a window 164 columns wide, enough for two ordinary width windows side by side, and 55 lines tall. The default frame width is 80 characters and the default height is -36 lines. You can omit either the width or the height or both. If -you start the geometry with an integer, Emacs interprets it as the -width. If you start with an @samp{x} followed by an integer, Emacs -interprets it as the height. Thus, @samp{81} specifies just the -width; @samp{x45} specifies just the height. +between 35 and 40 lines, depending on the OS and the window manager. +You can omit either the width or the height or both. If you start the +geometry with an integer, Emacs interprets it as the width. If you +start with an @samp{x} followed by an integer, Emacs interprets it as +the height. Thus, @samp{81} specifies just the width; @samp{x45} +specifies just the height. If you start the geometry with @samp{+} or @samp{-}, that introduces an offset, which means both sizes are omitted. Thus, @samp{-3} diff --git a/doc/man/emacs.1.in b/doc/man/emacs.1.in index 11a3390b17..25c32e018a 100644 --- a/doc/man/emacs.1.in +++ b/doc/man/emacs.1.in @@ -280,7 +280,8 @@ The geometry specification is in the standard X format; see .BR X (7) for more information. The width and height are specified in characters; the default for GUI -frames is 80 by 36. +frames is a width of 80 and a height between 35 and 40, depending on +the OS and the window manager. See the Emacs manual, section "Options for Window Size and Position", for information on how window sizes interact with selecting or deselecting the tool bar and menu bar. commit 5fffed6e88644cdf0a1d9fdaf728e75336e39ecd Author: Lars Ingebrigtsen Date: Sun Oct 13 00:22:03 2019 +0200 Document locate-dominating-file * doc/lispref/files.texi (Contents of Directories): Document locate-dominating-file (bug#33869). diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 3746c6d2c9..130282c582 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -2924,6 +2924,7 @@ that can be read. @end defun @defun directory-files-recursively directory regexp &optional include-directories predicate follow-symlinks +@cindex recursing downwards in directories Return all files under @var{directory} whose names match @var{regexp}. This function searches the specified @var{directory} and its sub-directories, recursively, for files whose basenames (i.e., without @@ -2949,6 +2950,19 @@ Symbolic links to subdirectories are not followed by default, but if @var{follow-symlinks} is non-@code{nil}, they are followed. @end defun +@defun locate-dominating-file file name +@cindex recursing upwards in directories +Starting at @var{file}, recurse up the directory hierarchy looking for +the first directory where @var{name} exists, which is then the return +value of this function. @var{file} can be a file or a directory. If +it's a file, its directory will serve as the starting point for +searching the hierarchy of directories. + +@code{name} can be either a string or a predicate. The predicate +takes one argument (the directory) and should return non-@code{nil} if +we've found the directory we're looking for. +@end defun + @defun directory-files-and-attributes directory &optional full-name match-regexp nosort id-format This is similar to @code{directory-files} in deciding which files to report on and how to report their names. However, instead commit 914b98a1c690874382a31a4f3c27bda517dcd48b Author: Juri Linkov Date: Sun Oct 13 00:41:39 2019 +0300 * lisp/tab-bar.el: Don't use minibuffer buffer name as tab name. * lisp/tab-bar.el (tab-bar-tab-name-selected-window): Use minibuffer-selected-window to get original window. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index c4eba8600a..8abe14138a 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -268,10 +268,11 @@ from all windows in the window configuration." (defun tab-bar-tab-name-selected-window () "Generate tab name from the buffer of the selected window. Also add the number of windows in the window configuration." - (let ((count (length (window-list-1 nil 'nomini)))) + (let ((count (length (window-list-1 nil 'nomini))) + (name (window-buffer (minibuffer-selected-window)))) (if (> count 1) - (format "%s (%d)" (buffer-name) count) - (format "%s" (buffer-name))))) + (format "%s (%d)" name count) + (format "%s" name)))) (defun tab-bar-tab-name-all-windows () "Generate tab name from buffers of all windows." commit 4c9468884c8cb7093e258396acda5a7fb3e09a48 Author: Lars Ingebrigtsen Date: Sat Oct 12 23:35:26 2019 +0200 Make Fadd_face_text_property even less destructive * src/textprop.c (Fadd_face_text_property): We need to be non-destructive in buffers, too, because face properties may have been added with `put-text-property' as a list that's been reused. diff --git a/src/textprop.c b/src/textprop.c index 13cd87ac47..93d19754da 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1351,7 +1351,7 @@ into it. */) (NILP (append) ? TEXT_PROPERTY_PREPEND : TEXT_PROPERTY_APPEND), - !STRINGP (object)); + false); return Qnil; } commit 6c677a101d16cffd1e59acf090c4769561f82a53 Author: Lars Ingebrigtsen Date: Sat Oct 12 23:15:43 2019 +0200 Mention the Emacs exit code in batch mode * doc/lispref/os.texi (Batch Mode): Mention what the exit code is if an error is signalled (bug#31552). diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 912d464b49..93551cab0e 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -2595,6 +2595,15 @@ if it is non-@code{nil}; this can be overridden by binding This variable is non-@code{nil} when Emacs is running in batch mode. @end defvar +If Emacs exits due to signalling an error in batch mode, the exit +status of the Emacs command is non-zero: + +@example +$ emacs -Q --batch --eval '(error "foo")'; echo $? +foo +255 +@end example + @node Session Management @section Session Management @cindex session manager commit 6bc938712fa5eb10b383d71c7a76572e99a6ab91 Author: Kaushal Modi Date: Sat Oct 12 22:26:50 2019 +0200 Document that variables should not be called -p * doc/lispref/tips.texi (Coding Conventions): Document that variables should now be called -p (bug#26564). diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index 6d84cfef53..9f6420949d 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -158,7 +158,9 @@ If the purpose of a function is to tell you whether a certain condition is true or false, give the function a name that ends in @samp{p} (which stands for ``predicate''). If the name is one word, add just @samp{p}; if the name is multiple words, add @samp{-p}. -Examples are @code{framep} and @code{frame-live-p}. +Examples are @code{framep} and @code{frame-live-p}. This predicate +suffix should not be used in variable names (i.e., you should name a +variable @code{foo-feature} instead of @code{foo-feature-p}). @item If the purpose of a variable is to store a single function, give it a commit 043d88862c43cebe2a29efa56816244db3df4dd2 Author: Lars Ingebrigtsen Date: Sat Oct 12 22:21:11 2019 +0200 Make the cl-letf doc string link to the manual * lisp/emacs-lisp/cl-macs.el (cl-letf): Add a link to the manual from the doc string (bug#24459). diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index a02fae391b..92154855f3 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2577,6 +2577,8 @@ values. Note that this macro is *not* available in Common Lisp. As a special case, if `(PLACE)' is used instead of `(PLACE VALUE)', the PLACE is not modified before executing BODY. +See info node `(cl) Function Bindings' for details. + \(fn ((PLACE VALUE) ...) BODY...)" (declare (indent 1) (debug ((&rest [&or (symbolp form) (gate gv-place &optional form)]) commit 9eda79fc8c2b3e66ff6934ef0a8f2b747c27d245 Author: Jiajie Chen Date: Sat Oct 12 21:47:47 2019 +0200 button-* function doc string clarifications * lisp/button.el (button-start, button-end, button-get) (button-put, button-label): Have the doc string mention that they have to be called from the current buffer (bug#23909). Copyright-paperwork-exempt: yes diff --git a/lisp/button.el b/lisp/button.el index 04e77ca904..ac6af0be4f 100644 --- a/lisp/button.el +++ b/lisp/button.el @@ -169,7 +169,9 @@ changes to a supertype are not reflected in its subtypes)." ;;; Button properties and other attributes (defun button-start (button) - "Return the position at which BUTTON starts." + "Return the position at which BUTTON starts. + +This function only works when BUTTON is in the current buffer." (if (overlayp button) (overlay-start button) ;; Must be a text-property button. @@ -177,7 +179,9 @@ changes to a supertype are not reflected in its subtypes)." (point-min)))) (defun button-end (button) - "Return the position at which BUTTON ends." + "Return the position at which BUTTON ends. + +This function only works when BUTTON is in the current buffer." (if (overlayp button) (overlay-end button) ;; Must be a text-property button. @@ -185,7 +189,9 @@ changes to a supertype are not reflected in its subtypes)." (point-max)))) (defun button-get (button prop) - "Get the property of button BUTTON named PROP." + "Get the property of button BUTTON named PROP. + +This function only works when BUTTON is in the current buffer." (cond ((overlayp button) (overlay-get button prop)) ((button--area-button-p button) @@ -197,7 +203,9 @@ changes to a supertype are not reflected in its subtypes)." (get-text-property button prop)))) (defun button-put (button prop val) - "Set BUTTON's PROP property to VAL." + "Set BUTTON's PROP property to VAL. + +This function only works when BUTTON is in the current buffer." ;; Treat some properties specially. (cond ((memq prop '(type :type)) ;; We translate a `type' property to a `category' property, @@ -235,7 +243,9 @@ overlay, a buffer position, or (for buttons in the mode-line or header-line) a string. If BUTTON has a `button-data' value, call the function with this -value instad of BUTTON." +value instad of BUTTON. + +This function only works when BUTTON is in the current buffer." (let ((action (or (and use-mouse-action (button-get button 'mouse-action)) (button-get button 'action))) (data (button-get button 'button-data))) @@ -247,7 +257,9 @@ value instad of BUTTON." (funcall action (or data button))))) (defun button-label (button) - "Return BUTTON's text label." + "Return BUTTON's text label. + +This function only works when BUTTON is in the current buffer." (if (button--area-button-p button) (substring-no-properties (button--area-button-string button)) (buffer-substring-no-properties (button-start button) commit 3fcfa8071ac820c2a857b890de31ba5517d7249e Author: Lars Ingebrigtsen Date: Sat Oct 12 21:34:56 2019 +0200 ert-deftest macro doc string clarification * lisp/emacs-lisp/ert.el (ert-deftest): Mention that macros are expanded when defined, not when tested (bug#21742). diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index da241e6304..68762b0752 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -192,6 +192,10 @@ Tests that are expected to fail can be marked as such using :expected-result. See `ert-test-result-type-p' for a description of valid values for RESULT-TYPE. +Macros in BODY are expanded when the test is defined, not when it +is run. If a macro (possibly with side effects) is to be tested, +it has to be wrapped in `(eval (quote ...))'. + \(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \ [:tags \\='(TAG...)] BODY...)" (declare (debug (&define :name test commit cb24f4a145d52fcef858972be6a5c71b7f06eb11 Author: Eli Zaretskii Date: Sat Oct 12 22:23:56 2019 +0300 ; Remove unneeded @samp from a @table * doc/lispref/objects.texi (Special Read Syntax): Remove @samp from @item's. diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index e06cddc9de..e07dc2ed06 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -168,12 +168,12 @@ A hash table (@pxref{Hash Table Type}). @item ?C A character (@pxref{Basic Char Syntax}). -@item @samp{#$} +@item #$ The current file name in byte-compiled files (@pxref{Docs and Compilation}). This is not meant to be used in Emacs Lisp source files. -@item @samp{#@@N} +@item #@@N Skip the next @samp{N} characters (@pxref{Comments}). This is used in byte-compiled files, and is not meant to be used in Emacs Lisp source files. commit e0a2dae0dbb5dcf22ff8153344d141c7bc82d17a Merge: 2d3bb2250c 0ba0af06e2 Author: Eli Zaretskii Date: Sat Oct 12 22:22:37 2019 +0300 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit 2d3bb2250c91b0680903190ffeefaa2e45243406 Author: Eli Zaretskii Date: Sat Oct 12 22:18:34 2019 +0300 Fix recent changes in ELisp manual * doc/lispref/objects.texi (Special Read Syntax): Use @samp in @table. * doc/lispref/elisp.texi (Top): Update the detailed menu due to a recent addition. diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 1ff62118cd..d667c51d78 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -287,6 +287,7 @@ Format of Descriptions Lisp Data Types * Printed Representation:: How Lisp objects are represented as text. +* Special Read Syntax:: An overview of all the special sequences. * Comments:: Comments and their formatting conventions. * Programming Types:: Types found in all Lisp systems. * Editing Types:: Types specific to Emacs. diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 2becc6f2ce..7de632e102 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -114,20 +114,20 @@ not be evaluated later. @xref{Input Functions}, for a description of Emacs Lisp represents many special objects and constructs via special hash notations. -@table @asis -@item @samp{#<...>} +@table @samp +@item #<@dots{}> Objects that have no read syntax are presented like this (@pxref{Printed Representation}). -@item @samp{##} +@item ## The printed representation of an interned symbol whose name is an empty string (@pxref{Symbol Type}). -@item @samp{#:} +@item #: The printed representation of an uninterned symbol whose name is @var{foo} is @samp{#:@var{foo}} (@pxref{Symbol Type}). -@item @samp{#N} +@item #N When printing circular structures, this construct is used to represent where the structure loops back onto itself, and @samp{N} is the starting list count: @@ -138,34 +138,34 @@ starting list count: => (1 . #0) @end lisp -@item @samp{#N=} -@itemx @samp{#N#} +@item #N= +@itemx #N# @samp{#N=} gives the name to an object, and @samp{#N#} represents that object, so when reading back the object, they will be the same object instead of copies (@pxref{Circular Objects}). -@item @samp{#@@N} +@item #@@N Skip the next @samp{N} characters (@pxref{Comments}). -@item @samp{#xN} +@item #xN @samp{N} represented as a hexadecimal number (@samp{#x2a}). -@item @samp{#oN} +@item #oN @samp{N} represented as an octal number (@samp{#o52}). -@item @samp{#bN} +@item #bN @samp{N} represented as a binary number (@samp{#b101010}). -@item @samp{#(...)} +@item #(@dots{}) A string text properties (@pxref{Text Props and Strings}). -@item @samp{#^} +@item #^ A char table (@pxref{Char-Table Type}). -@item @samp{#s(hash-table ...)} +@item #s(hash-table @dots{}) A hash table (@pxref{Hash Table Type}). -@item @samp{?C} +@item ?C A character (@pxref{Basic Char Syntax}). @end table commit 0ba0af06e22c6618f98d733476be2170b900833d Author: Lars Ingebrigtsen Date: Sat Oct 12 21:14:42 2019 +0200 Document #$ in the overview * doc/lispref/objects.texi (Special Read Syntax): Add #$. diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 2becc6f2ce..470982e8d2 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -144,9 +144,6 @@ starting list count: object, so when reading back the object, they will be the same object instead of copies (@pxref{Circular Objects}). -@item @samp{#@@N} -Skip the next @samp{N} characters (@pxref{Comments}). - @item @samp{#xN} @samp{N} represented as a hexadecimal number (@samp{#x2a}). @@ -167,6 +164,16 @@ A hash table (@pxref{Hash Table Type}). @item @samp{?C} A character (@pxref{Basic Char Syntax}). + +@item @samp{#$} +The current file name in byte-compiled files (@pxref{Docs and +Compilation}). This is not meant to be used in Emacs Lisp source +files. + +@item @samp{#@@N} +Skip the next @samp{N} characters (@pxref{Comments}). This is used in +byte-compiled files, and is not meant to be used in Emacs Lisp source +files. @end table commit 981f1358f0332db06cac325e640ce7570662a72b Author: Lars Ingebrigtsen Date: Sat Oct 12 20:57:37 2019 +0200 Fix compilation-transform-file-match-alist failure * lisp/progmodes/compile.el (compilation-error-properties): Fix thinko in compilation-transform-file-match-alist feature -- `file' isn't a list of files after all. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index e312def18d..505e0917dc 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1181,18 +1181,19 @@ POS and RES.") 2))) ;; Remove matches like /bin/sh and do other file name transforms. (save-match-data - (let ((transformed nil)) - (dolist (f file) - (let ((match - (cl-loop for (regexp replacement) - in compilation-transform-file-match-alist - when (string-match regexp f) - return (or replacement t)))) - (cond ((not match) - (push f transformed)) - ((stringp match) - (push (replace-match match nil nil f) transformed))))) - (setq file (nreverse transformed)))) + (let ((file-name + (and (consp file) + (not (bufferp (car file))) + (if (cdr file) + (expand-file-name (car file) (cdr file)) + (car file))))) + (cl-loop for (regexp replacement) + in compilation-transform-file-match-alist + when (string-match regexp file-name) + return (if replacement + (setq file (list (replace-match replacement nil nil + file-name))) + (setq file nil))))) (if (not file) ;; If we ignored all the files with errors on this line, then ;; return nil. commit 193ece8d32e6acb757c09d9a575603b830cf9afa Author: Lars Ingebrigtsen Date: Sat Oct 12 20:56:52 2019 +0200 Add a lispref node to list special read syntax forms * doc/lispref/objects.texi (Special Read Syntax): Add a node to list all the special read syntax forms (bug#18957). diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 2e8e2ee714..2becc6f2ce 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -52,6 +52,7 @@ to use these types can be found in later chapters. @menu * Printed Representation:: How Lisp objects are represented as text. +* Special Read Syntax:: An overview of all the special sequences. * Comments:: Comments and their formatting conventions. * Programming Types:: Types found in all Lisp systems. * Editing Types:: Types specific to Emacs. @@ -106,6 +107,69 @@ Lisp object represented by the text that is read; the object may or may not be evaluated later. @xref{Input Functions}, for a description of @code{read}, the basic function for reading objects. +@node Special Read Syntax +@section Special Read Syntax +@cindex special read syntax + + Emacs Lisp represents many special objects and constructs via +special hash notations. + +@table @asis +@item @samp{#<...>} +Objects that have no read syntax are presented like this +(@pxref{Printed Representation}). + +@item @samp{##} +The printed representation of an interned symbol whose name is an +empty string (@pxref{Symbol Type}). + +@item @samp{#:} +The printed representation of an uninterned symbol whose name is +@var{foo} is @samp{#:@var{foo}} (@pxref{Symbol Type}). + +@item @samp{#N} +When printing circular structures, this construct is used to represent +where the structure loops back onto itself, and @samp{N} is the +starting list count: + +@lisp +(let ((a (list 1))) + (setcdr a a)) +=> (1 . #0) +@end lisp + +@item @samp{#N=} +@itemx @samp{#N#} +@samp{#N=} gives the name to an object, and @samp{#N#} represents that +object, so when reading back the object, they will be the same object +instead of copies (@pxref{Circular Objects}). + +@item @samp{#@@N} +Skip the next @samp{N} characters (@pxref{Comments}). + +@item @samp{#xN} +@samp{N} represented as a hexadecimal number (@samp{#x2a}). + +@item @samp{#oN} +@samp{N} represented as an octal number (@samp{#o52}). + +@item @samp{#bN} +@samp{N} represented as a binary number (@samp{#b101010}). + +@item @samp{#(...)} +A string text properties (@pxref{Text Props and Strings}). + +@item @samp{#^} +A char table (@pxref{Char-Table Type}). + +@item @samp{#s(hash-table ...)} +A hash table (@pxref{Hash Table Type}). + +@item @samp{?C} +A character (@pxref{Basic Char Syntax}). +@end table + + @node Comments @section Comments @cindex comments commit 7d3404d34d02d867c98ff5e9250f5bcf518fd427 Author: Eli Zaretskii Date: Sat Oct 12 21:55:59 2019 +0300 ; Improve a doc string in etags.el * lisp/progmodes/etags.el (tags-complete-tags-table-file): Improve the doc string. (Bug#37538) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 6784894ba8..26590d8ffe 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -1851,10 +1851,15 @@ For non-interactive use, superceded by `fileloop-initialize-replace'." (defun tags-complete-tags-table-file (string predicate what) "Complete STRING from file names in the current tags table. -The meaning of the arguments are the same as the function form of -COLLECTION as explained in Info node `(elisp) Programmed -Completion', except that if WHAT does not equal t, it is treated -as if it were nil." +PREDICATE, if non-nil, is a function to filter possible matches: +if it returns nil, the match is ignored. If PREDICATE is nil, +every possible match is acceptable. +WHAT is a flag specifying the type of completion: t means `all-completions' +operation, any other value means `try-completions' operation. + +This function serves as COLLECTION argument to `completing-read', +see the Info node `(elisp) Programmed Completion' for more detailed +description of the arguments." (save-excursion ;; If we need to ask for the tag table, allow that. (let ((enable-recursive-minibuffers t)) commit 15ed1598b5e8aacea2825e6144cb3cce35101134 Author: Michael Albinus Date: Sat Oct 12 12:20:55 2019 +0200 Adapt some Tramp tests * test/lisp/net/tramp-archive-tests.el (tramp-archive-test17-insert-directory): Adapt regexp of summary line. * test/lisp/net/tramp-tests.el (tramp-test21-file-links): Extend test for symlinked directories. diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el index 02fe8edf27..00d3b4a478 100644 --- a/test/lisp/net/tramp-archive-tests.el +++ b/test/lisp/net/tramp-archive-tests.el @@ -569,7 +569,7 @@ This checks also `file-name-as-directory', `file-name-directory', (looking-at-p (concat ;; There might be a summary line. - "\\(total.+[[:digit:]]+\n\\)?" + "\\(total.+[[:digit:]]+ ?[kKMGTPEZY]?i?B?\n\\)?" ;; We don't know in which order the files appear. (format "\\(.+ %s\\( ->.+\\)?\n\\)\\{%d\\}" diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index ffaf8ef846..37021d6c93 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -3265,7 +3265,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (tmp-name3 (tramp--test-make-temp-name 'local quoted)) (tmp-name4 (tramp--test-make-temp-name nil quoted)) (tmp-name5 - (expand-file-name (file-name-nondirectory tmp-name1) tmp-name4))) + (expand-file-name (file-name-nondirectory tmp-name1) tmp-name4)) + (tmp-name6 (tramp--test-make-temp-name nil quoted))) ;; Check `make-symbolic-link'. (unwind-protect (tramp--test-ignore-make-symbolic-link-error @@ -3333,17 +3334,20 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (if quoted #'tramp-compat-file-name-unquote #'identity) (file-remote-p tmp-name1 'localname)) (file-symlink-p tmp-name5))) - ;; `smbclient' does not show symlinks in directories, so - ;; we cannot delete a non-empty directory. We delete the - ;; file explicitly. - (delete-file tmp-name5)) + ;; Check, that files in symlinked directories still work. + (make-symbolic-link tmp-name4 tmp-name6) + (write-region "foo" nil (expand-file-name "foo" tmp-name6)) + (delete-file (expand-file-name "foo" tmp-name6)) + (should-not (file-exists-p (expand-file-name "foo" tmp-name4))) + (should-not (file-exists-p (expand-file-name "foo" tmp-name6)))) ;; Cleanup. - (ignore-errors - (delete-file tmp-name1) - (delete-file tmp-name2) - (delete-file tmp-name3) - (delete-directory tmp-name4 'recursive))) + (ignore-errors (delete-file tmp-name1)) + (ignore-errors (delete-file tmp-name2)) + (ignore-errors (delete-file tmp-name3)) + (ignore-errors (delete-file tmp-name5)) + (ignore-errors (delete-file tmp-name6)) + (ignore-errors (delete-directory tmp-name4 'recursive))) ;; Check `add-name-to-file'. (unwind-protect commit 251c215f65d8af010b1b73d171edac179e3b5da5 Author: Michael Albinus Date: Sat Oct 12 12:20:30 2019 +0200 Fix google-drive handling in tramp-gvfs * lisp/net/tramp-gvfs.el (tramp-gvfs-file-attributes): Add "standard::is-volatile". (tramp-gvfs-get-directory-attributes) (tramp-gvfs-handle-file-attributes): Handle "gdrive" special. (tramp-gvfs-send-command): Ignore nil arguments. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 1036865e4e..4843c63cb8 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -481,6 +481,7 @@ It has been changed in GVFS 1.14.") "type" "standard::display-name" "standard::symlink-target" + "standard::is-volatile" "unix::nlink" "unix::uid" "owner::user" @@ -937,8 +938,9 @@ file names." (tramp-message v 5 "directory gvfs attributes: %s" localname) ;; Send command. (tramp-gvfs-send-command - v "gvfs-ls" "-h" "-n" "-a" - (string-join tramp-gvfs-file-attributes ",") + v "gvfs-ls" "-h" + (unless (string-equal (file-remote-p directory 'method) "gdrive") "-n") + "-a" (string-join tramp-gvfs-file-attributes ",") (tramp-gvfs-url-file-name directory)) ;; Parse output. (with-current-buffer (tramp-get-connection-buffer v) @@ -1021,7 +1023,12 @@ If FILE-SYSTEM is non-nil, return file system attributes." ;; ... directory or symlink (setq dirp (if (equal "directory" (cdr (assoc "type" attributes))) t)) (setq res-symlink-target - (cdr (assoc "standard::symlink-target" attributes))) + ;; Google-drive creates file blobs and links to them. We + ;; don't want to see them. + (and + (not + (equal (cdr (assoc "standard::is-volatile" attributes)) "TRUE")) + (cdr (assoc "standard::symlink-target" attributes)))) (when (stringp res-symlink-target) (setq res-symlink-target ;; Parse unibyte codes "\xNN". We assume they are @@ -1941,7 +1948,8 @@ is applied, and it returns t if the return code is zero." process-environment))) (when (tramp-gvfs-gio-tool-p vec) ;; Use gio tool. - (setq args (cons (cdr (assoc command tramp-gvfs-gio-mapping)) args) + (setq args (cons (cdr (assoc command tramp-gvfs-gio-mapping)) + (delq nil args)) command "gio")) (with-current-buffer (tramp-get-connection-buffer vec) commit 9c30c3bee0cf1b4e3d20e6821b079a22c6a08de6 Author: Michael Albinus Date: Sat Oct 12 12:19:59 2019 +0200 * lisp/net/tramp.el (tramp-handle-access-file): Use `file-truename'. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d0d8f276ca..2a60aff383 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2970,7 +2970,7 @@ User is always nil." (defun tramp-handle-access-file (filename string) "Like `access-file' for Tramp files." - (unless (file-readable-p filename) + (unless (file-readable-p (file-truename filename)) (tramp-error (tramp-dissect-file-name filename) tramp-file-missing "%s: No such file or directory %s" string filename))) commit 55fdbec44316036b85d96a4d808a5f1f17276fc6 Author: Alan Mackenzie Date: Sat Oct 12 09:30:23 2019 +0000 CC-Mode: Remove unneeded backslashes from doc strings and regular expressions Also make miscellaneous amendments. * lisp/progmodes/cc-align.el, lisp/progmodes/cc-cmds.el * lisp/progmodes/cc-defs.el, lisp/progmodes/cc-engine.el * lisp/progmodes/cc-langs.el, lisp/progmodes/cc-vars.el: Remove lots of unneeded backslashes. * lisp/progmodes/cc-langs.el (c-string-innards-re-alist): Remove redundant "\\|\r" from regular expression. * lisp/progmodes/cc-mode.el (c-make-mode-syntax-table): Correct the name of the hook normal-erase-is-backspace-MODE-hook from a non-existant hook name. diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index 74548f643a..82587b7865 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el @@ -322,7 +322,7 @@ if ( x < 10 Since this function doesn't do anything for lines without an infix operator you typically want to use it together with some other line-up -settings, e.g. as follows \(the arglist-close setting is just a +settings, e.g. as follows (the arglist-close setting is just a suggestion to get a consistent style): \(c-set-offset \\='arglist-cont \\='(c-lineup-arglist-operators 0)) @@ -1246,7 +1246,7 @@ That is useful in a list expression to specify the default indentation on the top level. If `c-syntactic-indentation-in-macros' is nil then this function keeps -the current indentation, except for empty lines \(ignoring the ending +the current indentation, except for empty lines (ignoring the ending backslash) where it takes the indentation from the closest preceding nonempty line in the macro. If there's no such line in the macro then the indentation is taken from the construct preceding it, as described diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index acf4c4ad15..0d9414e60f 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -61,7 +61,7 @@ syntactic information for the current line. Be silent about syntactic errors if the optional argument QUIET is non-nil, even if `c-report-syntactic-errors' is non-nil. Normally the position of point is used to decide where the old indentation is on a lines that -is otherwise empty \(ignoring any line continuation backslash), but +is otherwise empty (ignoring any line continuation backslash), but that's not done if IGNORE-POINT-POS is non-nil. Returns the amount of indentation change \(in columns)." @@ -3257,7 +3257,7 @@ to call `c-scan-conditionals' directly instead." A prefix argument acts as a repeat count. With a negative argument, move backward across a preprocessor conditional. -If there aren't enough conditionals after \(or before) point, an +If there aren't enough conditionals after (or before) point, an error is signaled. \"#elif\" is treated like \"#else\" followed by \"#if\", except that diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 34f47debb1..e9a3e16db3 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -566,11 +566,11 @@ known to be writable. That way, these text properties remain set even if the user undoes the command which set them. This macro should ALWAYS be placed around \"temporary\" internal buffer -changes \(like adding a newline to calculate a text-property then +changes (like adding a newline to calculate a text-property then deleting it again), so that the user never sees them on his `buffer-undo-list'. See also `c-tentative-buffer-changes'. -However, any user-visible changes to the buffer \(like auto-newlines) +However, any user-visible changes to the buffer (like auto-newlines) must not be within a `c-save-buffer-state', since the user then wouldn't be able to undo them. @@ -597,7 +597,7 @@ was in before BODY. Any changes are kept if the last form in BODY returns non-nil. Otherwise it's undone using the undo facility, and various other buffer state that might be affected by the changes is restored. That includes the current buffer, point, mark, mark -activation \(similar to `save-excursion'), and the modified state. +activation (similar to `save-excursion'), and the modified state. The state is also restored if BODY exits nonlocally. If BODY makes a change that unconditionally is undone then wrap this @@ -2360,7 +2360,7 @@ VAL is not evaluated right away but rather when the value is requested with `c-lang-const'. Thus it's possible to use `c-lang-const' inside VAL to refer to language constants that haven't been defined yet. However, if the definition of a language constant is in another file -then that file must be loaded \(at compile time) before it's safe to +then that file must be loaded (at compile time) before it's safe to reference the constant. The assignments in ARGS are processed in sequence like `setq', so diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 9ed4fe3d88..8d92b26ebd 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -788,7 +788,7 @@ IGNORE-LABELS is non-nil. (FIXME: Doesn't work if we stop at a known statement start keyword.) Otherwise, each label is treated as a separate statement. -Macros are ignored \(i.e. skipped over) unless point is within one, in +Macros are ignored (i.e. skipped over) unless point is within one, in which case the content of the macro is treated as normal code. Aside from any normal statement starts found in it, stop at the first token of the content in the macro, i.e. the expression of an \"#if\" or the @@ -4706,7 +4706,7 @@ comment at the start of cc-engine.el for more info." "Return non-nil if the point is on or directly after an identifier. Keywords are recognized and not considered identifiers. If an identifier is detected, the returned value is its starting position. -If an identifier ends at the point and another begins at it \(can only +If an identifier ends at the point and another begins at it (can only happen in Pike) then the point for the preceding one is returned. Note that this function might do hidden buffer changes. See the @@ -4905,7 +4905,7 @@ over the final token in a buffer, up to EOB." (defun c-forward-token-2 (&optional count balanced limit) "Move forward by tokens. A token is defined as all symbols and identifiers which aren't -syntactic whitespace \(note that multicharacter tokens like \"==\" are +syntactic whitespace (note that multicharacter tokens like \"==\" are treated properly). Point is always either left at the beginning of a token or not moved at all. COUNT specifies the number of tokens to move; a negative COUNT moves in the opposite direction. A COUNT of 0 @@ -4917,11 +4917,11 @@ LIMIT sets the limit for the movement and defaults to the point limit. The case when LIMIT is set in the middle of a token, comment or macro is handled correctly, i.e. the point won't be left there. -Return the number of tokens left to move \(positive or negative). If +Return the number of tokens left to move (positive or negative). If BALANCED is true, a move over a balanced paren counts as one. Note that if COUNT is 0 and no appropriate token beginning is found, 1 will be returned. Thus, a return value of 0 guarantees that point is at -the requested position and a return value less \(without signs) than +the requested position and a return value less (without signs) than COUNT guarantees that point is at the beginning of some token. Note that this function might do hidden buffer changes. See the @@ -5065,7 +5065,7 @@ inside a literal there. If PAREN-LEVEL is non-nil, an additional restriction is added to ignore matches in nested paren sexps. The search will also not go outside the current list sexp, which has the effect that if the point -should be moved to BOUND when no match is found \(i.e. NOERROR is +should be moved to BOUND when no match is found (i.e. NOERROR is neither nil nor t), then it will be at the closing paren if the end of the current list sexp is encountered first. @@ -5090,7 +5090,7 @@ hand not safe to assume that the \"look behind\" subexpression never matches syntactic whitespace. Bug: Unbalanced parens inside cpp directives are currently not handled -correctly \(i.e. they don't get ignored as they should) when +correctly (i.e. they don't get ignored as they should) when PAREN-LEVEL is set. Note that this function might do hidden buffer changes. See the @@ -8965,7 +8965,7 @@ point unchanged and return nil." ;; Search syntactically to the end of the declarator (";", ;; ",", a closing paren, eob etc) or to the beginning of an - ;; initializer or function prototype ("=" or "\\s\("). + ;; initializer or function prototype ("=" or "\\s("). ;; Note that square brackets are now not also treated as ;; initializers, since this broke when there were also ;; initializing brace lists. diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index a6fdc3ec79..44d0d49df5 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -545,7 +545,7 @@ buffer local variables c-new-BEG and c-new-END. The functions are called even when font locking is disabled. When the mode is initialized, these functions are called with -parameters \(point-min), \(point-max) and .") +parameters (point-min), (point-max) and .") (c-lang-defconst c-before-context-fontification-functions t 'c-context-expand-fl-region @@ -878,7 +878,7 @@ literal are multiline." t (mapcar (lambda (delim) (cons delim - (concat "\\(\\\\\\(.\\|\n\\|\r\\)\\|[^\\\n\r" + (concat "\\(\\\\\\(.\\|\n\\)\\|[^\\\n\r" (string delim) "]\\)*"))) (and @@ -2338,7 +2338,7 @@ will be handled." (c-lang-defvar c-typedef-decl-key (c-lang-const c-typedef-decl-key)) (c-lang-defconst c-typeless-decl-kwds - "Keywords introducing declarations where the \(first) identifier + "Keywords introducing declarations where the (first) identifier \(declarator) follows directly after the keyword, without any type. If any of these also are on `c-type-list-kwds', `c-ref-list-kwds', @@ -2442,7 +2442,7 @@ Note that unrecognized plain symbols are skipped anyway if they occur before the type, so such things are not necessary to mention here. Mentioning them here is necessary only if they can occur in other places, or if they are followed by a construct that must be skipped -over \(like the parens in the \"__attribute__\" and \"__declspec\" +over (like the parens in the \"__attribute__\" and \"__declspec\" examples above). In the last case, they alse need to be present on one of `c-type-list-kwds', `c-ref-list-kwds', `c-colon-type-list-kwds', `c-paren-nontype-kwds', `c-paren-type-kwds', @@ -2574,7 +2574,7 @@ The keywords on list are assumed to also be present on one of the (c-lang-defconst c-postfix-decl-spec-kwds "Keywords introducing extra declaration specifiers in the region -between the header and the body \(i.e. the \"K&R-region\") in +between the header and the body (i.e. the \"K&R-region\") in declarations." t nil java '("extends" "implements" "throws") @@ -2926,7 +2926,7 @@ expressions." (c-lang-defconst c-inexpr-block-kwds "Keywords that start constructs followed by statement blocks which can -be used in expressions \(the gcc extension for this in C and C++ is +be used in expressions (the gcc extension for this in C and C++ is handled separately by `c-recognize-paren-inexpr-blocks')." t nil pike '("catch" "gauge")) @@ -3403,7 +3403,7 @@ possible for good performance." identifier in a declaration, e.g. the \"*\" in \"char *argv\". This regexp should match \"(\" if parentheses are valid in declarators. The end of the first submatch is taken as the end of the operator. -Identifier syntax is in effect when this is matched \(see +Identifier syntax is in effect when this is matched (see `c-identifier-syntax-table')." t (if (c-lang-const c-type-modifier-kwds) (concat (regexp-opt (c-lang-const c-type-modifier-kwds) t) "\\>") @@ -3444,7 +3444,7 @@ Identifier syntax is in effect when this is matched \(see that might precede the identifier in a declaration, e.g. the \"*\" in \"char *argv\". The end of the first submatch is taken as the end of the operator. Identifier syntax is in effect when -this is matched \(see `c-identifier-syntax-table')." +this is matched (see `c-identifier-syntax-table')." t ;; Default to a regexp that never matches. regexp-unmatchable ;; Check that there's no "=" afterwards to avoid matching tokens diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 631787d73f..6bdfb170f1 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -377,7 +377,7 @@ control). See \"cc-mode.el\" for more info." ;; to special combinations like C-c C-, so we have to hook ;; into the `normal-erase-is-backspace' system to bind it directly ;; as appropriate. - (add-hook 'normal-erase-is-backspace-hook 'c-bind-special-erase-keys) + (add-hook 'normal-erase-is-backspace-mode-hook 'c-bind-special-erase-keys) (c-bind-special-erase-keys)) (when (fboundp 'delete-forward-p) diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 54d634780e..60ad42f24f 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -289,9 +289,9 @@ nil." "Controls the operation of the TAB key. If t, hitting TAB always just indents the current line. If nil, hitting TAB indents the current line if point is at the left margin or in the -line's indentation, otherwise it inserts a `real' tab character \(see -note). If some other value \(not nil or t), then tab is inserted only -within literals \(comments and strings), but the line is always +line's indentation, otherwise it inserts a `real' tab character (see +note). If some other value (not nil or t), then tab is inserted only +within literals (comments and strings), but the line is always reindented. Note: The value of `indent-tabs-mode' will determine whether a real @@ -345,10 +345,11 @@ of the macro content. The default context inside the macro is the same as the top level, so if it contains \"bare\" statements they might be indented wrongly, although there are special cases that handle this in most cases. If this problem occurs, it's usually -countered easily by surrounding the statements by a block \(or even -better with the \"do { ... } while \(0)\" trick)." +countered easily by surrounding the statements by a block (or even +better with the \"do { ... } while (0)\" trick)." :type 'boolean :group 'c) + (put 'c-syntactic-indentation-in-macros 'safe-local-variable 'booleanp) (defcustom c-defun-tactic 'go-outward @@ -1293,7 +1294,7 @@ OFFSET can specify an offset in several different ways: this variable are normally taken from the style system in CC Mode \(see `c-default-style' and `c-style-alist'). However, any offsets put explicitly on this list will override the style system when a CC -Mode buffer is initialized \(there is a variable +Mode buffer is initialized (there is a variable `c-old-style-variable-behavior' that changes this, though). Here is the current list of valid syntactic element symbols: @@ -1670,7 +1671,7 @@ this implicitly by reinitializing C/C++/Objc Mode on any buffer)." (make-variable-buffer-local 'c-noise-macro-names) (defcustom c-noise-macro-with-parens-names nil - "A list of names of macros \(or compiler extensions like \"__attribute__\") + "A list of names of macros (or compiler extensions like \"__attribute__\") which optionally have arguments in parentheses, and which expand to nothing. These are recognized by CC Mode only in declarations." :version "26.1" @@ -1718,7 +1719,7 @@ Alternatively it can be a string, a regular expression which matches all such symbols. The \"symbols\" must be syntactically valid identifiers in the -target language \(C, C++, Objective C), or \(as the case may be) +target language (C, C++, Objective C), or (as the case may be) the regular expression must match only valid identifiers. If you change this variable's value, call the function @@ -1788,9 +1789,9 @@ as designated in the variable `c-file-style'.") It is a list with one element for each syntactic symbol pertinent to the line, for example \"((defun-block-intro 1) (comment-intro))\". -It is dynamically bound when calling \(i) a brace hanging \"action -function\"; \(ii) a semicolon/comma hanging \"criteria function\"; \(iii) a -\"line-up function\"; \(iv) a c-special-indent-hook function. It is also +It is dynamically bound when calling (i) a brace hanging \"action +function\"; (ii) a semicolon/comma hanging \"criteria function\"; (iii) a +\"line-up function\"; (iv) a c-special-indent-hook function. It is also used internally by CC Mode. c-syntactic-context is always bound dynamically. It must NEVER be set