From cd6a9b8f65c10c7f956c6b17fd3f806b61bb3199 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sat, 15 Feb 2020 15:13:59 -0800 Subject: [PATCH 1/8] Skip shell prompt on current line in Eshell even if it's protected When the eshell prompt is protected (e.g., with rear non-sticky, inhibited movements, etc.), 'beginning-of-line' won't move to the actual beginning of the line and therefore won't skip over the prompt. * lisp/eshell/em-prompt.el (eshell-previous-prompt): Use 'forward-line' to go to the beginning of the line, even if it's protected. (Bug#39627) --- lisp/eshell/em-prompt.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el index 25b8ccaba17..9ae5ae12816 100644 --- a/lisp/eshell/em-prompt.el +++ b/lisp/eshell/em-prompt.el @@ -187,7 +187,7 @@ See `eshell-prompt-regexp'." "Move to end of Nth previous prompt in the buffer. See `eshell-prompt-regexp'." (interactive "p") - (beginning-of-line) ; Don't count prompt on current line. + (forward-line 0) ; Don't count prompt on current line. (eshell-next-prompt (- n))) (defun eshell-skip-prompt () From ac0546612d3e8a6360a756f42d74e7351eb26dff Mon Sep 17 00:00:00 2001 From: Allen Li Date: Sun, 16 Feb 2020 23:45:05 -0800 Subject: [PATCH 2/8] Fix reference to 'message-send-and-exit' in Emacs manual Most of the manual here addresses Message mode, and C-c C-c directly above cites the Message mode command, not the Mail mode command. * doc/emacs/sending.texi (Mail Sending): Fix reference. (Bug#39639) --- doc/emacs/sending.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/emacs/sending.texi b/doc/emacs/sending.texi index 283a59a2912..246d6052e08 100644 --- a/doc/emacs/sending.texi +++ b/doc/emacs/sending.texi @@ -340,7 +340,7 @@ Send the message, and leave the mail buffer selected (@code{message-send}). @findex message-send @vindex message-kill-buffer-on-exit The usual command to send a message is @kbd{C-c C-c} -(@code{mail-send-and-exit}). This sends the message and then +(@code{message-send-and-exit}). This sends the message and then buries the mail buffer, putting it at the lowest priority for reselection. If you want it to kill the mail buffer instead, change the variable @code{message-kill-buffer-on-exit} to @code{t}. From b410f902d54fe50efdaf15f79f18cbd46a1d9dd0 Mon Sep 17 00:00:00 2001 From: Allen Li Date: Sun, 16 Feb 2020 23:55:43 -0800 Subject: [PATCH 3/8] Document 'message-send-mail-function' in the Emacs manual Most of the manual here addresses Message mode, yet talks about 'send-mail-function' which is used for Mail mode. Fixing this completely requires more involved work, but for now at least document the difference here. * doc/emacs/sending.texi (Mail Sending): Mention 'message-send-mail-function'. (Bug#39639) --- doc/emacs/sending.texi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/emacs/sending.texi b/doc/emacs/sending.texi index 246d6052e08..8d3f96139ff 100644 --- a/doc/emacs/sending.texi +++ b/doc/emacs/sending.texi @@ -361,9 +361,12 @@ twice). @cindex Feedmail @cindex Sendmail @cindex Mailclient +@vindex message-send-mail-function @vindex send-mail-function - The variable @code{send-mail-function} controls how the message is -delivered. Its value should be one of the following functions: + The variable @code{message-send-mail-function} controls how the +message is delivered (@code{send-mail-function} is used for Mail mode). +The value of @code{send-mail-function} should be one of the following +functions: @table @code @item sendmail-query-once From 2e39fc83bba22cefaa29fb8692f992a91119abf5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 21 Feb 2020 11:03:08 +0200 Subject: [PATCH 4/8] * doc/emacs/sending.texi (Mail Sending): Fix index entries. --- doc/emacs/sending.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/emacs/sending.texi b/doc/emacs/sending.texi index 8d3f96139ff..190549a194e 100644 --- a/doc/emacs/sending.texi +++ b/doc/emacs/sending.texi @@ -338,6 +338,7 @@ Send the message, and leave the mail buffer selected (@code{message-send}). @kindex C-c C-s @r{(Message mode)} @kindex C-c C-c @r{(Message mode)} @findex message-send +@findex message-send-and-exit @vindex message-kill-buffer-on-exit The usual command to send a message is @kbd{C-c C-c} (@code{message-send-and-exit}). This sends the message and then @@ -345,7 +346,6 @@ buries the mail buffer, putting it at the lowest priority for reselection. If you want it to kill the mail buffer instead, change the variable @code{message-kill-buffer-on-exit} to @code{t}. -@findex message-send-and-exit The command @kbd{C-c C-s} (@code{message-send}) sends the message and leaves the buffer selected. Use this command if you want to modify the message (perhaps with new recipients) and send it again. From d7c22338d2d461e0b55a6628fed1917c08715292 Mon Sep 17 00:00:00 2001 From: Federico Tedin Date: Mon, 17 Feb 2020 21:58:43 +0100 Subject: [PATCH 5/8] Fix cursor-sensor--detect when current buf != selected window's buf * lisp/emacs-lisp/cursor-sensor.el (cursor-sensor--detect): Avoid trying to read text properties from position taken from another buffer. (Bug#38740) --- lisp/emacs-lisp/cursor-sensor.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/cursor-sensor.el b/lisp/emacs-lisp/cursor-sensor.el index d8e8eeb16ef..7728e78c471 100644 --- a/lisp/emacs-lisp/cursor-sensor.el +++ b/lisp/emacs-lisp/cursor-sensor.el @@ -146,9 +146,10 @@ By convention, this is a list of symbols where each symbol stands for the ;; It's often desirable to make the cursor-sensor-functions property ;; non-sticky on both ends, but that means get-pos-property might ;; never see it. - (new (or (get-char-property point 'cursor-sensor-functions) - (unless (<= (point-min) point) - (get-char-property (1- point) 'cursor-sensor-functions)))) + (new (and (eq (current-buffer) (window-buffer)) + (or (get-char-property point 'cursor-sensor-functions) + (unless (<= (point-min) point) + (get-char-property (1- point) 'cursor-sensor-functions))))) (old (window-parameter window 'cursor-sensor--last-state)) (oldposmark (car old)) (oldpos (or (if oldposmark (marker-position oldposmark)) From 0273f261a71089e5fea3cbfc45a654e508e49497 Mon Sep 17 00:00:00 2001 From: Wolfgang Scherer Date: Fri, 21 Feb 2020 21:28:11 +0100 Subject: [PATCH 6/8] Don't write absolute filenames and duplicate strings to CVS ignore files * lisp/vc/vc-cvs.el (vc-cvs-ignore): Expand filename correctly and pass on only the basename as the pattern. (vc-cvs-append-to-ignore) Do not write duplicate strings to .cvsignore. New optional parameter SORT to more explicitly control sorting of the ignore entries. (Bug#37215) * lisp/vc/pcvs.el (cvs-mode-ignore): Call 'vc-cvs-append-to-ignore' with SORT argument. --- lisp/vc/pcvs.el | 4 ++-- lisp/vc/vc-cvs.el | 43 +++++++++++++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el index dcba504401c..cb0494ee91c 100644 --- a/lisp/vc/pcvs.el +++ b/lisp/vc/pcvs.el @@ -106,7 +106,6 @@ ;; right now, it's killed without further ado. ;; - make `cvs-mode-ignore' allow manually entering a pattern. ;; to which dir should it apply ? -;; - cvs-mode-ignore should try to remove duplicate entries. ;; - maybe poll/check CVS/Entries files to react to external `cvs' commands ? ;; - some kind of `cvs annotate' support ? ;; but vc-annotate can be used instead. @@ -1972,7 +1971,8 @@ This command ignores files that are not flagged as `Unknown'." (interactive) (dolist (fi (cvs-mode-marked 'ignore)) (vc-cvs-append-to-ignore (cvs-fileinfo->dir fi) (cvs-fileinfo->file fi) - (eq (cvs-fileinfo->subtype fi) 'NEW-DIR)) + (eq (cvs-fileinfo->subtype fi) 'NEW-DIR) + cvs-sort-ignore-file) (setf (cvs-fileinfo->type fi) 'DEAD)) (cvs-cleanup-collection cvs-cookies nil nil nil)) diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 16566a8902c..b6afda69198 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -1220,14 +1220,33 @@ is non-nil." "Return the administrative directory of FILE." (vc-find-root file "CVS")) -(defun vc-cvs-ignore (file &optional _directory _remove) - "Ignore FILE under CVS." - (vc-cvs-append-to-ignore (file-name-directory file) file)) +(defun vc-cvs-ignore (file &optional directory _remove) + "Ignore FILE under CVS. +FILE is either absolute or relative to DIRECTORY. The basename +of FILE is written unmodified into the ignore file and is +therefore evaluated by CVS as an ignore pattern which follows +glob(7) syntax. If the pattern should match any of the special +characters ‘?*[\\\’ literally, they must be escaped with a +backslash. -(defun vc-cvs-append-to-ignore (dir str &optional old-dir) +CVS processes one ignore file for each subdirectory. Patterns +are separated by whitespace and only match files in the same +directory. Since FILE can be a relative filename with leading +diretories, FILE is expanded against DIRECTORY to determine the +correct absolute filename. The directory name of this path is +then used to determine the location of the ignore file. The base +name of this path is used as pattern for the ignore file. + +Since patterns are whitespace sparated, it is usually better to +replace spaces in filenames with question marks ‘?’." + (setq file (directory-file-name (expand-file-name file directory))) + (vc-cvs-append-to-ignore (file-name-directory file) (file-name-nondirectory file))) + +(defun vc-cvs-append-to-ignore (dir str &optional old-dir sort) "In DIR, add STR to the .cvsignore file. If OLD-DIR is non-nil, then this is a directory that we don't want -to hear about anymore." +to hear about anymore. If SORT is non-nil, sort the lines of the +ignore file." (with-current-buffer (find-file-noselect (expand-file-name ".cvsignore" dir)) (when (ignore-errors @@ -1236,13 +1255,13 @@ to hear about anymore." (not (vc-editable-p buffer-file-name)))) ;; CVSREAD=on special case (vc-checkout buffer-file-name t)) - (goto-char (point-max)) - (unless (bolp) (insert "\n")) - (insert str (if old-dir "/\n" "\n")) - ;; FIXME this is a pcvs variable. - (if (bound-and-true-p cvs-sort-ignore-file) - (sort-lines nil (point-min) (point-max))) - (save-buffer))) + (goto-char (point-min)) + (save-match-data + (unless (re-search-forward (concat "^" (regexp-quote str) "$") nil 'move) + (unless (bolp) (insert "\n")) + (insert str (if old-dir "/\n" "\n")) + (if sort (sort-lines nil (point-min) (point-max))) + (save-buffer))))) (provide 'vc-cvs) From 2aed279be18ddd1e2c2b6a8102b94127fe41906c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 22 Feb 2020 11:07:42 +0200 Subject: [PATCH 7/8] Warn about the likes of "[:alnum:]" in regexps * doc/lispref/searching.texi (Char Classes): Warn about erroneous usage of named character classes. Suggested by Stephen Leake . --- doc/lispref/searching.texi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 1f6db0643e8..a4d5a27203f 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -582,8 +582,13 @@ an unquoted @samp{[} is special again and a @samp{]} not. @cindex alpha character class, regexp @cindex xdigit character class, regexp - Here is a table of the classes you can use in a character alternative, -and what they mean: + Below is a table of the classes you can use in a character +alternative, and what they mean. Note that the @samp{[} and @samp{]} +characters that enclose the class name are part of the name, so a +regular expression using these classes needs one more pair of +brackets. For example, a regular expression matching a sequence of +one or more letters and digits would be @samp{[[:alnum:]]+}, not +@samp{[:alnum:]+}. @table @samp @item [:ascii:] From dd5756436c580cc0d00ee875d6645861daf5a867 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sun, 23 Feb 2020 01:51:38 +0200 Subject: [PATCH 8/8] Move more logic to vc-ignore from vc-default-ignore * lisp/vc/vc-dir.el (vc-dir-ignore): Pass relative file names to vc-ignore. * lisp/vc/vc.el (vc-ignore): Move the responsibility of constructing the ignore pattern (right now, most often a relative file name) using a file name received from the user, here. (vc-default-ignore): ...from here (bug#37189, see discussion). Also clarify the docstring. --- lisp/vc/vc-dir.el | 4 +++- lisp/vc/vc.el | 57 +++++++++++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 033cb27e33e..e5c5e16a17a 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -879,7 +879,9 @@ If a prefix argument is given, ignore all marked files." (vc-ignore (vc-dir-fileinfo->name filearg)) t)) vc-ewoc) - (vc-ignore (vc-dir-current-file)))) + (vc-ignore + (file-relative-name (vc-dir-current-file)) + default-directory))) (defun vc-dir-current-file () (let ((node (ewoc-locate vc-ewoc))) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index ec252b74d47..53491dd1b04 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -480,8 +480,8 @@ ;; ;; - ignore (file &optional directory) ;; -;; Ignore FILE under the VCS of DIRECTORY (default is `default-directory'). -;; FILE is a file wildcard. +;; Ignore FILE under DIRECTORY (default is 'default-directory'). +;; FILE is a file wildcard relative to DIRECTORY. ;; When called interactively and with a prefix argument, remove FILE ;; from ignored files. ;; When called from Lisp code, if DIRECTORY is non-nil, the @@ -1406,40 +1406,43 @@ When called interactively, prompt for a FILE to ignore, unless a prefix argument is given, in which case prompt for a file FILE to remove from the list of ignored files." (interactive - (list - (if (not current-prefix-arg) - (read-file-name "File to ignore: ") - (completing-read - "File to remove: " - (vc-call-backend - (or (vc-responsible-backend default-directory) - (error "Unknown backend")) - 'ignore-completion-table default-directory))) - nil current-prefix-arg)) + (let* ((backend (vc-responsible-backend default-directory)) + (rel-dir + (condition-case nil + (file-name-directory + (vc-call-backend backend 'find-ignore-file + default-directory)) + (vc-not-supported + default-directory))) + (file (read-file-name "File to ignore: "))) + (when (and (file-name-absolute-p file) + (file-in-directory-p file rel-dir)) + (setq file (file-relative-name file rel-dir))) + (list file + rel-dir + current-prefix-arg))) (let* ((directory (or directory default-directory)) (backend (or (vc-responsible-backend default-directory) (error "Unknown backend")))) (vc-call-backend backend 'ignore file directory remove))) (defun vc-default-ignore (backend file &optional directory remove) - "Ignore FILE under the VCS of DIRECTORY (default is `default-directory'). -FILE is a wildcard specification, either relative to -DIRECTORY or absolute. + "Ignore FILE under DIRECTORY (default is `default-directory'). +FILE is a wildcard specification relative to DIRECTORY. + When called from Lisp code, if DIRECTORY is non-nil, the -repository to use will be deduced by DIRECTORY; if REMOVE is -non-nil, remove FILE from ignored files. -Argument BACKEND is the backend you are using." +repository to use will be deduced by DIRECTORY. + +If REMOVE is non-nil, remove FILE from ignored files instead. + +Argument BACKEND is the backend to use." (let ((ignore - (vc-call-backend backend 'find-ignore-file (or directory default-directory))) - file-path root-dir pattern) - (setq file-path (expand-file-name file directory)) - (setq root-dir (file-name-directory ignore)) - (when (not (string= (substring file-path 0 (length root-dir)) root-dir)) - (error "Ignore spec %s is not below project root %s" file-path root-dir)) - (setq pattern (substring file-path (length root-dir))) + (vc-call-backend backend + 'find-ignore-file + (or directory default-directory)))) (if remove - (vc--remove-regexp (concat "^" (regexp-quote pattern ) "\\(\n\\|$\\)") ignore) - (vc--add-line pattern ignore)))) + (vc--remove-regexp (concat "^" (regexp-quote file) "\\(\n\\|$\\)") ignore) + (vc--add-line file ignore)))) (defun vc-default-ignore-completion-table (backend file) "Return the list of ignored files under BACKEND."