Merge from origin/emacs-27

dd5756436c Move more logic to vc-ignore from vc-default-ignore
2aed279be1 Warn about the likes of "[:alnum:]" in regexps
0273f261a7 Don't write absolute filenames and duplicate strings to CV...
d7c22338d2 Fix cursor-sensor--detect when current buf != selected win...
2e39fc83bb * doc/emacs/sending.texi (Mail Sending): Fix index entries.
b410f902d5 Document 'message-send-mail-function' in the Emacs manual
ac0546612d Fix reference to 'message-send-and-exit' in Emacs manual
cd6a9b8f65 Skip shell prompt on current line in Eshell even if it's p...
This commit is contained in:
Glenn Morris 2020-02-23 07:50:28 -08:00
commit 3f01a17d68
8 changed files with 85 additions and 52 deletions

View file

@ -338,14 +338,14 @@ 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{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}.
@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.
@ -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

View file

@ -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:]

View file

@ -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))

View file

@ -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 ()

View file

@ -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))

View file

@ -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)

View file

@ -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)))

View file

@ -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
@ -1427,40 +1427,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."