commit 35cea6c94c658f101548df5325ec3abda0079d2a (HEAD, refs/remotes/origin/master) Author: Dmitry Gutov Date: Fri Aug 6 11:34:02 2021 +0300 Add colon-space after prompt * lisp/progmodes/project.el (project--completing-read-strict): Fix last change's regression (bug#49865). diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 6a330ecb2b..b710175477 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -885,7 +885,7 @@ PREDICATE, HIST, and DEFAULT have the same meaning as in (lambda () (let ((minibuffer-default default)) (minibuffer-default-add-completions))))) - (completing-read prompt + (completing-read (format "%s: " prompt) collection predicate 'confirm nil hist))) commit 4d6511a2842ee92271b0ddc4572cb2a801a172a5 Author: Eli Zaretskii Date: Fri Aug 6 10:51:45 2021 +0300 Fix automatic hscrolling when line numbers are displayed * src/xdisp.c (hscroll_window_tree): When line numbers are displayed, account for the the line-number space when calculating the desired X coordinate on the left. (Bug#49891) diff --git a/src/xdisp.c b/src/xdisp.c index 70d15aee68..e62f7e3df6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -15082,11 +15082,12 @@ hscroll_window_tree (Lisp_Object window) else { if (hscroll_relative_p) - wanted_x = text_area_width * hscroll_step_rel - + h_margin; + wanted_x = + text_area_width * hscroll_step_rel + h_margin + x_offset; else - wanted_x = hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f) - + h_margin; + wanted_x = + hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f) + + h_margin + x_offset; hscroll = max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f); } commit c327d61ec86023aaf6b014259db301f081a0e034 Author: Eli Zaretskii Date: Fri Aug 6 10:22:22 2021 +0300 Improve wording of recently changed documentation * src/minibuf.c (syms_of_minibuf): * lisp/minibuffer.el (minibuffer-restore-windows): * lisp/progmodes/etags.el (etags-xref-prefer-current-file): Improve wording of doc strings. * etc/NEWS: Improve wording and format of recently added entries. diff --git a/etc/NEWS b/etc/NEWS index 7fc53ff6c0..674152c8c8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -181,7 +181,8 @@ nor t. +++ ** New user option 'read-minibuffer-restore-windows'. When customized to nil, it uses 'minibuffer-restore-windows' in -'minibuffer-exit-hook' to remove only the *Completions* window. +'minibuffer-exit-hook' to remove only the window showing the +"*Completions*" buffer. +++ ** New system for displaying documentation for groups of functions. @@ -2074,11 +2075,12 @@ project's root directory, respectively. This command lets you interactively remove an entry from the list of projects in 'project-list-file'. -*** 'project-find-file' now accepts non-existent file names (to -facilitate creating a file inside some nested sub-directory easily). +*** 'project-find-file' now accepts non-existent file names. +This is to allow easy creation of files inside some nested +sub-directory. -*** 'project-find-file' doesn't use the string at point as default -input, now it's only suggested as part of "future history". +*** 'project-find-file' doesn't use the string at point as default input. +Now it's only suggested as part of the "future history". ** xref @@ -3695,8 +3697,10 @@ Emacs constructs the nondirectory part of the auto-save file name by applying that 'secure-hash' to the buffer file name. This avoids any risk of excessively long file names. -** New variable 'etags-xref-prefer-current-file' to change the order -of definitions returned by the etags Xref backend. +--- +** New user option 'etags-xref-prefer-current-file'. +When non-nil, matches for identifiers in the file visited by the +current buffer will be shown first in the "*xref*" buffer. * Changes in Emacs 28.1 on Non-Free Operating Systems diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 3258e1ec8d..2c6340e1c3 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2332,7 +2332,7 @@ variables.") "Restore some windows on exit from minibuffer. When `read-minibuffer-restore-windows' is nil, then this function added to `minibuffer-exit-hook' will remove at least the window -with the *Completions* buffer." +that displays the \"*Completions*\" buffer." (unless read-minibuffer-restore-windows (minibuffer-hide-completions))) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 3ea1131db5..a1f806ae8c 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -2060,7 +2060,7 @@ If you want `xref-find-definitions' to find the tagged files by their file name, add `tag-partial-file-name-match-p' to the list value.") (defcustom etags-xref-prefer-current-file nil - "Non-nil to show the matches in the current file first." + "Non-nil means show the matches in the current file first." :type 'boolean :version "28.1") diff --git a/src/minibuf.c b/src/minibuf.c index a054f0e20d..c9134eff67 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2537,9 +2537,10 @@ restore, on exit, the window configurations of the frame where the minibuffer was entered from and, if it is different, the frame that owns the associated minibuffer window. -If this is nil, no such restorations are done. -But still `minibuffer-restore-windows' in `minibuffer-exit-hook' -will remove the window with the *Completions* buffer. */); +If this is nil, window configurations are not restored upon exiting +the minibuffer. However, if `minibuffer-restore-windows' is present +in `minibuffer-exit-hook', exiting the minibuffer will remove the window +showing the *Completions* buffer, if any. */); read_minibuffer_restore_windows = true; defsubr (&Sactive_minibuffer_window); commit 9f88a9c058fd9e1d34d68e6729f3d6105e291c41 Author: Eli Zaretskii Date: Fri Aug 6 09:46:39 2021 +0300 Make sure installed *.eln files have correct permissions * Makefile.in (install-eln): Add "umask 022" to ensure the *.eln files are accessible from the user's Emacs session. Suggested by Wilhelm Kirschbaum . (Bug#49864) diff --git a/Makefile.in b/Makefile.in index 97d954b6ce..235b707673 100644 --- a/Makefile.in +++ b/Makefile.in @@ -789,6 +789,7 @@ install-etc: ### Install native compiled Lisp files. install-eln: lisp ifeq ($(HAVE_NATIVE_COMP),yes) + umask 022 ; \ find native-lisp -type d -exec $(MKDIR_P) "$(ELN_DESTDIR){}" \; ; \ find native-lisp -type f -exec ${INSTALL_DATA} "{}" "$(ELN_DESTDIR){}" \; endif commit fa895379d6166c52b89774a9e450a94c2e429dae Author: Dmitry Gutov Date: Fri Aug 6 03:30:10 2021 +0300 Change how project-find-file's completion works * lisp/progmodes/project.el (project--completing-read-strict): Allow to choose a non-existent file, with confirmation (bug#49204). Don't use the string at point as a "real" default, and instead only include it in "future history": meaning, it will be inserted on 'M-n' (bug#49865). diff --git a/etc/NEWS b/etc/NEWS index 6495fd0951..7fc53ff6c0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2074,6 +2074,12 @@ project's root directory, respectively. This command lets you interactively remove an entry from the list of projects in 'project-list-file'. +*** 'project-find-file' now accepts non-existent file names (to +facilitate creating a file inside some nested sub-directory easily). + +*** 'project-find-file' doesn't use the string at point as default +input, now it's only suggested as part of "future history". + ** xref --- diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 0e73286426..6a330ecb2b 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -879,23 +879,16 @@ PREDICATE, HIST, and DEFAULT have the same meaning as in (defun project--completing-read-strict (prompt collection &optional predicate hist default) - ;; Tried both expanding the default before showing the prompt, and - ;; removing it when it has no matches. Neither seems natural - ;; enough. Removal is confusing; early expansion makes the prompt - ;; too long. - (let* ((new-prompt (if (and default (not (string-equal default ""))) - (format "%s (default %s): " prompt default) - (format "%s: " prompt))) - (res (completing-read new-prompt - collection predicate t - nil ;; initial-input - hist default))) - (when (and (equal res default) - (not (test-completion res collection predicate))) - (setq res - (completing-read (format "%s: " prompt) - collection predicate t res hist nil))) - res)) + (minibuffer-with-setup-hook + (lambda () + (setq-local minibuffer-default-add-function + (lambda () + (let ((minibuffer-default default)) + (minibuffer-default-add-completions))))) + (completing-read prompt + collection predicate 'confirm + nil + hist))) ;;;###autoload (defun project-dired () commit d5a2fdeefb819dbb44b9e98794d6e4f85f8e1db2 Author: Dmitry Gutov Date: Fri Aug 6 03:12:40 2021 +0300 New option etags-xref-prefer-current-file * lisp/progmodes/etags.el (etags-xref-prefer-current-file): New user option (bug#2544). (xref-backend-definitions): Use it. diff --git a/etc/NEWS b/etc/NEWS index 1dd50a39ba..6495fd0951 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3689,6 +3689,9 @@ Emacs constructs the nondirectory part of the auto-save file name by applying that 'secure-hash' to the buffer file name. This avoids any risk of excessively long file names. +** New variable 'etags-xref-prefer-current-file' to change the order +of definitions returned by the etags Xref backend. + * Changes in Emacs 28.1 on Non-Free Operating Systems diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index ce1d8e5e62..3ea1131db5 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -2059,6 +2059,11 @@ for \\[find-tag] (which see)." If you want `xref-find-definitions' to find the tagged files by their file name, add `tag-partial-file-name-match-p' to the list value.") +(defcustom etags-xref-prefer-current-file nil + "Non-nil to show the matches in the current file first." + :type 'boolean + :version "28.1") + ;;;###autoload (defun etags--xref-backend () 'etags) @@ -2074,7 +2079,21 @@ file name, add `tag-partial-file-name-match-p' to the list value.") (find-tag--completion-ignore-case)) (cl-defmethod xref-backend-definitions ((_backend (eql 'etags)) symbol) - (etags--xref-find-definitions symbol)) + (let ((file (and buffer-file-name (expand-file-name buffer-file-name))) + (definitions (etags--xref-find-definitions symbol)) + same-file-definitions) + (when (and etags-xref-prefer-current-file file) + (cl-delete-if + (lambda (definition) + (when (equal file + (xref-location-group + (xref-item-location definition))) + (push definition same-file-definitions) + t)) + definitions) + (setq definitions (nconc (nreverse same-file-definitions) + definitions))) + definitions)) (cl-defmethod xref-backend-apropos ((_backend (eql 'etags)) pattern) (etags--xref-find-definitions (xref-apropos-regexp pattern) t)) commit f65958a94de115dda0ba0f187121aa0a548e8d90 Author: Dmitry Gutov Date: Fri Aug 6 03:02:13 2021 +0300 Provide a default for xref-find-apropos pattern * lisp/progmodes/xref.el (xref-find-apropos): Provide a default for the pattern (bug#49731). diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 404752536f..69378a561e 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1356,7 +1356,9 @@ This command is intended to be bound to a mouse event." The argument has the same meaning as in `apropos'." (interactive (list (read-string "Search for pattern (word list or regexp): " - nil 'xref--read-pattern-history))) + nil 'xref--read-pattern-history + (xref-backend-identifier-at-point + (xref-find-backend))))) (require 'apropos) (let* ((newpat (if (and (version< emacs-version "28.0.50") commit 232be9bf87e7f1086f45deca2188b926123cb33c Author: Dmitry Gutov Date: Fri Aug 6 02:49:42 2021 +0300 Change the xref-goto-xref error message * lisp/progmodes/xref.el (xref-goto-xref): Change the error message (bug#49846). diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 7453dbed99..404752536f 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -657,7 +657,7 @@ quit the *xref* buffer." (interactive "P") (let* ((buffer (current-buffer)) (xref (or (xref--item-at-point) - (user-error "No reference at point"))) + (user-error "Choose a reference to visit"))) (xref--current-item xref)) (xref--show-location (xref-item-location xref) (if quit 'quit t)) (if (fboundp 'next-error-found) commit 18d7562e91d137b4e1efbd6c416f225af6efad3f Author: Juri Linkov Date: Fri Aug 6 02:36:22 2021 +0300 Add function minibuffer-restore-windows (bug#45072) * lisp/minibuffer.el (minibuffer-restore-windows): New function that removes the completions buffer. Add it to minibuffer-exit-hook. * src/minibuf.c (read-minibuffer-restore-windows): Mention minibuffer-restore-windows. diff --git a/etc/NEWS b/etc/NEWS index 5276a0981e..1dd50a39ba 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -180,6 +180,8 @@ nor t. +++ ** New user option 'read-minibuffer-restore-windows'. +When customized to nil, it uses 'minibuffer-restore-windows' in +'minibuffer-exit-hook' to remove only the *Completions* window. +++ ** New system for displaying documentation for groups of functions. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 3751ba80e0..3258e1ec8d 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2328,6 +2328,16 @@ variables.") (setq deactivate-mark nil) (throw 'exit nil)) +(defun minibuffer-restore-windows () + "Restore some windows on exit from minibuffer. +When `read-minibuffer-restore-windows' is nil, then this function +added to `minibuffer-exit-hook' will remove at least the window +with the *Completions* buffer." + (unless read-minibuffer-restore-windows + (minibuffer-hide-completions))) + +(add-hook 'minibuffer-exit-hook 'minibuffer-restore-windows) + (defun minibuffer-quit-recursive-edit () "Quit the command that requested this recursive edit without error. Like `abort-recursive-edit' without aborting keyboard macro diff --git a/src/minibuf.c b/src/minibuf.c index 3ee0dca5e0..a054f0e20d 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2535,8 +2535,11 @@ instead. */); If this is non-nil (the default), reading input with the minibuffer will restore, on exit, the window configurations of the frame where the minibuffer was entered from and, if it is different, the frame that owns -the associated minibuffer window. If this is nil, no such restorations -are done. */); +the associated minibuffer window. + +If this is nil, no such restorations are done. +But still `minibuffer-restore-windows' in `minibuffer-exit-hook' +will remove the window with the *Completions* buffer. */); read_minibuffer_restore_windows = true; defsubr (&Sactive_minibuffer_window); commit 4ec10c80abfc985efa9707e5129b4cb5612d6582 Author: Konstantin Kharlamov Date: Thu Aug 5 18:25:56 2021 +0300 Reset mtime of a buffer reverted "delicately" * lisp/files.el (revert-buffer-insert-file-contents-delicately): Once buffer is reverted, reset its mtime to that of the file. (Bug#49893) diff --git a/lisp/files.el b/lisp/files.el index 2b13d04bcb..c260795691 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6533,7 +6533,8 @@ see `replace-buffer-contents'." ;; See comments in revert-buffer-with-fine-grain for an explanation. (defun revert-buffer-with-fine-grain-success-p () success)) - (set-buffer-modified-p nil)))) + (set-buffer-modified-p nil) + (set-visited-file-modtime)))) (defun revert-buffer-with-fine-grain (&optional ignore-auto noconfirm) "Revert buffer preserving markers, overlays, etc. commit 9d1c3c9830fc620290626fda1cf5a2250287ba31 Author: Eli Zaretskii Date: Thu Aug 5 20:42:10 2021 +0300 Fix files-tests on non-Posix systems * test/lisp/files-tests.el (files-test-auto-save-name-default) (files-test-auto-save-name-transform) (files-test-auto-save-name-unique, files-test-lock-name-default) (files-test-lock-name-unique): Skip the drive letter in absolute file names on MS-Windows/MS-DOS when comparing file names against the expected ones. (files-tests-file-name-non-special--subprocess): Skip test on MS-Windows/MS-DOS. diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index a5c8236017..640f7d8420 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -316,7 +316,9 @@ be $HOME." (ert-deftest files-tests-file-name-non-special--subprocess () "Check that Bug#25949 and Bug#48177 are fixed." - (skip-unless (and (executable-find "true") (file-exists-p null-device))) + (skip-unless (and (executable-find "true") (file-exists-p null-device) + ;; These systems cannot set date of the null device. + (not (memq system-type '(windows-nt ms-dos))))) (let ((default-directory (file-name-quote temporary-file-directory)) (true (file-name-quote (executable-find "true"))) (null (file-name-quote null-device))) @@ -951,40 +953,51 @@ unquoted file names." (ert-deftest files-test-auto-save-name-default () (with-temp-buffer - (let ((auto-save-file-name-transforms nil)) + (let ((auto-save-file-name-transforms nil) + (name-start (if (memq system-type '(windows-nt ms-dos)) 2 nil))) (setq buffer-file-name "/tmp/foo.txt") - (should (equal (make-auto-save-file-name) "/tmp/#foo.txt#"))))) + (should (equal (substring (make-auto-save-file-name) name-start) + "/tmp/#foo.txt#"))))) (ert-deftest files-test-auto-save-name-transform () (with-temp-buffer (setq buffer-file-name "/tmp/foo.txt") (let ((auto-save-file-name-transforms - '(("\\`/.*/\\([^/]+\\)\\'" "/var/tmp/\\1" nil)))) - (should (equal (make-auto-save-file-name) "/var/tmp/#foo.txt#"))))) + '(("\\`/.*/\\([^/]+\\)\\'" "/var/tmp/\\1" nil))) + (name-start (if (memq system-type '(windows-nt ms-dos)) 2 nil))) + (should (equal (substring (make-auto-save-file-name) name-start) + "/var/tmp/#foo.txt#"))))) (ert-deftest files-test-auto-save-name-unique () (with-temp-buffer (setq buffer-file-name "/tmp/foo.txt") (let ((auto-save-file-name-transforms - '(("\\`/.*/\\([^/]+\\)\\'" "/var/tmp/\\1" t)))) - (should (equal (make-auto-save-file-name) "/var/tmp/#!tmp!foo.txt#"))) + '(("\\`/.*/\\([^/]+\\)\\'" "/var/tmp/\\1" t))) + (name-start (if (memq system-type '(windows-nt ms-dos)) 2 nil))) + (should (equal (substring (make-auto-save-file-name) name-start) + "/var/tmp/#!tmp!foo.txt#"))) (let ((auto-save-file-name-transforms - '(("\\`/.*/\\([^/]+\\)\\'" "/var/tmp/\\1" sha1)))) - (should (equal (make-auto-save-file-name) + '(("\\`/.*/\\([^/]+\\)\\'" "/var/tmp/\\1" sha1))) + (name-start (if (memq system-type '(windows-nt ms-dos)) 2 nil))) + (should (equal (substring (make-auto-save-file-name) name-start) "/var/tmp/#b57c5a04f429a83305859d3350ecdab8315a9037#"))))) (ert-deftest files-test-lock-name-default () - (let ((lock-file-name-transforms nil)) - (should (equal (make-lock-file-name "/tmp/foo.txt") "/tmp/.#foo.txt")))) + (let ((lock-file-name-transforms nil) + (name-start (if (memq system-type '(windows-nt ms-dos)) 2 nil))) + (should (equal (substring (make-lock-file-name "/tmp/foo.txt") name-start) + "/tmp/.#foo.txt")))) (ert-deftest files-test-lock-name-unique () (let ((lock-file-name-transforms - '(("\\`/.*/\\([^/]+\\)\\'" "/var/tmp/\\1" t)))) - (should (equal (make-lock-file-name "/tmp/foo.txt") + '(("\\`/.*/\\([^/]+\\)\\'" "/var/tmp/\\1" t))) + (name-start (if (memq system-type '(windows-nt ms-dos)) 2 nil))) + (should (equal (substring (make-lock-file-name "/tmp/foo.txt") name-start) "/var/tmp/.#!tmp!foo.txt"))) (let ((lock-file-name-transforms - '(("\\`/.*/\\([^/]+\\)\\'" "/var/tmp/\\1" sha1)))) - (should (equal (make-lock-file-name "/tmp/foo.txt") + '(("\\`/.*/\\([^/]+\\)\\'" "/var/tmp/\\1" sha1))) + (name-start (if (memq system-type '(windows-nt ms-dos)) 2 nil))) + (should (equal (substring (make-lock-file-name "/tmp/foo.txt") name-start) "/var/tmp/.#b57c5a04f429a83305859d3350ecdab8315a9037")))) (ert-deftest files-tests-file-name-non-special-make-directory () commit 2a17925aab75735b40f9b0ccaab4c46f6b9a9a32 Author: Mattias EngdegÄrd Date: Thu Aug 5 11:50:25 2021 +0200 Cease attempts to const-propagate through setq The current method of propagating constants through setq was unsound because it relied on each setq form only being traversed at most once during optimisation, which isn't necessarily true in general; it could be made to miscompile code in rare cases. Since it was only used in limited circumstances, disabling this optimisation doesn't cost us much. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't update the known value when traversing `setq`. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test case. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 96072ea1b5..6475f69ede 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -601,15 +601,9 @@ Same format as `byte-optimize--lexvars', with shared structure and contents.") (lexvar (assq var byte-optimize--lexvars)) (value (byte-optimize-form expr nil))) (when lexvar - ;; Set a new value or inhibit further substitution. - (setcdr (cdr lexvar) - (and - ;; Inhibit if bound outside conditional code. - (not (assq var byte-optimize--vars-outside-condition)) - ;; The new value must be substitutable. - (byte-optimize--substitutable-p value) - (list value))) - (setcar (cdr lexvar) t)) ; Mark variable to be kept. + (setcar (cdr lexvar) t) ; Mark variable to be kept. + (setcdr (cdr lexvar) nil)) ; Inhibit further substitution. + (push var var-expr-list) (push value var-expr-list)) (setq args (cddr args))) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 5aa853c721..80003c264a 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -432,6 +432,15 @@ (let ((x 2)) (list (or (bytecomp-test-identity 'a) (setq x 3)) x)) + (mapcar (lambda (b) + (let ((a nil)) + (+ 0 + (progn + (setq a b) + (setq b 1) + a)))) + '(10)) + (let* ((x 1) (y (condition-case x (/ 1 0) commit 2d8c14d299600c08751bfb978883c9f1b7141555 Author: Lars Ingebrigtsen Date: Thu Aug 5 13:14:26 2021 +0200 Fix M-n description in refcards * etc/refcards/pl-refcard.tex (section{Szukanie przyrostowe}): Ditto (in comments). * etc/refcards/refcard.tex (section{Incremental Search}): Fix M-n description (bug#49872). diff --git a/etc/refcards/pl-refcard.tex b/etc/refcards/pl-refcard.tex index b31b4270ab..c9d96788c5 100644 --- a/etc/refcards/pl-refcard.tex +++ b/etc/refcards/pl-refcard.tex @@ -394,7 +394,7 @@ \section{Szukanie przyrostowe} \key{szukaj wstecz tekstu zgodnego z~wpisywanym wyra/zeniem regularnym}{C-M-r} %\key{select previous search string}{M-p} -%\key{select next later search string}{M-n} +%\key{select next search string}{M-n} %\key{exit incremental search}{RET} %\key{undo effect of last character}{DEL} %\key{abort current search}{C-g} diff --git a/etc/refcards/refcard.tex b/etc/refcards/refcard.tex index f7b5da40b0..4cb8f9d50a 100644 --- a/etc/refcards/refcard.tex +++ b/etc/refcards/refcard.tex @@ -322,7 +322,7 @@ \section{Incremental Search} \key{reverse regular expression search}{C-M-r} \key{select previous search string}{M-p} -\key{select next later search string}{M-n} +\key{select next search string}{M-n} \key{exit incremental search}{RET} \key{undo effect of last character}{DEL} \key{abort current search}{C-g} commit 0b5cc6c567932b38e8638d67abec2b20dc66b42c Author: Basil L. Contovounesios Date: Thu Aug 5 11:40:31 2021 +0100 ; Fix oauth typos in last change. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 015a170e5e..17da5071cb 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -14516,7 +14516,7 @@ this should be set to @code{anonymous}. If this variable isn't set, the normal login methods will be used. If you wish to specify a specific login method to be used, you can set this variable to either @code{login} (the traditional @acronym{IMAP} login method), -@code{plain}, @code{cram-md5} or @code{xoath2}. (The latter method +@code{plain}, @code{cram-md5} or @code{xoauth2}. (The latter method requires using the @file{oauth2.el} library.) @item nnimap-expunge diff --git a/etc/NEWS b/etc/NEWS index bfbae9fc5d..5276a0981e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1000,7 +1000,7 @@ String or list of strings specifying switches for Git log under VC. ** Gnus +++ -*** nnimap now supports the oath2.el library. +*** nnimap now supports the oauth2.el library. +++ *** New Summary buffer sort options for extra headers. commit 1505dca91f2ef8de3ea20fb2177539700ac1f2fc Author: Roland Winkler Date: Thu Aug 5 12:33:21 2021 +0200 Add support for the oauth2.el library in nnimap and smtpmail * doc/misc/gnus.texi (Customizing the IMAP Connection): * doc/misc/smtpmail.texi (Authentication): Mention it. * lisp/gnus/nnimap.el (nnimap-login): Support oauth2. * lisp/mail/smtpmail.el (smtpmail-try-auth-method): New function for oauth2. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index c8d5a868ed..015a170e5e 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -14516,7 +14516,8 @@ this should be set to @code{anonymous}. If this variable isn't set, the normal login methods will be used. If you wish to specify a specific login method to be used, you can set this variable to either @code{login} (the traditional @acronym{IMAP} login method), -@code{plain} or @code{cram-md5}. +@code{plain}, @code{cram-md5} or @code{xoath2}. (The latter method +requires using the @file{oauth2.el} library.) @item nnimap-expunge When to expunge deleted messages. If @code{never}, deleted articles diff --git a/doc/misc/smtpmail.texi b/doc/misc/smtpmail.texi index ca7dabe654..f5d567533b 100644 --- a/doc/misc/smtpmail.texi +++ b/doc/misc/smtpmail.texi @@ -264,12 +264,14 @@ file, @pxref{Top,,auth-source, auth, Emacs auth-source Library}. @cindex CRAM-MD5 @cindex PLAIN @cindex LOGIN -The process by which the SMTP library authenticates you to the server -is known as ``Simple Authentication and Security Layer'' (SASL). -There are various SASL mechanisms, and this library supports three of -them: CRAM-MD5, PLAIN, and LOGIN, where the first uses a form of +The process by which the @acronym{SMTP} library authenticates you to +the server is known as ``Simple Authentication and Security Layer'' +(@acronym{SASL}). There are various @acronym{SASL} mechanisms, and +this library supports three of them: @code{cram-md5}, @code{plain}, +@code{login} and @code{xoauth2}, where the first uses a form of encryption to obscure your password, while the other two do not. It -tries each of them, in that order, until one succeeds. You can +tries each of them, in that order, until one succeeds. +(@code{xoauth2} requires using the @file{oauth2.el} library. You can override this by assigning a specific authentication mechanism to a server by including a key @code{smtp-auth} with the value of your preferred mechanism in the appropriate @file{~/.authinfo} entry. diff --git a/etc/NEWS b/etc/NEWS index f0fa686bc9..bfbae9fc5d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -999,6 +999,9 @@ String or list of strings specifying switches for Git log under VC. ** Gnus ++++ +*** nnimap now supports the oath2.el library. + +++ *** New Summary buffer sort options for extra headers. The extra header sort option ('C-c C-s C-x') prompts for a header @@ -1187,6 +1190,9 @@ take the actual screenshot, and defaults to "ImageMagick import". ** Smtpmail ++++ +*** smtpmail now supports using the oauth2.el library. + +++ *** New user option 'smtpmail-store-queue-variables'. If non-nil, SMTP variables will be stored together with the queued diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 3e2a202a6c..3cf65453f3 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -599,6 +599,13 @@ during splitting, which may be slow." (eq nnimap-authenticator 'anonymous) (eq nnimap-authenticator 'login))) (nnimap-command "LOGIN %S %S" user password)) + ((and (nnimap-capability "AUTH=XOAUTH2") + (eq nnimap-authenticator 'xoauth2)) + (nnimap-command "AUTHENTICATE XOAUTH2 %s" + (base64-encode-string + (format "user=%s\001auth=Bearer %s\001\001" + (nnimap-quote-specials user) + (nnimap-quote-specials password))))) ((and (nnimap-capability "AUTH=CRAM-MD5") (or (null nnimap-authenticator) (eq nnimap-authenticator 'cram-md5))) diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 33bdd050bd..8e3927cdcf 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -636,6 +636,14 @@ USER and PASSWORD should be non-nil." (base64-encode-string (concat "\0" user "\0" password) t)) 235)) +(cl-defmethod smtpmail-try-auth-method + (process (_mech (eql xoauth2)) user password) + (smtpmail-command-or-throw + process + (concat "AUTH XOAUTH2 " + (base64-encode-string + (concat "user=" user "\1auth=Bearer " password "\1\1") t)))) + (defun smtpmail-response-code (string) (when string (with-temp-buffer