From b58fd1eab9e7a07711b63f5ce67d518972efaba9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Jan 2021 16:32:00 +0200 Subject: [PATCH 001/107] ; * lisp/language/cham.el: Fix copy-paste mistake in comment. --- lisp/language/cham.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/language/cham.el b/lisp/language/cham.el index 4749f2e8db4..be1a6b4f4c1 100644 --- a/lisp/language/cham.el +++ b/lisp/language/cham.el @@ -23,7 +23,7 @@ ;;; Commentary: -;; Tai Viet is being included in the Unicode at the range U+AA80..U+AADF. +;; Cham script is included in the Unicode at the range U+AA00..U+AA5F. ;;; Code: From 82c228a017cfbb69ac5a91fba51419eb3b1f7032 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 20 Jan 2021 09:52:07 -0500 Subject: [PATCH 002/107] Don't let `maybe_quit` prevent resetting `consing_until_gc` (bug#43389) * src/alloc.c (garbage_collect): Postpone `unblock_input` a bit. * src/window.c (window_parameter): Avoid `maybe_quit`. cherry picked from commit 420661af07448857f0a17e15dc27bceeb6aff541 --- src/alloc.c | 6 ++++-- src/window.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index ebd99b9f65b..4c76f4a554e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -5987,11 +5987,13 @@ garbage_collect (void) gc_in_progress = 0; - unblock_input (); - consing_until_gc = gc_threshold = consing_threshold (gc_cons_threshold, Vgc_cons_percentage, 0); + /* Unblock *after* re-setting `consing_until_gc` in case `unblock_input` + signals an error (see bug#43389). */ + unblock_input (); + if (garbage_collection_messages && NILP (Vmemory_full)) { if (message_p || minibuf_level > 0) diff --git a/src/window.c b/src/window.c index 43f2a8f00f2..f231187f7b3 100644 --- a/src/window.c +++ b/src/window.c @@ -2272,7 +2272,7 @@ return value is a list of elements of the form (PARAMETER . VALUE). */) Lisp_Object window_parameter (struct window *w, Lisp_Object parameter) { - Lisp_Object result = Fassq (parameter, w->window_parameters); + Lisp_Object result = assq_no_quit (parameter, w->window_parameters); return CDR_SAFE (result); } From ee1c54ebc01bc377dce99af891730c1a53cc3f86 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Jan 2021 09:57:19 +0200 Subject: [PATCH 003/107] Improve documentation of sendmail.el defcustom's * lisp/mail/sendmail.el (mail-archive-file-name) (mail-default-reply-to, mail-self-blind, mail-default-headers): Say in the doc string that 'message-default-mail-headers' shall be customized when using 'message-mode' for email composition. (Bug#46029) --- lisp/mail/sendmail.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index ad1a02734c8..15f7f224028 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -104,7 +104,9 @@ being sent is used), or nil (in which case the value of (defcustom mail-self-blind nil "Non-nil means insert Bcc to self in messages to be sent. This is done when the message is initialized, -so you can remove or alter the Bcc field to override the default." +so you can remove or alter the Bcc field to override the default. +If you are using `message-mode' to compose messages, customize the +variable `message-default-mail-headers' instead." :type 'boolean) ;;;###autoload @@ -172,14 +174,18 @@ This is used by the default mail-sending commands. See also (defcustom mail-archive-file-name nil "Name of file to write all outgoing messages in, or nil for none. This is normally an mbox file, but for backwards compatibility may also -be a Babyl file." +be a Babyl file. +If you are using `message-mode' to compose messages, customize the +variable `message-default-mail-headers' instead." :type '(choice file (const nil))) ;;;###autoload (defcustom mail-default-reply-to nil "Address to insert as default Reply-To field of outgoing messages. If nil, it will be initialized from the REPLYTO environment variable -when you first send mail." +when you first send mail. +If you are using `message-mode' to compose messages, customize the +variable `message-default-mail-headers' instead." :type '(choice (const nil) string)) (defcustom mail-alias-file nil @@ -388,7 +394,9 @@ in `message-auto-save-directory'." (defcustom mail-default-headers nil "A string containing header lines, to be inserted in outgoing messages. It can contain newlines, and should end in one. It is inserted -before you edit the message, so you can edit or delete the lines." +before you edit the message, so you can edit or delete the lines. +If you are using `message-mode' to compose messages, customize the +variable `message-default-mail-headers' instead." :type '(choice (const nil) string)) (defcustom mail-bury-selects-summary t From 009df5cb3cec5108a66538503bd63a8bd6f8addf Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Jan 2021 10:10:21 +0200 Subject: [PATCH 004/107] * src/cmds.c (Fforward_line): Doc fix. (Bug#46027) --- src/cmds.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cmds.c b/src/cmds.c index 102135359fb..c771eeb9683 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -108,6 +108,7 @@ DEFUN ("forward-line", Fforward_line, Sforward_line, 0, 1, "^p", Precisely, if point is on line I, move to the start of line I + N \("start of line" in the logical order). If there isn't room, go as far as possible (no error). +Interactively, N is the numeric prefix argument and defaults to 1. Returns the count of lines left to move. If moving forward, that is N minus number of lines moved; if backward, N plus number From 3f610177adb844248fe37f52eb713d462e833a62 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Jan 2021 14:30:22 +0200 Subject: [PATCH 005/107] Avoid sending systemd shutdown notifications if non-daemon * src/emacs.c (Fkill_emacs): Send the shutdown notification only in daemon mode. (Bug#46022) --- src/emacs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/emacs.c b/src/emacs.c index f2e858f13bb..67220ebb769 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -187,7 +187,8 @@ bool build_details; /* Name for the server started by the daemon.*/ static char *daemon_name; -/* 0 not a daemon, 1 new-style (foreground), 2 old-style (background). */ +/* 0 not a daemon, 1 new-style (foreground), 2 old-style (background). + A negative value means the daemon initialization was already done. */ int daemon_type; #ifndef WINDOWSNT @@ -2371,7 +2372,10 @@ all of which are called before Emacs is actually killed. */ int exit_code; #ifdef HAVE_LIBSYSTEMD - sd_notify(0, "STOPPING=1"); + /* Notify systemd we are shutting down, but only if we have notified + it about startup. */ + if (daemon_type == -1) + sd_notify(0, "STOPPING=1"); #endif /* HAVE_LIBSYSTEMD */ /* Fsignal calls emacs_abort () if it sees that waiting_for_input is @@ -2876,7 +2880,7 @@ from the parent process and its tty file descriptors. */) } /* Set it to an invalid value so we know we've already run this function. */ - daemon_type = -1; + daemon_type = -daemon_type; #else /* WINDOWSNT */ /* Signal the waiting emacsclient process. */ From c8fa056a50586429be37fc5bfde8226c4b6cefa2 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 22 Jan 2021 21:07:35 +0100 Subject: [PATCH 006/107] Mention undo-amalgamate-change-group in the lispref manual * doc/lispref/text.texi (Atomic Changes): Mention undo-amalgamate-change-group (bug#42303). (cherry picked from commit ba25a82855a2c03c25fec83f3056c166b692e94f) --- doc/lispref/text.texi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 06975f76706..5eead42031d 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -5559,6 +5559,11 @@ This function accepts all the changes in the change group specified by @defun cancel-change-group handle This function cancels and undoes all the changes in the change group specified by @var{handle}. +@end defun + +@defun undo-amalgamate-change-group +Amalgamate changes in change-group since @var{handle}. I.e., remove +all undo boundaries between the state of @var{handle} and now. @end defun Your code should use @code{unwind-protect} to make sure the group is From 3443a1c698790fca0481178f08dcb45cca576a30 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Jan 2021 11:28:32 +0200 Subject: [PATCH 007/107] Fix last change * doc/lispref/text.texi (Undo): Add a cross-reference to the description of 'undo-amalgamate-change-group'. (Atomic Changes): Expand and improve the description of 'undo-amalgamate-change-group'. (Bug#42303) --- doc/lispref/text.texi | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 5eead42031d..89582acd35a 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -1422,6 +1422,11 @@ the @code{amalgamating-undo-limit} variable. If this variable is 1, no changes are amalgamated. @end defun +A Lisp program can amalgamate a series of changes into a single change +group by calling @code{undo-amalgamate-change-group} (@pxref{Atomic +Changes}). Note that @code{amalgamating-undo-limit} has no effect on +the groups produced by that function. + @defvar undo-auto-current-boundary-timer Some buffers, such as process buffers, can change even when no commands are executing. In these cases, @code{undo-boundary} is @@ -5561,9 +5566,17 @@ This function cancels and undoes all the changes in the change group specified by @var{handle}. @end defun + You can cause some or all of the changes in a change group to be +considered as a single unit for the purposes of the @code{undo} +commands (@pxref{Undo}) by using @code{undo-amalgamate-change-group}. + @defun undo-amalgamate-change-group -Amalgamate changes in change-group since @var{handle}. I.e., remove -all undo boundaries between the state of @var{handle} and now. +Amalgamate all the changes made in the change-group since the state +identified by @var{handle}. This function removes all undo boundaries +between undo records of changes since the state described by +@var{handle}. Usually, @var{handle} is the handle returned by +@code{prepare-change-group}, in which case all the changes since the +beginning of the change-group are amalgamated into a single undo unit. @end defun Your code should use @code{unwind-protect} to make sure the group is From 0399cc2ab5cc64129d7e9030db7db76689e3a095 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 23 Jan 2021 02:53:12 +0200 Subject: [PATCH 008/107] Erase the buffer only after fetching the new contents * lisp/progmodes/xref.el (xref-revert-buffer): Erase the buffer only after fetching the new contents (bug#46042). (cherry picked from commit 5821dee0949b2913c07970d6e4b8bb8e8a35f036) --- lisp/progmodes/xref.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index e55d2958617..7f5e76c7409 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -876,10 +876,10 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." (let ((inhibit-read-only t) (buffer-undo-list t)) (save-excursion - (erase-buffer) (condition-case err - (xref--insert-xrefs - (xref--analyze (funcall xref--fetcher))) + (let ((alist (xref--analyze (funcall xref--fetcher)))) + (erase-buffer) + (xref--insert-xrefs alist)) (user-error (insert (propertize From 809503431d47afb9d20e8463853298a595e1fcb2 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 23 Jan 2021 02:58:53 +0200 Subject: [PATCH 009/107] ; xref-revert-buffer: Drop the (goto-char) at the end (cherry picked from commit cc98d0bf5225c281f91152aa838c4cb093df52e9) --- lisp/progmodes/xref.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 7f5e76c7409..0b25110b79b 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -884,8 +884,7 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." (insert (propertize (error-message-string err) - 'face 'error)))) - (goto-char (point-min))))) + 'face 'error))))))) (defun xref--show-defs-buffer (fetcher alist) (let ((xrefs (funcall fetcher))) From 8f28a1b9da06a12ac3631de38119d8845f14499c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 24 Jan 2021 21:31:09 +0100 Subject: [PATCH 010/107] Tweak `condition-case' keyword highlights * lisp/emacs-lisp/lisp-mode.el (lisp--el-non-funcall-position-p): Tweak `condition-case' position check to skip the VAR form. --- lisp/emacs-lisp/lisp-mode.el | 7 +++++-- test/lisp/progmodes/elisp-mode-tests.el | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 8780c5dcd30..34ecfd1c254 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -234,8 +234,11 @@ (< pos (point)))) (and (eq parent 'condition-case) (progn - (forward-sexp 2) - (< (point) pos)))))))))) + (forward-sexp 1) + ;; If we're in the second form, then we're in + ;; a funcall position. + (not (< (point) pos (progn (forward-sexp 1) + (point))))))))))))) (defun lisp--el-match-keyword (limit) ;; FIXME: Move to elisp-mode.el. diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 0da0e393535..714751eafc8 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -877,7 +877,7 @@ to (xref-elisp-test-descr-to-target xref)." "(\\(if\\)") nil))) -(ert-deftest test-elisp-font-keywords-if () +(ert-deftest test-elisp-font-keywords-4 () :expected-result :failed ; FIXME bug#43265 (should (eq (test--font '(condition-case nil (foo) @@ -885,5 +885,12 @@ to (xref-elisp-test-descr-to-target xref)." "(\\(if\\)") nil))) +(ert-deftest test-elisp-font-keywords-5 () + (should (eq (test--font '(condition-case (when a) + (foo) + (error t)) + "(\\(when\\)") + nil))) + (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here From 196be2bf12e1018335e4261cd4d6f25d6d16c415 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 24 Jan 2021 21:43:25 +0100 Subject: [PATCH 011/107] Fix macro fontification in `condition-case' handler bodies * lisp/emacs-lisp/lisp-mode.el (lisp--el-non-funcall-position-p): Fontify macros in the BODY of HANDLERS in `condition-case' correctly (bug#43265). --- lisp/emacs-lisp/lisp-mode.el | 15 +++++++++------ test/lisp/progmodes/elisp-mode-tests.el | 1 - 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 34ecfd1c254..9c2b0dbe200 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -233,12 +233,15 @@ (forward-sexp 1) (< pos (point)))) (and (eq parent 'condition-case) - (progn - (forward-sexp 1) - ;; If we're in the second form, then we're in - ;; a funcall position. - (not (< (point) pos (progn (forward-sexp 1) - (point))))))))))))) + ;; If (cdr paren-posns), then we're in the BODY + ;; of HANDLERS. + (and (not (cdr paren-posns)) + (progn + (forward-sexp 1) + ;; If we're in the second form, then we're in + ;; a funcall position. + (not (< (point) pos (progn (forward-sexp 1) + (point)))))))))))))) (defun lisp--el-match-keyword (limit) ;; FIXME: Move to elisp-mode.el. diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 714751eafc8..e84184ff07d 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -864,7 +864,6 @@ to (xref-elisp-test-descr-to-target xref)." 'nil))) (ert-deftest test-elisp-font-keywords-2 () - :expected-result :failed ; FIXME bug#43265 (should (eq (test--font '(condition-case nil (foo) (error (when a b))) From 9503f8d96cc89fa89bb68e183c79f0d9cb1b4d32 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 24 Jan 2021 23:25:52 +0100 Subject: [PATCH 012/107] Rewrite lisp--el-funcall-position-p to be inverse of the -not function * lisp/emacs-lisp/lisp-mode.el (lisp--el-funcall-position-p): Rename and rewrite to return the inverse value. Non-inverted predicate functions are easier to reason about. (lisp--el-non-funcall-position-p): Make obsolete. --- lisp/emacs-lisp/lisp-mode.el | 81 +++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 9c2b0dbe200..22435d59659 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -200,48 +200,54 @@ res)) (defun lisp--el-non-funcall-position-p (pos) + "Heuristically determine whether POS is an evaluated position." + (declare (obsolete lisp--el-funcall-position-p "28.1")) + (not (lisp--el-funcall-position-p pos))) + +(defun lisp--el-funcall-position-p (pos) "Heuristically determine whether POS is an evaluated position." (save-match-data (save-excursion (ignore-errors (goto-char pos) ;; '(lambda ..) is not a funcall position, but #'(lambda ...) is. - (or (and (eql (char-before) ?\') - (not (eql (char-before (1- (point))) ?#))) - (let* ((ppss (syntax-ppss)) - (paren-posns (nth 9 ppss)) - (parent - (when paren-posns - (goto-char (car (last paren-posns))) ;(up-list -1) - (cond - ((ignore-errors - (and (eql (char-after) ?\() - (when (cdr paren-posns) - (goto-char (car (last paren-posns 2))) - (looking-at "(\\_")))) - (goto-char (match-end 0)) - 'let) - ((looking-at - (rx "(" - (group-n 1 (+ (or (syntax w) (syntax _)))) - symbol-end)) - (prog1 (intern-soft (match-string-no-properties 1)) - (goto-char (match-end 1)))))))) - (or (eq parent 'declare) - (and (eq parent 'let) - (progn - (forward-sexp 1) - (< pos (point)))) - (and (eq parent 'condition-case) - ;; If (cdr paren-posns), then we're in the BODY - ;; of HANDLERS. - (and (not (cdr paren-posns)) - (progn - (forward-sexp 1) - ;; If we're in the second form, then we're in - ;; a funcall position. - (not (< (point) pos (progn (forward-sexp 1) - (point)))))))))))))) + (if (eql (char-before) ?\') + (eql (char-before (1- (point))) ?#) + (let* ((ppss (syntax-ppss)) + (paren-posns (nth 9 ppss)) + (parent + (when paren-posns + (goto-char (car (last paren-posns))) ;(up-list -1) + (cond + ((ignore-errors + (and (eql (char-after) ?\() + (when (cdr paren-posns) + (goto-char (car (last paren-posns 2))) + (looking-at "(\\_")))) + (goto-char (match-end 0)) + 'let) + ((looking-at + (rx "(" + (group-n 1 (+ (or (syntax w) (syntax _)))) + symbol-end)) + (prog1 (intern-soft (match-string-no-properties 1)) + (goto-char (match-end 1)))))))) + (pcase parent + ('declare nil) + ('let + (forward-sexp 1) + (>= pos (point))) + ('condition-case + ;; If (cdr paren-posns), then we're in the BODY + ;; of HANDLERS. + (or (cdr paren-posns) + (progn + (forward-sexp 1) + ;; If we're in the second form, then we're in + ;; a funcall position. + (< (point) pos (progn (forward-sexp 1) + (point)))))) + (_ t)))))))) (defun lisp--el-match-keyword (limit) ;; FIXME: Move to elisp-mode.el. @@ -254,8 +260,7 @@ (when (or (special-form-p sym) (and (macrop sym) (not (get sym 'no-font-lock-keyword)) - (not (lisp--el-non-funcall-position-p - (match-beginning 0))))) + (lisp--el-funcall-position-p (match-beginning 0)))) (throw 'found t)))))) (defmacro let-when-compile (bindings &rest body) From a10c74fbea46d5299e19167248383c69fd30648c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 25 Jan 2021 07:44:29 +0100 Subject: [PATCH 013/107] Fontify special forms and macros the same * lisp/emacs-lisp/lisp-mode.el (lisp--el-match-keyword): Handle special forms and macros the same way (bug#43265). This makes things like (setq a '(if a b)) be fontified correctly (i.e., not fontified as a keyword). --- lisp/emacs-lisp/lisp-mode.el | 7 +++---- test/lisp/progmodes/elisp-mode-tests.el | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 22435d59659..c96d849d442 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -257,10 +257,9 @@ (concat "(\\(" lisp-mode-symbol-regexp "\\)\\_>")) limit t) (let ((sym (intern-soft (match-string 1)))) - (when (or (special-form-p sym) - (and (macrop sym) - (not (get sym 'no-font-lock-keyword)) - (lisp--el-funcall-position-p (match-beginning 0)))) + (when (and (or (special-form-p sym) (macrop sym)) + (not (get sym 'no-font-lock-keyword)) + (lisp--el-funcall-position-p (match-beginning 0))) (throw 'found t)))))) (defmacro let-when-compile (bindings &rest body) diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index e84184ff07d..badcad670c2 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -871,7 +871,6 @@ to (xref-elisp-test-descr-to-target xref)." 'font-lock-keyword-face))) (ert-deftest test-elisp-font-keywords-3 () - :expected-result :failed ; FIXME bug#43265 (should (eq (test--font '(setq a '(if when zot)) "(\\(if\\)") nil))) From 49e01d85ed6a6e4c95d43b6eeb4f32c7daa319a7 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 25 Jan 2021 19:14:22 +0200 Subject: [PATCH 014/107] Don't move point to the prompt in previous-line-or-history-element (bug#46033) * lisp/simple.el (previous-line-or-history-element): Avoid moving point to the prompt. --- lisp/simple.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 8d4e4a7a6bb..c878fdab921 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2476,7 +2476,10 @@ previous element of the minibuffer history in the minibuffer." (current-column))))) (condition-case nil (with-no-warnings - (previous-line arg)) + (previous-line arg) + ;; Avoid moving point to the prompt + (when (< (point) (minibuffer-prompt-end)) + (signal 'beginning-of-buffer nil))) (beginning-of-buffer ;; Restore old position since `line-move-visual' moves point to ;; the beginning of the line when it fails to go to the previous line. From 8f0a2c84b66ff8d45a9d088a181617417115ec9e Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 26 Jan 2021 01:12:45 +0100 Subject: [PATCH 015/107] Make subdirs . nil in dir-locals in ~/ work * lisp/files.el (dir-locals-collect-variables): Compare directory names after expanding. This makes a (subdirs . nil) in ~/ work as expected (bug#17205). Test case: ((nil . ((a . "hallo") (subdirs . nil)))) in ~/ --- lisp/files.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/files.el b/lisp/files.el index 7af5549bcb0..77e3a3a834c 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4068,7 +4068,7 @@ Return the new variables list." ;; integer values for subdir, where N means ;; variables apply to this directory and N levels ;; below it (0 == nil). - (equal root default-directory)) + (equal root (expand-file-name default-directory))) (setq variables (dir-locals-collect-mode-variables alist variables)))))))) (error From b4b6a2684062d4470143b6ea460b5e82012554a1 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 25 Jan 2021 22:58:19 -0500 Subject: [PATCH 016/107] Use `lexical-binding` in all `lisp/international` files * lisp/startup.el (keyboard-type): Make obsolete and lex-bound. * admin/unidata/unidata-gen.el (unidata-gen-file) (unidata-gen-charprop): Mark the generated files to use lexical binding. * lisp/international/isearch-x.el: Use lexical-binding. (junk-hist): Declare locally. * lisp/international/iso-cvt.el: * lisp/international/utf-7.el: * lisp/international/robin.el: * lisp/international/ogonek.el: * lisp/international/latin1-disp.el: * lisp/international/kkc.el: * lisp/international/kinsoku.el: * lisp/international/ja-dic-utl.el: Use lexical-binding. * lisp/international/ja-dic-cnv.el: Use lexical-binding. (skkdic-breakup-string): Remove unused var `kana-len`. * lisp/international/latexenc.el: Use lexical-binding. (tex-start-of-header): Declare. * lisp/international/mule-diag.el: Use lexical-binding. (list-character-sets): Remove unused var `pos`. (list-character-sets-1): Remove unused vars `tail` and `charset`. (list-charset-chars): Remove unused vars `chars` and `plane`. (describe-coding-system): Remove unused var `extra-spec`. (mule--print-opened): New var. (print-fontset): Bind it. (print-fontset-element): Use it instead of `print-opened`. * lisp/international/quail.el: Use lexical-binding. (quail-start-translation, quail-start-conversion): Remove unused var `generated-events`. (quail-help-insert-keymap-description): Use local dynbound var `the-keymap`. --- admin/unidata/unidata-gen.el | 6 ++++-- etc/NEWS | 2 ++ lisp/international/isearch-x.el | 5 +++-- lisp/international/iso-cvt.el | 24 ++++++++++++------------ lisp/international/ja-dic-cnv.el | 8 ++++---- lisp/international/ja-dic-utl.el | 2 +- lisp/international/kinsoku.el | 2 +- lisp/international/kkc.el | 2 +- lisp/international/latexenc.el | 4 +++- lisp/international/latin1-disp.el | 19 +++++++++---------- lisp/international/mule-diag.el | 27 +++++++++++++++------------ lisp/international/ogonek.el | 2 +- lisp/international/quail.el | 16 +++++++++------- lisp/international/robin.el | 2 +- lisp/international/utf-7.el | 2 +- lisp/startup.el | 2 ++ 16 files changed, 69 insertions(+), 56 deletions(-) diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el index 3918853088f..221c9b104e0 100644 --- a/admin/unidata/unidata-gen.el +++ b/admin/unidata/unidata-gen.el @@ -1416,7 +1416,8 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)." (or elt (user-error "Unknown output file: %s" basename)) (or noninteractive (message "Generating %s..." file)) (with-temp-file file - (insert ";; " copyright " + (insert ";;; " basename " -*- lexical-binding:t -*- +;; " copyright " ;; Generated from Unicode data files by unidata-gen.el. ;; The sources for this file are found in the admin/unidata/ directory in ;; the Emacs sources. The Unicode data files are used under the @@ -1451,7 +1452,8 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)." (defun unidata-gen-charprop (&optional charprop-file) (or charprop-file (setq charprop-file (pop command-line-args-left))) (with-temp-file charprop-file - (insert ";; Automatically generated by unidata-gen.el.\n" + (insert ";; Automatically generated by unidata-gen.el." + " -*- lexical-binding: t -*-\n" ";; See the admin/unidata/ directory in the Emacs sources.\n") (dolist (elt unidata-file-alist) (dolist (proplist (cdr elt)) diff --git a/etc/NEWS b/etc/NEWS index 6a80493e239..b815d3ac61b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2133,6 +2133,8 @@ obsolete back in Emacs-23.1. The affected functions are: make-obsolete, define-obsolete-function-alias, make-obsolete-variable, define-obsolete-variable-alias. +** The variable 'keyboard-type' is obsolete and not dynamically scoped any more + * Lisp Changes in Emacs 28.1 diff --git a/lisp/international/isearch-x.el b/lisp/international/isearch-x.el index 400421ddb23..b890bde48d1 100644 --- a/lisp/international/isearch-x.el +++ b/lisp/international/isearch-x.el @@ -1,4 +1,4 @@ -;;; isearch-x.el --- extended isearch handling commands +;;; isearch-x.el --- extended isearch handling commands -*- lexical-binding: t; -*- ;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -67,7 +67,7 @@ ;; Exit from recursive edit safely. Set in `after-change-functions' ;; by isearch-with-keyboard-coding. -(defun isearch-exit-recursive-edit (start end length) +(defun isearch-exit-recursive-edit (_start _end _length) (interactive) (throw 'exit nil)) @@ -102,6 +102,7 @@ ;;;###autoload (defun isearch-process-search-multibyte-characters (last-char &optional count) + (defvar junk-hist) (if (eq this-command 'isearch-printing-char) (let ((overriding-terminal-local-map nil) (prompt (isearch-message-prefix)) diff --git a/lisp/international/iso-cvt.el b/lisp/international/iso-cvt.el index 3f3843e23dd..ead7c8aa619 100644 --- a/lisp/international/iso-cvt.el +++ b/lisp/international/iso-cvt.el @@ -1,4 +1,4 @@ -;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- coding: utf-8 -*- +;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- lexical-binding: t; -*- ;; This file was formerly called gm-lingo.el. ;; Copyright (C) 1993-1998, 2000-2021 Free Software Foundation, Inc. @@ -79,7 +79,7 @@ (point-max)))) ;;;###autoload -(defun iso-spanish (from to &optional buffer) +(defun iso-spanish (from to &optional _buffer) "Translate net conventions for Spanish to ISO 8859-1. Translate the region between FROM and TO using the table `iso-spanish-trans-tab'. @@ -121,7 +121,7 @@ and may translate too little.") "Currently active translation table for German.") ;;;###autoload -(defun iso-german (from to &optional buffer) +(defun iso-german (from to &optional _buffer) "Translate net conventions for German to ISO 8859-1. Translate the region FROM and TO using the table `iso-german-trans-tab'. @@ -194,7 +194,7 @@ Optional arg BUFFER is ignored (for use in `format-alist')." "Translation table for translating ISO 8859-1 characters to TeX sequences.") ;;;###autoload -(defun iso-iso2tex (from to &optional buffer) +(defun iso-iso2tex (from to &optional _buffer) "Translate ISO 8859-1 characters to TeX sequences. Translate the region between FROM and TO using the table `iso-iso2tex-trans-tab'. @@ -387,7 +387,7 @@ This table is not exhaustive (and due to TeX's power can never be). It only contains commonly used sequences.") ;;;###autoload -(defun iso-tex2iso (from to &optional buffer) +(defun iso-tex2iso (from to &optional _buffer) "Translate TeX sequences to ISO 8859-1 characters. Translate the region between FROM and TO using the table `iso-tex2iso-trans-tab'. @@ -646,7 +646,7 @@ It only contains commonly used sequences.") "Translation table for translating ISO 8859-1 characters to German TeX.") ;;;###autoload -(defun iso-gtex2iso (from to &optional buffer) +(defun iso-gtex2iso (from to &optional _buffer) "Translate German TeX sequences to ISO 8859-1 characters. Translate the region between FROM and TO using the table `iso-gtex2iso-trans-tab'. @@ -655,7 +655,7 @@ Optional arg BUFFER is ignored (for use in `format-alist')." (iso-translate-conventions from to iso-gtex2iso-trans-tab)) ;;;###autoload -(defun iso-iso2gtex (from to &optional buffer) +(defun iso-iso2gtex (from to &optional _buffer) "Translate ISO 8859-1 characters to German TeX sequences. Translate the region between FROM and TO using the table `iso-iso2gtex-trans-tab'. @@ -674,7 +674,7 @@ Optional arg BUFFER is ignored (for use in `format-alist')." "Translation table for translating ISO 8859-1 characters to Duden sequences.") ;;;###autoload -(defun iso-iso2duden (from to &optional buffer) +(defun iso-iso2duden (from to &optional _buffer) "Translate ISO 8859-1 characters to Duden sequences. Translate the region between FROM and TO using the table `iso-iso2duden-trans-tab'. @@ -812,7 +812,7 @@ Optional arg BUFFER is ignored (for use in `format-alist')." ("ÿ" "ÿ"))) ;;;###autoload -(defun iso-iso2sgml (from to &optional buffer) +(defun iso-iso2sgml (from to &optional _buffer) "Translate ISO 8859-1 characters in the region to SGML entities. Use entities from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\". Optional arg BUFFER is ignored (for use in `format-alist')." @@ -820,7 +820,7 @@ Optional arg BUFFER is ignored (for use in `format-alist')." (iso-translate-conventions from to iso-iso2sgml-trans-tab)) ;;;###autoload -(defun iso-sgml2iso (from to &optional buffer) +(defun iso-sgml2iso (from to &optional _buffer) "Translate SGML entities in the region to ISO 8859-1 characters. Use entities from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\". Optional arg BUFFER is ignored (for use in `format-alist')." @@ -828,13 +828,13 @@ Optional arg BUFFER is ignored (for use in `format-alist')." (iso-translate-conventions from to iso-sgml2iso-trans-tab)) ;;;###autoload -(defun iso-cvt-read-only (&rest ignore) +(defun iso-cvt-read-only (&rest _ignore) "Warn that format is read-only." (interactive) (error "This format is read-only; specify another format for writing")) ;;;###autoload -(defun iso-cvt-write-only (&rest ignore) +(defun iso-cvt-write-only (&rest _ignore) "Warn that format is write-only." (interactive) (error "This format is write-only")) diff --git a/lisp/international/ja-dic-cnv.el b/lisp/international/ja-dic-cnv.el index b80590491c1..155c85fb42f 100644 --- a/lisp/international/ja-dic-cnv.el +++ b/lisp/international/ja-dic-cnv.el @@ -1,4 +1,4 @@ -;;; ja-dic-cnv.el --- convert a Japanese dictionary (SKK-JISYO.L) to Emacs Lisp +;;; ja-dic-cnv.el --- convert a Japanese dictionary (SKK-JISYO.L) to Emacs Lisp -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2021 Free Software Foundation, Inc. @@ -96,7 +96,7 @@ ("もく" "目") ("ゆき" "行"))) -(defun skkdic-convert-postfix (skkbuf buf) +(defun skkdic-convert-postfix (_skkbuf buf) (byte-compile-info "Processing POSTFIX entries" t) (goto-char (point-min)) (with-current-buffer buf @@ -150,7 +150,7 @@ (defconst skkdic-prefix-list '(skkdic-prefix-list)) -(defun skkdic-convert-prefix (skkbuf buf) +(defun skkdic-convert-prefix (_skkbuf buf) (byte-compile-info "Processing PREFIX entries" t) (goto-char (point-min)) (with-current-buffer buf @@ -209,7 +209,7 @@ (substring str from idx) skkdic-word-list))) (if (or (and (consp kana2-list) - (let ((kana-len (length kana)) + (let (;; (kana-len (length kana)) kana2) (catch 'skkdic-tag (while kana2-list diff --git a/lisp/international/ja-dic-utl.el b/lisp/international/ja-dic-utl.el index 498fb23f707..cc636986f99 100644 --- a/lisp/international/ja-dic-utl.el +++ b/lisp/international/ja-dic-utl.el @@ -1,4 +1,4 @@ -;;; ja-dic-utl.el --- utilities for handling Japanese dictionary (SKK-JISYO.L) +;;; ja-dic-utl.el --- utilities for handling Japanese dictionary (SKK-JISYO.L) -*- lexical-binding: t; -*- ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, ;; 2005, 2006, 2007, 2008, 2009, 2010, 2011 diff --git a/lisp/international/kinsoku.el b/lisp/international/kinsoku.el index cd740acc6ac..05179a98ac2 100644 --- a/lisp/international/kinsoku.el +++ b/lisp/international/kinsoku.el @@ -1,4 +1,4 @@ -;;; kinsoku.el --- `Kinsoku' processing funcs +;;; kinsoku.el --- `Kinsoku' processing funcs -*- lexical-binding: t; -*- ;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/international/kkc.el b/lisp/international/kkc.el index 290f4fa0cf1..87f73897bf6 100644 --- a/lisp/international/kkc.el +++ b/lisp/international/kkc.el @@ -1,4 +1,4 @@ -;;; kkc.el --- Kana Kanji converter +;;; kkc.el --- Kana Kanji converter -*- lexical-binding: t; -*- ;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/international/latexenc.el b/lisp/international/latexenc.el index e2ee3fb37e3..ff7cddcb26e 100644 --- a/lisp/international/latexenc.el +++ b/lisp/international/latexenc.el @@ -1,4 +1,4 @@ -;;; latexenc.el --- guess correct coding system in LaTeX files -*-coding: utf-8 -*- +;;; latexenc.el --- guess correct coding system in LaTeX files -*- lexical-binding: t; -*- ;; Copyright (C) 2005-2021 Free Software Foundation, Inc. @@ -109,6 +109,8 @@ Return nil if no matching input encoding can be found." (defvar latexenc-dont-use-tex-guess-main-file-flag nil "Non-nil means don't use tex-guessmain-file to find the coding system.") +(defvar tex-start-of-header) + ;;;###autoload (defun latexenc-find-file-coding-system (arg-list) "Determine the coding system of a LaTeX file if it uses \"inputenc.sty\". diff --git a/lisp/international/latin1-disp.el b/lisp/international/latin1-disp.el index bda2c51ab9d..4b6ef9833e5 100644 --- a/lisp/international/latin1-disp.el +++ b/lisp/international/latin1-disp.el @@ -1,4 +1,4 @@ -;;; latin1-disp.el --- display tables for other ISO 8859 on Latin-1 terminals -*-coding: utf-8;-*- +;;; latin1-disp.el --- display tables for other ISO 8859 on Latin-1 terminals -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2021 Free Software Foundation, Inc. @@ -86,8 +86,8 @@ use either \\[customize] or the function `latin1-display'." :group 'latin1-display :type 'boolean :require 'latin1-disp - :initialize 'custom-initialize-default - :set (lambda (symbol value) + :initialize #'custom-initialize-default + :set (lambda (_symbol value) (if value (apply #'latin1-display latin1-display-sets) (latin1-display)))) @@ -186,7 +186,7 @@ character set." 'arabic-iso8859-6 (car (remq 'ascii (get-language-info language 'charset)))))) - (map-charset-chars #'(lambda (range arg) + (map-charset-chars #'(lambda (range _arg) (standard-display-default (car range) (cdr range))) charset)) (sit-for 0)) @@ -201,11 +201,10 @@ character set: `latin-2', `hebrew' etc." (char (and info (decode-char (car (remq 'ascii info)) ?\ )))) (and char (char-displayable-p char)))) -(defun latin1-display-setup (set &optional force) +(defun latin1-display-setup (set &optional _force) "Set up Latin-1 display for characters in the given SET. SET must be a member of `latin1-display-sets'. Normally, check -whether a font for SET is available and don't set the display if it -is. If FORCE is non-nil, set up the display regardless." +whether a font for SET is available and don't set the display if it is." (cond ((eq set 'latin-2) (latin1-display-identities set) @@ -735,7 +734,7 @@ is. If FORCE is non-nil, set up the display regardless." (sit-for 0)) ;;;###autoload -(defcustom latin1-display-ucs-per-lynx nil +(defcustom latin1-display-ucs-per-lynx nil ;FIXME: Isn't this a minor mode? "Set up Latin-1/ASCII display for Unicode characters. This uses the transliterations of the Lynx browser. The display isn't changed if the display can render Unicode characters. @@ -745,8 +744,8 @@ use either \\[customize] or the function `latin1-display'." :group 'latin1-display :type 'boolean :require 'latin1-disp - :initialize 'custom-initialize-default - :set (lambda (symbol value) + :initialize #'custom-initialize-default + :set (lambda (_symbol value) (if value (latin1-display-ucs-per-lynx 1) (latin1-display-ucs-per-lynx -1)))) diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index d6222685251..d97d090cd08 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -1,4 +1,4 @@ -;;; mule-diag.el --- show diagnosis of multilingual environment (Mule) +;;; mule-diag.el --- show diagnosis of multilingual environment (Mule) -*- lexical-binding: t; -*- ;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -86,8 +86,7 @@ but still shows the full information." (indent-to 48) (insert "| +--CHARS\n") (let ((columns '(("CHARSET-NAME" . name) "\t\t\t\t\t" - ("D CH FINAL-BYTE" . iso-spec))) - pos) + ("D CH FINAL-BYTE" . iso-spec)))) (while columns (if (stringp (car columns)) (insert (car columns)) @@ -117,8 +116,8 @@ but still shows the full information." SORT-KEY should be `name' or `iso-spec' (default `name')." (or sort-key (setq sort-key 'name)) - (let ((tail charset-list) - charset-info-list supplementary-list charset sort-func) + (let (;; (tail charset-list) + charset-info-list supplementary-list sort-func) (dolist (charset charset-list) ;; Generate a list that contains all information to display. (let ((elt (list charset @@ -273,9 +272,9 @@ meanings of these arguments." (setq tab-width 4) (set-buffer-multibyte t) (let ((dim (charset-dimension charset)) - (chars (charset-chars charset)) - ;; (plane (charset-iso-graphic-plane charset)) - (plane 1) + ;; (chars (charset-chars charset)) + ;; (plane (charset-iso-graphic-plane charset)) + ;; (plane 1) (range (plist-get (charset-plist charset) :code-space)) min max min2 max2) (if (> dim 2) @@ -415,7 +414,8 @@ or provided just for backward compatibility." nil))) (print-coding-system-briefly coding-system 'doc-string) (let ((type (coding-system-type coding-system)) ;; Fixme: use this - (extra-spec (coding-system-plist coding-system))) + ;; (extra-spec (coding-system-plist coding-system)) + ) (princ "Type: ") (princ type) (cond ((eq type 'undecided) @@ -858,6 +858,8 @@ The IGNORED argument is ignored." (with-output-to-temp-buffer "*Help*" (describe-font-internal font-info))))) +(defvar mule--print-opened) + (defun print-fontset-element (val) ;; VAL has this format: ;; ((REQUESTED-FONT-NAME OPENED-FONT-NAME ...) ...) @@ -915,7 +917,7 @@ The IGNORED argument is ignored." (or adstyle "*") registry))))) ;; Insert opened font names (if any). - (if (and (boundp 'print-opened) (symbol-value 'print-opened)) + (if (bound-and-true-p mule--print-opened) (dolist (opened (cdr elt)) (insert "\n\t[" opened "]"))))))) @@ -943,8 +945,9 @@ the current buffer." " and [" (propertize "OPENED" 'face 'underline) "])") (let* ((info (fontset-info fontset)) (default-info (char-table-extra-slot info 0)) + (mule--print-opened print-opened) start1 end1 start2 end2) - (describe-vector info 'print-fontset-element) + (describe-vector info #'print-fontset-element) (when (char-table-range info nil) ;; The default of FONTSET is described. (setq start1 (re-search-backward "^default")) @@ -956,7 +959,7 @@ the current buffer." (when default-info (insert "\n ------") (put-text-property (line-beginning-position) (point) 'face 'highlight) - (describe-vector default-info 'print-fontset-element) + (describe-vector default-info #'print-fontset-element) (when (char-table-range default-info nil) ;; The default of the default fontset is described. (setq end2 (re-search-backward "^default")) diff --git a/lisp/international/ogonek.el b/lisp/international/ogonek.el index 79e446875da..e049832d58b 100644 --- a/lisp/international/ogonek.el +++ b/lisp/international/ogonek.el @@ -1,4 +1,4 @@ -;;; ogonek.el --- change the encoding of Polish diacritics +;;; ogonek.el --- change the encoding of Polish diacritics -*- lexical-binding: t; -*- ;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc. diff --git a/lisp/international/quail.el b/lisp/international/quail.el index f2ac44a8a60..9698d461535 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el @@ -1,4 +1,4 @@ -;;; quail.el --- provides simple input method for multilingual text +;;; quail.el --- provides simple input method for multilingual text -*- lexical-binding: t; -*- ;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -1046,7 +1046,7 @@ the following annotation types are supported. (quail-install-decode-map ',decode-map)))))) ;;;###autoload -(defun quail-install-map (map &optional name) +(defun quail-install-map (map &optional _name) "Install the Quail map MAP in the current Quail package. Optional 2nd arg NAME, if non-nil, is a name of Quail package for @@ -1060,7 +1060,7 @@ The installed map can be referred by the function `quail-map'." (setcar (cdr (cdr quail-current-package)) map)) ;;;###autoload -(defun quail-install-decode-map (decode-map &optional name) +(defun quail-install-decode-map (decode-map &optional _name) "Install the Quail decode map DECODE-MAP in the current Quail package. Optional 2nd arg NAME, if non-nil, is a name of Quail package for @@ -1390,7 +1390,7 @@ Return the input string." (let* ((echo-keystrokes 0) (help-char nil) (overriding-terminal-local-map (quail-translation-keymap)) - (generated-events nil) ;FIXME: What is this? + ;; (generated-events nil) ;FIXME: What is this? (input-method-function nil) (modified-p (buffer-modified-p)) last-command-event last-command this-command inhibit-record) @@ -1455,7 +1455,7 @@ Return the input string." (let* ((echo-keystrokes 0) (help-char nil) (overriding-terminal-local-map (quail-conversion-keymap)) - (generated-events nil) ;FIXME: What is this? + ;; (generated-events nil) ;FIXME: What is this? (input-method-function nil) (modified-p (buffer-modified-p)) last-command-event last-command this-command inhibit-record) @@ -2452,7 +2452,7 @@ should be made by `quail-build-decode-map' (which see)." (insert-char ?- single-trans-width) (forward-line 1) ;; Insert the key-tran pairs. - (dotimes (row rows) + (dotimes (_ rows) (let ((elt (pop single-list))) (when elt (move-to-column col) @@ -2625,12 +2625,14 @@ KEY BINDINGS FOR CONVERSION (run-hooks 'temp-buffer-show-hook))))) (defun quail-help-insert-keymap-description (keymap &optional header) + (defvar the-keymap) (let ((pos1 (point)) + (the-keymap keymap) pos2) (if header (insert header)) (save-excursion - (insert (substitute-command-keys "\\{keymap}"))) + (insert (substitute-command-keys "\\{the-keymap}"))) ;; Skip headers "key bindings", etc. (forward-line 3) (setq pos2 (point)) diff --git a/lisp/international/robin.el b/lisp/international/robin.el index 16cac07c773..55390df315f 100644 --- a/lisp/international/robin.el +++ b/lisp/international/robin.el @@ -1,4 +1,4 @@ -;;; robin.el --- yet another input method (smaller than quail) +;;; robin.el --- yet another input method (smaller than quail) -*- lexical-binding: t; -*- ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 ;; National Institute of Advanced Industrial Science and Technology (AIST) diff --git a/lisp/international/utf-7.el b/lisp/international/utf-7.el index e941abb463e..dece184ffef 100644 --- a/lisp/international/utf-7.el +++ b/lisp/international/utf-7.el @@ -1,4 +1,4 @@ -;;; utf-7.el --- utf-7 coding system +;;; utf-7.el --- utf-7 coding system -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2021 Free Software Foundation, Inc. diff --git a/lisp/startup.el b/lisp/startup.el index 7011fbf4583..60e1a200bbd 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -320,6 +320,8 @@ early init file.") This variable is used to define the proper function and keypad keys for use under X. It is used in a fashion analogous to the environment variable TERM.") +(make-obsolete-variable 'keyboard-type nil "28.1") +(internal-make-var-non-special 'keyboard-type) (defvar window-setup-hook nil "Normal hook run after loading init files and handling the command line. From ff7b1a133bfa7f2614650f8551824ffaef13fadc Mon Sep 17 00:00:00 2001 From: Alexander Miller Date: Tue, 26 Jan 2021 10:36:52 +0100 Subject: [PATCH 017/107] Add distinct controls for child frames' borders (Bug#45620) The background of the 'child-frame-border' face instead of the 'internal-border' face now controls the color of child frames' borders. The 'child-frame-border-width' frame parameter is now used for the width of child frames' borders instead of internal-border-width', though we still fall back on using the latter if the former is not set. * doc/lispref/frames.texi (Frame Layout): Mention 'child-frame-border' and 'child-frame-border-width'. (Layout Parameters): Mention 'child-frame-border-width'. * etc/NEWS: Mention new face 'child-frame-border' and frame parameter 'child-frame-border-width'. * lisp/faces.el (child-frame-border): New face. * src/dispextern.h (enum face_id): Add CHILD_FRAME_BORDER_FACE_ID. * src/frame.c (Fframe_child_frame_border_width): New function. (gui_report_frame_params): Add entry for Qchild_frame_border_width. * src/frame.h (struct frame): New slot child_frame_border_width. (FRAME_CHILD_FRAME_BORDER_WIDTH): New inlined function. * src/nsfns.m (ns_set_child_frame_border_width): New function. (Fx_create_frame): Handle Qchild_frame_border_width parameter. (ns_frame_parm_handlers): Add ns_set_child_frame_border_width. * src/nsterm.m (ns_clear_under_internal_border): Handle CHILD_FRAME_BORDER_FACE_ID. * src/w32fns.c (w32_clear_under_internal_border): Handle CHILD_FRAME_BORDER_FACE_ID. (w32_set_internal_border_width): New function. (Fx_create_frame): Handle Qchild_frame_border_width parameter. (w32_frame_parm_handlers): Add w32_set_child_frame_border_width. * src/xfaces.c (lookup_basic_face, realize_basic_faces): Handle CHILD_FRAME_BORDER_FACE_ID. * src/xfns.c (x_set_child_frame_border_width): New function. (Fx_create_frame): Handle Qchild_frame_border_width parameter. (x_frame_parm_handlers): Add x_set_child_frame_border_width. * src/xterm.c (x_clear_under_internal_border) (x_after_update_window_line): Handle CHILD_FRAME_BORDER_FACE_ID. --- doc/lispref/frames.texi | 19 ++++++++++--- etc/NEWS | 8 ++++++ lisp/faces.el | 11 +++++++- src/dispextern.h | 1 + src/frame.c | 12 +++++++++ src/frame.h | 24 +++++++++++++++-- src/nsfns.m | 19 +++++++++++++ src/nsterm.m | 10 ++++--- src/w32fns.c | 59 ++++++++++++++++++++++++++++++++++++++--- src/xfaces.c | 3 +++ src/xfns.c | 46 ++++++++++++++++++++++++++++++++ src/xterm.c | 20 +++++++++----- 12 files changed, 214 insertions(+), 18 deletions(-) diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 7f2a6f75422..ef1b661b2a0 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -694,9 +694,17 @@ parameter (@pxref{Management Parameters}). @item Internal Border The internal border is a border drawn by Emacs around the inner frame -(see below). Its width is specified by the @code{internal-border-width} -frame parameter (@pxref{Layout Parameters}). Its color is specified by -the background of the @code{internal-border} face. +(see below). The specification of its appearance depends on whether +the given frame is a child frame (@pxref{Child Frames}) or not. + +For normal frames its width is specified by the @code{internal-border-width} +frame parameter (@pxref{Layout Parameters}) and its color is specified by the +background of the @code{internal-border} face. + +For child frames its width is specified by the @code{child-frame-border-width} +frame parameter (but will use the the @code{internal-border-width} parameter as +a fallback) and its color is specified by the background of the +@code{child-frame-border} face. @item Inner Frame @cindex inner frame @@ -1790,6 +1798,11 @@ The width in pixels of the frame's outer border (@pxref{Frame Geometry}). The width in pixels of the frame's internal border (@pxref{Frame Geometry}). +@vindex child-frame-border-width@r{, a frame parameter} +@item child-frame-border-width +The width in pixels of the frame's internal border (@pxref{Frame +Geometry}) if the given frame is a child frame (@pxref{Child Frames}). + @vindex vertical-scroll-bars@r{, a frame parameter} @item vertical-scroll-bars Whether the frame has scroll bars (@pxref{Scroll Bars}) for vertical diff --git a/etc/NEWS b/etc/NEWS index b815d3ac61b..1d4d6af00e7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2018,6 +2018,14 @@ hooks 'kill-buffer-hook', 'kill-buffer-query-functions', and 'buffer-list-update-hook' for the temporary buffers they create. This avoids slowing them down when a lot of these hooks are defined. +** New face 'child-frame-border' and frame parameter 'child-frame-border-width'. +The face and width of child frames borders can no be determined +separately from thos of normal frames. To minimize backwards +incompatibility, child frames without a 'child-frame-border-width' +parameter will fall back to using 'internal-border-width'. However the +new 'child-frame-border' face does constitute a breaking change since +child frames' borders no longer use the 'internal-border' face. + --- ** The obsolete function 'thread-alive-p' has been removed. diff --git a/lisp/faces.el b/lisp/faces.el index d654b1f0e2a..90f11bbe3bb 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2683,11 +2683,20 @@ the same as `window-divider' face." (defface internal-border '((t nil)) - "Basic face for the internal border." + "Basic face for the internal border. +For the internal border of child frames see `child-frame-border'." :version "26.1" :group 'frames :group 'basic-faces) +(defface child-frame-border + '((t nil)) + "Basic face for the internal border of child frames. +For the internal border of non-child frames see `internal-border'." + :version "28.1" + :group 'frames + :group 'basic-faces) + (defface minibuffer-prompt '((((background dark)) :foreground "cyan") ;; Don't use blue because many users of the MS-DOS port customize diff --git a/src/dispextern.h b/src/dispextern.h index 3ad98b8344e..f4e872644db 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1826,6 +1826,7 @@ enum face_id WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID, INTERNAL_BORDER_FACE_ID, + CHILD_FRAME_BORDER_FACE_ID, TAB_BAR_FACE_ID, TAB_LINE_FACE_ID, BASIC_FACE_ID_SENTINEL diff --git a/src/frame.c b/src/frame.c index 599c4075f88..a2167ce1e49 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3543,6 +3543,13 @@ DEFUN ("frame-fringe-width", Ffringe_width, Sfringe_width, 0, 1, 0, return make_fixnum (FRAME_TOTAL_FRINGE_WIDTH (decode_any_frame (frame))); } +DEFUN ("frame-child-frame-border-width", Fframe_child_frame_border_width, Sframe_child_frame_border_width, 0, 1, 0, + doc: /* Return width of FRAME's child-frame border in pixels. */) + (Lisp_Object frame) +{ + return make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (decode_any_frame (frame))); +} + DEFUN ("frame-internal-border-width", Fframe_internal_border_width, Sframe_internal_border_width, 0, 1, 0, doc: /* Return width of FRAME's internal border in pixels. */) (Lisp_Object frame) @@ -3759,6 +3766,7 @@ static const struct frame_parm_table frame_parms[] = {"foreground-color", -1}, {"icon-name", SYMBOL_INDEX (Qicon_name)}, {"icon-type", SYMBOL_INDEX (Qicon_type)}, + {"child-frame-border-width", SYMBOL_INDEX (Qchild_frame_border_width)}, {"internal-border-width", SYMBOL_INDEX (Qinternal_border_width)}, {"right-divider-width", SYMBOL_INDEX (Qright_divider_width)}, {"bottom-divider-width", SYMBOL_INDEX (Qbottom_divider_width)}, @@ -4302,6 +4310,8 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr) store_in_alist (alistptr, Qborder_width, make_fixnum (f->border_width)); + store_in_alist (alistptr, Qchild_frame_border_width, + make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (f))); store_in_alist (alistptr, Qinternal_border_width, make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (f))); store_in_alist (alistptr, Qright_divider_width, @@ -5999,6 +6009,7 @@ syms_of_frame (void) DEFSYM (Qhorizontal_scroll_bars, "horizontal-scroll-bars"); DEFSYM (Qicon_name, "icon-name"); DEFSYM (Qicon_type, "icon-type"); + DEFSYM (Qchild_frame_border_width, "child-frame-border-width"); DEFSYM (Qinternal_border_width, "internal-border-width"); DEFSYM (Qleft_fringe, "left-fringe"); DEFSYM (Qline_spacing, "line-spacing"); @@ -6423,6 +6434,7 @@ iconify the top level frame instead. */); defsubr (&Sscroll_bar_width); defsubr (&Sscroll_bar_height); defsubr (&Sfringe_width); + defsubr (&Sframe_child_frame_border_width); defsubr (&Sframe_internal_border_width); defsubr (&Sright_divider_width); defsubr (&Sbottom_divider_width); diff --git a/src/frame.h b/src/frame.h index 8cf41dc0046..7b3bf20a241 100644 --- a/src/frame.h +++ b/src/frame.h @@ -534,6 +534,10 @@ struct frame /* Border width of the frame window as known by the (X) window system. */ int border_width; + /* Width of child frames' internal border. Acts as + internal_border_width for child frames. */ + int child_frame_border_width; + /* Width of the internal border. This is a line of background color just inside the window's border. When the frame is selected, a highlighting is displayed inside the internal border. */ @@ -1432,11 +1436,27 @@ FRAME_TOTAL_FRINGE_WIDTH (struct frame *f) return FRAME_LEFT_FRINGE_WIDTH (f) + FRAME_RIGHT_FRINGE_WIDTH (f); } -/* Pixel-width of internal border lines. */ +INLINE int +FRAME_CHILD_FRAME_BORDER_WIDTH (struct frame *f) +{ + return frame_dimension (f->child_frame_border_width); +} + +/* Pixel-width of internal border. Uses child_frame_border_width for + child frames if possible and falls back on internal_border_width + otherwise. */ INLINE int FRAME_INTERNAL_BORDER_WIDTH (struct frame *f) { - return frame_dimension (f->internal_border_width); +#ifdef HAVE_WINDOW_SYSTEM + return FRAME_PARENT_FRAME(f) + ? (f->child_frame_border_width + ? FRAME_CHILD_FRAME_BORDER_WIDTH(f) + : frame_dimension (f->internal_border_width)) + : frame_dimension (f->internal_border_width); +#else + return frame_dimension (f->internal_border_width) +#endif } /* Pixel-size of window divider lines. */ diff --git a/src/nsfns.m b/src/nsfns.m index 24ea7d7f63b..c383e2f7ecf 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -687,6 +687,21 @@ ns_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) } } +static void +ns_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +{ + int old_width = FRAME_CHILD_FRAME_BORDER_WIDTH (f); + int new_width = check_int_nonnegative (arg); + + if (new_width == old_width) + return; + f->child_frame_border_width = new_width; + + if (FRAME_NATIVE_WINDOW (f) != 0) + adjust_frame_size (f, -1, -1, 3, 0, Qchild_frame_border_width); + + SET_FRAME_GARBAGED (f); +} static void ns_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) @@ -912,6 +927,7 @@ frame_parm_handler ns_frame_parm_handlers[] = ns_set_foreground_color, ns_set_icon_name, ns_set_icon_type, + ns_set_child_frame_border_width, ns_set_internal_border_width, gui_set_right_divider_width, /* generic OK */ gui_set_bottom_divider_width, /* generic OK */ @@ -1197,6 +1213,9 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (2), "internalBorderWidth", "InternalBorderWidth", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qchild_frame_border_width, make_fixnum (2), + "childFrameBorderWidth", "childFrameBorderWidth", + RES_TYPE_NUMBER); gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0), NULL, NULL, RES_TYPE_NUMBER); gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0), diff --git a/src/nsterm.m b/src/nsterm.m index df3934c5c34..1b2328628ee 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3037,9 +3037,13 @@ ns_clear_under_internal_border (struct frame *f) NSRectEdge edge[] = {NSMinXEdge, NSMinYEdge, NSMaxXEdge, NSMaxYEdge}; int face_id = - !NILP (Vface_remapping_alist) - ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID) - : INTERNAL_BORDER_FACE_ID; + (FRAME_PARENT_FRAME (f) + ? (!NILP (Vface_remapping_alist) + ? lookup_basic_face (NULL, f, CHILD_FRAME_BORDER_FACE_ID) + : CHILD_FRAME_BORDER_FACE_ID) + : (!NILP (Vface_remapping_alist) + ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID) + : INTERNAL_BORDER_FACE_ID)); struct face *face = FACE_FROM_ID_OR_NULL (f, face_id); if (!face) diff --git a/src/w32fns.c b/src/w32fns.c index c1e18ff7fad..29d2e3d75f9 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1519,9 +1519,13 @@ w32_clear_under_internal_border (struct frame *f) int width = FRAME_PIXEL_WIDTH (f); int height = FRAME_PIXEL_HEIGHT (f); int face_id = - !NILP (Vface_remapping_alist) - ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID) - : INTERNAL_BORDER_FACE_ID; + (FRAME_PARENT_FRAME (f) + ? (!NILP (Vface_remapping_alist) + ? lookup_basic_face (NULL, f, CHILD_FRAME_BORDER_FACE_ID) + : CHILD_FRAME_BORDER_FACE_ID) + : (!NILP (Vface_remapping_alist) + ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID) + : INTERNAL_BORDER_FACE_ID)); struct face *face = FACE_FROM_ID_OR_NULL (f, face_id); block_input (); @@ -1548,6 +1552,32 @@ w32_clear_under_internal_border (struct frame *f) } } +/** + * w32_set_child_frame_border_width: + * + * Set width of child frame F's internal border to ARG pixels. + * ARG < 0 is * treated like ARG = 0. + */ +static void +w32_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +{ + int argval = check_integer_range (arg, INT_MIN, INT_MAX); + int border = max (argval, 0); + + if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f)) + { + f->child_frame_border_width = border; + + if (FRAME_NATIVE_WINDOW (f) != 0) + { + adjust_frame_size (f, -1, -1, 3, false, Qchild_frame_border_width); + + if (FRAME_VISIBLE_P (f)) + w32_clear_under_internal_border (f); + } + } +} + /** * w32_set_internal_border_width: @@ -5873,6 +5903,28 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, parameters); } + /* Same for child frames. */ + if (NILP (Fassq (Qchild_frame_border_width, parameters))) + { + Lisp_Object value; + + value = gui_display_get_arg (dpyinfo, parameters, Qchild_frame_border_width, + "childFrameBorderWidth", "childFrameBorderWidth", + RES_TYPE_NUMBER); + if (! EQ (value, Qunbound)) + parameters = Fcons (Fcons (Qchild_frame_border_width, value), + parameters); + + } + + gui_default_parameter (f, parameters, Qchild_frame_border_width, +#ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */ + make_fixnum (0), +#else + make_fixnum (1), +#endif + "childFrameBorderWidth", "childFrameBorderWidth", + RES_TYPE_NUMBER); gui_default_parameter (f, parameters, Qinternal_border_width, make_fixnum (0), "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER); gui_default_parameter (f, parameters, Qright_divider_width, make_fixnum (0), @@ -10232,6 +10284,7 @@ frame_parm_handler w32_frame_parm_handlers[] = w32_set_foreground_color, w32_set_icon_name, w32_set_icon_type, + w32_set_child_frame_border_width, w32_set_internal_border_width, gui_set_right_divider_width, gui_set_bottom_divider_width, diff --git a/src/xfaces.c b/src/xfaces.c index 258b365eda3..12087138e51 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4914,6 +4914,7 @@ lookup_basic_face (struct window *w, struct frame *f, int face_id) case WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID: name = Qwindow_divider_first_pixel; break; case WINDOW_DIVIDER_LAST_PIXEL_FACE_ID: name = Qwindow_divider_last_pixel; break; case INTERNAL_BORDER_FACE_ID: name = Qinternal_border; break; + case CHILD_FRAME_BORDER_FACE_ID: name = Qchild_frame_border; break; default: emacs_abort (); /* the caller is supposed to pass us a basic face id */ @@ -5620,6 +5621,7 @@ realize_basic_faces (struct frame *f) realize_named_face (f, Qwindow_divider_last_pixel, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID); realize_named_face (f, Qinternal_border, INTERNAL_BORDER_FACE_ID); + realize_named_face (f, Qchild_frame_border, CHILD_FRAME_BORDER_FACE_ID); realize_named_face (f, Qtab_bar, TAB_BAR_FACE_ID); realize_named_face (f, Qtab_line, TAB_LINE_FACE_ID); @@ -6973,6 +6975,7 @@ syms_of_xfaces (void) DEFSYM (Qwindow_divider_first_pixel, "window-divider-first-pixel"); DEFSYM (Qwindow_divider_last_pixel, "window-divider-last-pixel"); DEFSYM (Qinternal_border, "internal-border"); + DEFSYM (Qchild_frame_border, "child-frame-border"); /* TTY color-related functions (defined in tty-colors.el). */ DEFSYM (Qtty_color_desc, "tty-color-desc"); diff --git a/src/xfns.c b/src/xfns.c index 9ab537ca8d9..cac41ee4856 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1800,6 +1800,28 @@ x_change_tool_bar_height (struct frame *f, int height) #endif /* USE_GTK */ } +static void +x_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +{ + int border = check_int_nonnegative (arg); + + if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f)) + { + f->child_frame_border_width = border; + +#ifdef USE_X_TOOLKIT + if (FRAME_X_OUTPUT (f)->edit_widget) + widget_store_internal_border (FRAME_X_OUTPUT (f)->edit_widget); +#endif + + if (FRAME_X_WINDOW (f)) + { + adjust_frame_size (f, -1, -1, 3, false, Qchild_frame_border_width); + x_clear_under_internal_border (f); + } + } + +} static void x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) @@ -3897,6 +3919,29 @@ This function is an internal primitive--use `make-frame' instead. */) parms = Fcons (Fcons (Qinternal_border_width, value), parms); } + + /* Same for child frames. */ + if (NILP (Fassq (Qchild_frame_border_width, parms))) + { + Lisp_Object value; + + value = gui_display_get_arg (dpyinfo, parms, Qchild_frame_border_width, + "childFrameBorderWidth", "childFrameBorderWidth", + RES_TYPE_NUMBER); + if (! EQ (value, Qunbound)) + parms = Fcons (Fcons (Qchild_frame_border_width, value), + parms); + + } + + gui_default_parameter (f, parms, Qchild_frame_border_width, +#ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */ + make_fixnum (0), +#else + make_fixnum (1), +#endif + "childFrameBorderWidth", "childFrameBorderWidth", + RES_TYPE_NUMBER); gui_default_parameter (f, parms, Qinternal_border_width, #ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */ make_fixnum (0), @@ -7762,6 +7807,7 @@ frame_parm_handler x_frame_parm_handlers[] = x_set_foreground_color, x_set_icon_name, x_set_icon_type, + x_set_child_frame_border_width, x_set_internal_border_width, gui_set_right_divider_width, gui_set_bottom_divider_width, diff --git a/src/xterm.c b/src/xterm.c index b8374fed8b1..a855d2d67aa 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1293,9 +1293,13 @@ x_clear_under_internal_border (struct frame *f) int height = FRAME_PIXEL_HEIGHT (f); int margin = FRAME_TOP_MARGIN_HEIGHT (f); int face_id = - !NILP (Vface_remapping_alist) - ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID) - : INTERNAL_BORDER_FACE_ID; + (FRAME_PARENT_FRAME (f) + ? (!NILP (Vface_remapping_alist) + ? lookup_basic_face (NULL, f, CHILD_FRAME_BORDER_FACE_ID) + : CHILD_FRAME_BORDER_FACE_ID) + : (!NILP (Vface_remapping_alist) + ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID) + : INTERNAL_BORDER_FACE_ID)); struct face *face = FACE_FROM_ID_OR_NULL (f, face_id); block_input (); @@ -1360,9 +1364,13 @@ x_after_update_window_line (struct window *w, struct glyph_row *desired_row) { int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); int face_id = - !NILP (Vface_remapping_alist) - ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID) - : INTERNAL_BORDER_FACE_ID; + (FRAME_PARENT_FRAME (f) + ? (!NILP (Vface_remapping_alist) + ? lookup_basic_face (NULL, f, CHILD_FRAME_BORDER_FACE_ID) + : CHILD_FRAME_BORDER_FACE_ID) + : (!NILP (Vface_remapping_alist) + ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID) + : INTERNAL_BORDER_FACE_ID)); struct face *face = FACE_FROM_ID_OR_NULL (f, face_id); block_input (); From 3c314f3dd23257d574644563665ade9497d86b70 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Tue, 26 Jan 2021 10:59:59 +0100 Subject: [PATCH 018/107] Fix typo in last change of FRAME_INTERNAL_BORDER_WIDTH * src/frame.h (FRAME_INTERNAL_BORDER_WIDTH): Fix typo in last change. --- src/frame.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frame.h b/src/frame.h index 7b3bf20a241..4bd01243f66 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1455,7 +1455,7 @@ FRAME_INTERNAL_BORDER_WIDTH (struct frame *f) : frame_dimension (f->internal_border_width)) : frame_dimension (f->internal_border_width); #else - return frame_dimension (f->internal_border_width) + return frame_dimension (f->internal_border_width); #endif } From 3131a989118722d5ba7ff3f1aea7d9f30881ffe8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 26 Jan 2021 18:24:53 +0200 Subject: [PATCH 019/107] Fix typos and punctuation * src/w32fns.c: * src/frame.h: * doc/lispref/frames.texi (Frame Layout): * etc/NEWS: Fix typos and punctuation in recent changes. --- doc/lispref/frames.texi | 10 +++++----- etc/NEWS | 10 +++++----- src/frame.h | 4 ++-- src/w32fns.c | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index ef1b661b2a0..19c80fad53d 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -694,16 +694,16 @@ parameter (@pxref{Management Parameters}). @item Internal Border The internal border is a border drawn by Emacs around the inner frame -(see below). The specification of its appearance depends on whether -the given frame is a child frame (@pxref{Child Frames}) or not. +(see below). The specification of its appearance depends on whether +or not the given frame is a child frame (@pxref{Child Frames}). For normal frames its width is specified by the @code{internal-border-width} -frame parameter (@pxref{Layout Parameters}) and its color is specified by the +frame parameter (@pxref{Layout Parameters}), and its color is specified by the background of the @code{internal-border} face. For child frames its width is specified by the @code{child-frame-border-width} -frame parameter (but will use the the @code{internal-border-width} parameter as -a fallback) and its color is specified by the background of the +frame parameter (but will use the @code{internal-border-width} parameter as +fallback), and its color is specified by the background of the @code{child-frame-border} face. @item Inner Frame diff --git a/etc/NEWS b/etc/NEWS index 1d4d6af00e7..e038076e96c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2019,12 +2019,12 @@ hooks 'kill-buffer-hook', 'kill-buffer-query-functions', and avoids slowing them down when a lot of these hooks are defined. ** New face 'child-frame-border' and frame parameter 'child-frame-border-width'. -The face and width of child frames borders can no be determined -separately from thos of normal frames. To minimize backwards +The face and width of child frames borders can now be determined +separately from those of normal frames. To minimize backward incompatibility, child frames without a 'child-frame-border-width' -parameter will fall back to using 'internal-border-width'. However the -new 'child-frame-border' face does constitute a breaking change since -child frames' borders no longer use the 'internal-border' face. +parameter will fall back to using 'internal-border-width'. However, +the new 'child-frame-border' face does constitute a breaking change +since child frames' borders no longer use the 'internal-border' face. --- ** The obsolete function 'thread-alive-p' has been removed. diff --git a/src/frame.h b/src/frame.h index 4bd01243f66..9b0852c7b9c 100644 --- a/src/frame.h +++ b/src/frame.h @@ -534,7 +534,7 @@ struct frame /* Border width of the frame window as known by the (X) window system. */ int border_width; - /* Width of child frames' internal border. Acts as + /* Width of child frames' internal border. Acts as internal_border_width for child frames. */ int child_frame_border_width; @@ -1443,7 +1443,7 @@ FRAME_CHILD_FRAME_BORDER_WIDTH (struct frame *f) } /* Pixel-width of internal border. Uses child_frame_border_width for - child frames if possible and falls back on internal_border_width + child frames if possible, and falls back on internal_border_width otherwise. */ INLINE int FRAME_INTERNAL_BORDER_WIDTH (struct frame *f) diff --git a/src/w32fns.c b/src/w32fns.c index 29d2e3d75f9..7519c752b68 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1556,7 +1556,7 @@ w32_clear_under_internal_border (struct frame *f) * w32_set_child_frame_border_width: * * Set width of child frame F's internal border to ARG pixels. - * ARG < 0 is * treated like ARG = 0. + * ARG < 0 is treated like ARG = 0. */ static void w32_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) From 046db04e3da4afa7c6eb05af8c7ceb048689521a Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Tue, 26 Jan 2021 08:47:07 -0800 Subject: [PATCH 020/107] Revert "Allow gnus-retrieve-headers to return headers directly" This reverts commit 20add1cd22f9775a4475148b300cf2a4de4bd54a. This needs more work before it's ready to merge. --- lisp/gnus/gnus-agent.el | 373 +++++++++++++++++++++++++++------------- lisp/gnus/gnus-async.el | 9 +- lisp/gnus/gnus-cache.el | 126 ++++++++++---- lisp/gnus/gnus-cloud.el | 16 +- lisp/gnus/gnus-sum.el | 65 ++----- lisp/gnus/gnus.el | 9 +- lisp/gnus/nnvirtual.el | 170 +++++++++++++----- lisp/obsolete/nnir.el | 1 + 8 files changed, 511 insertions(+), 258 deletions(-) diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 686623029ed..56640ea8302 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -1789,7 +1789,6 @@ variables. Returns the first non-nil value found." . gnus-agent-enable-expiration) (agent-predicate . gnus-agent-predicate))))))) -;; FIXME: This looks an awful lot like `gnus-agent-retrieve-headers'. (defun gnus-agent-fetch-headers (group) "Fetch interesting headers into the agent. The group's overview file will be updated to include the headers while a list of available @@ -1811,9 +1810,10 @@ article numbers will be returned." (cdr active)))) (gnus-uncompress-range (gnus-active group))) (gnus-list-of-unread-articles group))) + (gnus-decode-encoded-word-function 'identity) + (gnus-decode-encoded-address-function 'identity) (file (gnus-agent-article-name ".overview" group)) - (file-name-coding-system nnmail-pathname-coding-system) - headers fetched-headers) + (file-name-coding-system nnmail-pathname-coding-system)) (unless fetch-all ;; Add articles with marks to the list of article headers we want to @@ -1824,7 +1824,7 @@ article numbers will be returned." (dolist (arts (gnus-info-marks (gnus-get-info group))) (unless (memq (car arts) '(seen recent killed cache)) (setq articles (gnus-range-add articles (cdr arts))))) - (setq articles (sort (gnus-uncompress-range articles) '<))) + (setq articles (sort (gnus-uncompress-sequence articles) '<))) ;; At this point, I have the list of articles to consider for ;; fetching. This is the list that I'll return to my caller. Some @@ -1867,52 +1867,38 @@ article numbers will be returned." 10 "gnus-agent-fetch-headers: undownloaded articles are `%s'" (gnus-compress-sequence articles t))) - ;; Parse known headers from FILE. - (if (file-exists-p file) - (with-current-buffer gnus-agent-overview-buffer - (erase-buffer) - (let ((nnheader-file-coding-system - gnus-agent-file-coding-system)) - (nnheader-insert-nov-file file (car articles)) - (with-current-buffer nntp-server-buffer - (erase-buffer) - (insert-buffer-substring gnus-agent-overview-buffer) - (setq headers - (gnus-get-newsgroup-headers-xover - articles nil (buffer-local-value - 'gnus-newsgroup-dependencies - gnus-summary-buffer) - gnus-newsgroup-name))))) - (gnus-make-directory (nnheader-translate-file-chars - (file-name-directory file) t))) + (with-current-buffer nntp-server-buffer + (if articles + (progn + (gnus-message 8 "Fetching headers for %s..." group) - ;; Fetch our new headers. - (gnus-message 8 "Fetching headers for %s..." group) - (if articles - (setq fetched-headers (gnus-fetch-headers articles))) + ;; Fetch them. + (gnus-make-directory (nnheader-translate-file-chars + (file-name-directory file) t)) - ;; Merge two sets of headers. - (setq headers - (if (and headers fetched-headers) - (delete-dups - (sort (append headers (copy-sequence fetched-headers)) - (lambda (l r) - (< (mail-header-number l) - (mail-header-number r))))) - (or headers fetched-headers))) - - ;; Save the new set of headers to FILE. - (let ((coding-system-for-write - gnus-agent-file-coding-system)) - (with-current-buffer gnus-agent-overview-buffer - (goto-char (point-max)) - (mapc #'nnheader-insert-nov fetched-headers) - (sort-numeric-fields 1 (point-min) (point-max)) - (gnus-agent-check-overview-buffer) - (write-region (point-min) (point-max) file nil 'silent)) - (gnus-agent-update-view-total-fetched-for group t) - (gnus-agent-save-alist group articles nil))) - headers)) + (unless (eq 'nov (gnus-retrieve-headers articles group)) + (nnvirtual-convert-headers)) + (gnus-agent-check-overview-buffer) + ;; Move these headers to the overview buffer so that + ;; gnus-agent-braid-nov can merge them with the contents + ;; of FILE. + (copy-to-buffer + gnus-agent-overview-buffer (point-min) (point-max)) + ;; NOTE: Call g-a-brand-nov even when the file does not + ;; exist. As a minimum, it will validate the article + ;; numbers already in the buffer. + (gnus-agent-braid-nov articles file) + (let ((coding-system-for-write + gnus-agent-file-coding-system)) + (gnus-agent-check-overview-buffer) + (write-region (point-min) (point-max) file nil 'silent)) + (gnus-agent-update-view-total-fetched-for group t) + (gnus-agent-save-alist group articles nil) + articles) + (ignore-errors + (erase-buffer) + (nnheader-insert-file-contents file))))) + articles)) (defsubst gnus-agent-read-article-number () "Read the article number at point. @@ -1938,6 +1924,96 @@ Return nil when a valid article number can not be read." (set-buffer nntp-server-buffer) (insert-buffer-substring gnus-agent-overview-buffer b e)))) +(defun gnus-agent-braid-nov (articles file) + "Merge agent overview data with given file. +Takes unvalidated headers for ARTICLES from +`gnus-agent-overview-buffer' and validated headers from the given +FILE and places the combined valid headers into +`nntp-server-buffer'. This function can be used, when file +doesn't exist, to valid the overview buffer." + (let (start last) + (set-buffer gnus-agent-overview-buffer) + (goto-char (point-min)) + (set-buffer nntp-server-buffer) + (erase-buffer) + (when (file-exists-p file) + (nnheader-insert-file-contents file)) + (goto-char (point-max)) + (forward-line -1) + + (unless (or (= (point-min) (point-max)) + (< (setq last (read (current-buffer))) (car articles))) + ;; Old and new overlap -- We do it the hard way. + (when (nnheader-find-nov-line (car articles)) + ;; Replacing existing NOV entry + (delete-region (point) (progn (forward-line 1) (point)))) + (gnus-agent-copy-nov-line (pop articles)) + + (ignore-errors + (while articles + (while (let ((art (read (current-buffer)))) + (cond ((< art (car articles)) + (forward-line 1) + t) + ((= art (car articles)) + (beginning-of-line) + (delete-region + (point) (progn (forward-line 1) (point))) + nil) + (t + (beginning-of-line) + nil)))) + + (gnus-agent-copy-nov-line (pop articles))))) + + (goto-char (point-max)) + + ;; Append the remaining lines + (when articles + (when last + (set-buffer gnus-agent-overview-buffer) + (setq start (point)) + (set-buffer nntp-server-buffer)) + + (let ((p (point))) + (insert-buffer-substring gnus-agent-overview-buffer start) + (goto-char p)) + + (setq last (or last -134217728)) + (while (catch 'problems + (let (sort art) + (while (not (eobp)) + (setq art (gnus-agent-read-article-number)) + (cond ((not art) + ;; Bad art num - delete this line + (beginning-of-line) + (delete-region (point) (progn (forward-line 1) (point)))) + ((< art last) + ;; Art num out of order - enable sort + (setq sort t) + (forward-line 1)) + ((= art last) + ;; Bad repeat of art number - delete this line + (beginning-of-line) + (delete-region (point) (progn (forward-line 1) (point)))) + (t + ;; Good art num + (setq last art) + (forward-line 1)))) + (when sort + ;; something is seriously wrong as we simply shouldn't see out-of-order data. + ;; First, we'll fix the sort. + (sort-numeric-fields 1 (point-min) (point-max)) + + ;; but now we have to consider that we may have duplicate rows... + ;; so reset to beginning of file + (goto-char (point-min)) + (setq last -134217728) + + ;; and throw a code that restarts this scan + (throw 'problems t)) + nil)))))) + ;; Keeps the compiler from warning about the free variable in ;; gnus-agent-read-agentview. (defvar gnus-agent-read-agentview) @@ -2310,9 +2386,10 @@ modified) original contents, they are first saved to their own file." (gnus-orphan-score gnus-orphan-score) ;; Maybe some other gnus-summary local variables should also ;; be put here. - fetched-headers + gnus-headers gnus-score + articles predicate info marks ) (unless (gnus-check-group group) @@ -2333,35 +2410,38 @@ modified) original contents, they are first saved to their own file." (setq info (gnus-get-info group))))))) (when arts (setq marked-articles (nconc (gnus-uncompress-range arts) - marked-articles)))))) + marked-articles)) + )))) (setq marked-articles (sort marked-articles '<)) - (setq gnus-newsgroup-dependencies - (or gnus-newsgroup-dependencies - (gnus-make-hashtable))) + ;; Fetch any new articles from the server + (setq articles (gnus-agent-fetch-headers group)) - ;; Fetch headers for any new articles from the server. - (setq fetched-headers (gnus-agent-fetch-headers group)) + ;; Merge new articles with marked + (setq articles (sort (append marked-articles articles) '<)) - (when fetched-headers + (when articles + ;; Parse them and see which articles we want to fetch. + (setq gnus-newsgroup-dependencies + (or gnus-newsgroup-dependencies + (gnus-make-hashtable (length articles)))) (setq gnus-newsgroup-headers - (or gnus-newsgroup-headers - fetched-headers))) - (when marked-articles - ;; `gnus-agent-overview-buffer' may be killed for timeout - ;; reason. If so, recreate it. + (or gnus-newsgroup-headers + (gnus-get-newsgroup-headers-xover articles nil nil + group))) + ;; `gnus-agent-overview-buffer' may be killed for + ;; timeout reason. If so, recreate it. (gnus-agent-create-buffer) (setq predicate - (gnus-get-predicate - (gnus-agent-find-parameter group 'agent-predicate))) - - ;; If the selection predicate requires scoring, score each header. + (gnus-get-predicate + (gnus-agent-find-parameter group 'agent-predicate))) + ;; If the selection predicate requires scoring, score each header (unless (memq predicate '(gnus-agent-true gnus-agent-false)) (let ((score-param (gnus-agent-find-parameter group 'agent-score-file))) - ;; Translate score-param into real one. + ;; Translate score-param into real one (cond ((not score-param)) ((eq score-param 'file) @@ -3581,9 +3661,11 @@ has been fetched." (defun gnus-agent-retrieve-headers (articles group &optional fetch-old) (save-excursion (gnus-agent-create-buffer) - (let ((file (gnus-agent-article-name ".overview" group)) - (file-name-coding-system nnmail-pathname-coding-system) - uncached-articles headers fetched-headers) + (let ((gnus-decode-encoded-word-function 'identity) + (gnus-decode-encoded-address-function 'identity) + (file (gnus-agent-article-name ".overview" group)) + uncached-articles + (file-name-coding-system nnmail-pathname-coding-system)) (gnus-make-directory (nnheader-translate-file-chars (file-name-directory file) t)) @@ -3594,63 +3676,122 @@ has been fetched." 1) (car (last articles)))))) - ;; See if we've got cached headers for ARTICLES and put them in - ;; HEADERS. Articles with no cached headers go in - ;; UNCACHED-ARTICLES to be fetched from the server. + ;; Populate temp buffer with known headers (when (file-exists-p file) (with-current-buffer gnus-agent-overview-buffer (erase-buffer) (let ((nnheader-file-coding-system gnus-agent-file-coding-system)) - (nnheader-insert-nov-file file (car articles)) - (with-current-buffer nntp-server-buffer - (erase-buffer) - (insert-buffer-substring gnus-agent-overview-buffer) - (setq headers - (gnus-get-newsgroup-headers-xover - articles nil (buffer-local-value - 'gnus-newsgroup-dependencies - gnus-summary-buffer) - gnus-newsgroup-name)))))) + (nnheader-insert-nov-file file (car articles))))) - (setq uncached-articles - (gnus-agent-uncached-articles articles group t)) + (if (setq uncached-articles (gnus-agent-uncached-articles articles group + t)) + (progn + ;; Populate nntp-server-buffer with uncached headers + (set-buffer nntp-server-buffer) + (erase-buffer) + (cond ((not (eq 'nov (let (gnus-agent) ; Turn off agent + (gnus-retrieve-headers + uncached-articles group)))) + (nnvirtual-convert-headers)) + ((eq 'nntp (car gnus-current-select-method)) + ;; The author of gnus-get-newsgroup-headers-xover + ;; reports that the XOVER command is commonly + ;; unreliable. The problem is that recently + ;; posted articles may not be entered into the + ;; NOV database in time to respond to my XOVER + ;; query. + ;; + ;; I'm going to use his assumption that the NOV + ;; database is updated in order of ascending + ;; article ID. Therefore, a response containing + ;; article ID N implies that all articles from 1 + ;; to N-1 are up-to-date. Therefore, missing + ;; articles in that range have expired. - (when uncached-articles - (let ((gnus-newsgroup-name group) - gnus-agent) ; Prevent loop. - ;; Fetch additional headers for the uncached articles. - (setq fetched-headers (gnus-fetch-headers uncached-articles)) - ;; Merge headers we got from the overview file with our - ;; newly-fetched headers. - (when fetched-headers - (setq headers - (delete-dups - (sort (append headers (copy-sequence fetched-headers)) - (lambda (l r) - (< (mail-header-number l) - (mail-header-number r)))))) + (set-buffer nntp-server-buffer) + (let* ((fetched-articles (list nil)) + (tail-fetched-articles fetched-articles) + (min (car articles)) + (max (car (last articles)))) - ;; Add the new set of known headers to the overview file. + ;; Get the list of articles that were fetched + (goto-char (point-min)) + (let ((pm (point-max)) + art) + (while (< (point) pm) + (when (setq art (gnus-agent-read-article-number)) + (gnus-agent-append-to-list tail-fetched-articles art)) + (forward-line 1))) + + ;; Clip this list to the headers that will + ;; actually be returned + (setq fetched-articles (gnus-list-range-intersection + (cdr fetched-articles) + (cons min max))) + + ;; Clip the uncached articles list to exclude + ;; IDs after the last FETCHED header. The + ;; excluded IDs may be fetchable using HEAD. + (if (car tail-fetched-articles) + (setq uncached-articles + (gnus-list-range-intersection + uncached-articles + (cons (car uncached-articles) + (car tail-fetched-articles))))) + + ;; Create the list of articles that were + ;; "successfully" fetched. Success, in this + ;; case, means that the ID should not be + ;; fetched again. In the case of an expired + ;; article, the header will not be fetched. + (setq uncached-articles + (gnus-sorted-nunion fetched-articles + uncached-articles)) + ))) + + ;; Erase the temp buffer + (set-buffer gnus-agent-overview-buffer) + (erase-buffer) + + ;; Copy the nntp-server-buffer to the temp buffer + (set-buffer nntp-server-buffer) + (copy-to-buffer gnus-agent-overview-buffer (point-min) (point-max)) + + ;; Merge the temp buffer with the known headers (found on + ;; disk in FILE) into the nntp-server-buffer + (when uncached-articles + (gnus-agent-braid-nov uncached-articles file)) + + ;; Save the new set of known headers to FILE + (set-buffer nntp-server-buffer) (let ((coding-system-for-write gnus-agent-file-coding-system)) - (with-current-buffer gnus-agent-overview-buffer - ;; We stick the new headers in at the end, then - ;; re-sort the whole buffer with - ;; `sort-numeric-fields'. If this turns out to be - ;; slow, we could consider a loop to add the headers - ;; in sorted order to begin with. - (goto-char (point-max)) - (mapc #'nnheader-insert-nov fetched-headers) - (sort-numeric-fields 1 (point-min) (point-max)) - (gnus-agent-check-overview-buffer) - (write-region (point-min) (point-max) file nil 'silent) - (gnus-agent-update-view-total-fetched-for group t) - ;; Update the group's article alist to include the - ;; newly fetched articles. - (gnus-agent-load-alist group) - (gnus-agent-save-alist group uncached-articles nil)))))) - headers))) + (gnus-agent-check-overview-buffer) + (write-region (point-min) (point-max) file nil 'silent)) + + (gnus-agent-update-view-total-fetched-for group t) + + ;; Update the group's article alist to include the newly + ;; fetched articles. + (gnus-agent-load-alist group) + (gnus-agent-save-alist group uncached-articles nil) + ) + + ;; Copy the temp buffer to the nntp-server-buffer + (set-buffer nntp-server-buffer) + (erase-buffer) + (insert-buffer-substring gnus-agent-overview-buffer))) + + (if (and fetch-old + (not (numberp fetch-old))) + t ; Don't remove anything. + (nnheader-nov-delete-outside-range + (car articles) + (car (last articles))) + t) + + 'nov)) (defun gnus-agent-request-article (article group) "Retrieve ARTICLE in GROUP from the agent cache." diff --git a/lisp/gnus/gnus-async.el b/lisp/gnus/gnus-async.el index ed948a26c0b..fefd02c7bfb 100644 --- a/lisp/gnus/gnus-async.el +++ b/lisp/gnus/gnus-async.el @@ -357,13 +357,8 @@ that was fetched." (let ((nntp-server-buffer (current-buffer)) (nnheader-callback-function (lambda (_arg) - (setq gnus-async-header-prefetched - (cons group unread))))) - ;; FIXME: If header prefetch is ever put into use, we'll - ;; have to handle the possibility that - ;; `gnus-retrieve-headers' might return a list of header - ;; vectors directly, rather than writing them into the - ;; current buffer. + (setq gnus-async-header-prefetched + (cons group unread))))) (gnus-retrieve-headers unread group gnus-fetch-old-headers)))))) (defun gnus-async-retrieve-fetched-headers (articles group) diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el index 9423d9f2f6b..36657e46219 100644 --- a/lisp/gnus/gnus-cache.el +++ b/lisp/gnus/gnus-cache.el @@ -294,47 +294,49 @@ it's not cached." (defun gnus-cache-retrieve-headers (articles group &optional fetch-old) "Retrieve the headers for ARTICLES in GROUP." (let ((cached - (setq gnus-newsgroup-cached (gnus-cache-articles-in-group group))) - (gnus-newsgroup-name group) - (gnus-fetch-old-headers fetch-old)) + (setq gnus-newsgroup-cached (gnus-cache-articles-in-group group)))) (if (not cached) ;; No cached articles here, so we just retrieve them ;; the normal way. (let ((gnus-use-cache nil)) - (gnus-retrieve-headers articles group)) + (gnus-retrieve-headers articles group fetch-old)) (let ((uncached-articles (gnus-sorted-difference articles cached)) (cache-file (gnus-cache-file-name group ".overview")) - (file-name-coding-system nnmail-pathname-coding-system) - headers) + type + (file-name-coding-system nnmail-pathname-coding-system)) ;; We first retrieve all the headers that we don't have in ;; the cache. (let ((gnus-use-cache nil)) (when uncached-articles - (setq headers (and articles - (gnus-fetch-headers uncached-articles))))) + (setq type (and articles + (gnus-retrieve-headers + uncached-articles group fetch-old))))) (gnus-cache-save-buffers) - ;; Then we include the cached headers. - (when (file-exists-p cache-file) - (setq headers - (delete-dups - (sort - (append headers - (let ((coding-system-for-read - gnus-cache-overview-coding-system)) - (with-current-buffer nntp-server-buffer - (erase-buffer) - (insert-file-contents cache-file) - (gnus-get-newsgroup-headers-xover - (gnus-sorted-difference - cached uncached-articles) - nil (buffer-local-value - 'gnus-newsgroup-dependencies - gnus-summary-buffer) - group)))) - (lambda (l r) - (< (mail-header-number l) - (mail-header-number r))))))) - headers)))) + ;; Then we insert the cached headers. + (save-excursion + (cond + ((not (file-exists-p cache-file)) + ;; There are no cached headers. + type) + ((null type) + ;; There were no uncached headers (or retrieval was + ;; unsuccessful), so we use the cached headers exclusively. + (set-buffer nntp-server-buffer) + (erase-buffer) + (let ((coding-system-for-read + gnus-cache-overview-coding-system)) + (insert-file-contents cache-file)) + 'nov) + ((eq type 'nov) + ;; We have both cached and uncached NOV headers, so we + ;; braid them. + (gnus-cache-braid-nov group cached) + type) + (t + ;; We braid HEADs. + (gnus-cache-braid-heads group (gnus-sorted-intersection + cached articles)) + type))))))) (defun gnus-cache-enter-article (&optional n) "Enter the next N articles into the cache. @@ -527,6 +529,70 @@ Returns the list of articles removed." (setq gnus-cache-active-altered t))) articles))) +(defun gnus-cache-braid-nov (group cached &optional file) + (let ((cache-buf (gnus-get-buffer-create " *gnus-cache*")) + beg end) + (gnus-cache-save-buffers) + (with-current-buffer cache-buf + (erase-buffer) + (let ((coding-system-for-read gnus-cache-overview-coding-system) + (file-name-coding-system nnmail-pathname-coding-system)) + (insert-file-contents + (or file (gnus-cache-file-name group ".overview")))) + (goto-char (point-min)) + (insert "\n") + (goto-char (point-min))) + (set-buffer nntp-server-buffer) + (goto-char (point-min)) + (while cached + (while (and (not (eobp)) + (< (read (current-buffer)) (car cached))) + (forward-line 1)) + (beginning-of-line) + (set-buffer cache-buf) + (if (search-forward (concat "\n" (int-to-string (car cached)) "\t") + nil t) + (setq beg (point-at-bol) + end (progn (end-of-line) (point))) + (setq beg nil)) + (set-buffer nntp-server-buffer) + (when beg + (insert-buffer-substring cache-buf beg end) + (insert "\n")) + (setq cached (cdr cached))) + (kill-buffer cache-buf))) + +(defun gnus-cache-braid-heads (group cached) + (let ((cache-buf (gnus-get-buffer-create " *gnus-cache*"))) + (with-current-buffer cache-buf + (erase-buffer)) + (set-buffer nntp-server-buffer) + (goto-char (point-min)) + (dolist (entry cached) + (while (and (not (eobp)) + (looking-at "2.. +\\([0-9]+\\) ") + (< (progn (goto-char (match-beginning 1)) + (read (current-buffer))) + entry)) + (search-forward "\n.\n" nil 'move)) + (beginning-of-line) + (set-buffer cache-buf) + (erase-buffer) + (let ((coding-system-for-read gnus-cache-coding-system) + (file-name-coding-system nnmail-pathname-coding-system)) + (insert-file-contents (gnus-cache-file-name group entry))) + (goto-char (point-min)) + (insert "220 ") + (princ (pop cached) (current-buffer)) + (insert " Article retrieved.\n") + (search-forward "\n\n" nil 'move) + (delete-region (point) (point-max)) + (forward-char -1) + (insert ".") + (set-buffer nntp-server-buffer) + (insert-buffer-substring cache-buf)) + (kill-buffer cache-buf))) + ;;;###autoload (defun gnus-jog-cache () "Go through all groups and put the articles into the cache. diff --git a/lisp/gnus/gnus-cloud.el b/lisp/gnus/gnus-cloud.el index 00b85f546c2..f7c71f43ce8 100644 --- a/lisp/gnus/gnus-cloud.el +++ b/lisp/gnus/gnus-cloud.el @@ -30,8 +30,6 @@ (require 'parse-time) (require 'nnimap) -(declare-function gnus-fetch-headers "gnus-sum") -(defvar gnus-alter-header-function) (eval-when-compile (require 'epg)) ;; setf-method for `epg-context-armor' (autoload 'epg-make-context "epg") @@ -393,6 +391,8 @@ When FULL is t, upload everything, not just a difference from the last full." (gnus-group-refresh-group group)) (gnus-error 2 "Failed to upload Gnus Cloud data to %s" group))))) +(defvar gnus-alter-header-function) + (defun gnus-cloud-add-timestamps (elems) (dolist (elem elems) (let* ((file-name (plist-get elem :file-name)) @@ -407,10 +407,14 @@ When FULL is t, upload everything, not just a difference from the last full." (gnus-activate-group gnus-cloud-group-name nil nil gnus-cloud-method) (let* ((group (gnus-group-full-name gnus-cloud-group-name gnus-cloud-method)) (active (gnus-active group)) - (gnus-newsgroup-name group) - (headers (gnus-fetch-headers (gnus-uncompress-range active)))) - (when gnus-alter-header-function - (mapc gnus-alter-header-function headers)) + headers head) + (when (gnus-retrieve-headers (gnus-uncompress-range active) group) + (with-current-buffer nntp-server-buffer + (goto-char (point-min)) + (while (setq head (nnheader-parse-head)) + (when gnus-alter-header-function + (funcall gnus-alter-header-function head)) + (push head headers)))) (sort (nreverse headers) (lambda (h1 h2) (> (gnus-cloud-chunk-sequence (mail-header-subject h1)) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 5bd58b690af..b0f9ed4c6f0 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -5658,21 +5658,10 @@ or a straight list of headers." (setf (mail-header-subject header) subject)))))) (defun gnus-fetch-headers (articles &optional limit force-new dependencies) - "Fetch headers of ARTICLES. -This calls the `gnus-retrieve-headers' function of the current -group's backend server. The server can do one of two things: - -1. Write the headers for ARTICLES into the - `nntp-server-buffer' (the current buffer) in a parseable format, or -2. Return the headers directly as a list of vectors. - -In the first case, `gnus-retrieve-headers' returns a symbol -value, either `nov' or `headers'. This value determines which -parsing function is used to read the headers. It is also stored -into the variable `gnus-headers-retrieved-by', which is consulted -later when possibly building full threads." + "Fetch headers of ARTICLES." (gnus-message 7 "Fetching headers for %s..." gnus-newsgroup-name) - (let ((res (setq gnus-headers-retrieved-by + (prog1 + (pcase (setq gnus-headers-retrieved-by (gnus-retrieve-headers articles gnus-newsgroup-name (or limit @@ -5682,34 +5671,22 @@ later when possibly building full threads." (not (eq gnus-fetch-old-headers 'some)) (not (numberp gnus-fetch-old-headers))) (> (length articles) 1)) - gnus-fetch-old-headers)))))) - (prog1 - (pcase res - ('nov - (gnus-get-newsgroup-headers-xover - articles force-new dependencies gnus-newsgroup-name t)) - ;; For now, assume that any backend returning its own - ;; headers takes some effort to do so, so return `headers'. - ((pred listp) - (setq gnus-headers-retrieved-by 'headers) - (let ((dependencies - (or dependencies - (buffer-local-value - 'gnus-newsgroup-dependencies gnus-summary-buffer)))) - (when (functionp gnus-alter-header-function) - (mapc gnus-alter-header-function res)) - (mapc (lambda (header) - ;; The agent or the cache may have already - ;; registered this header in the dependency - ;; table. - (unless (gethash (mail-header-id header) dependencies) - (gnus-dependencies-add-header - header dependencies force-new))) - res) - res)) - (_ (gnus-get-newsgroup-headers dependencies force-new))) - (gnus-message 7 "Fetching headers for %s...done" - gnus-newsgroup-name)))) + gnus-fetch-old-headers)))) + ('nov + (gnus-get-newsgroup-headers-xover + articles force-new dependencies gnus-newsgroup-name t)) + ('headers + (gnus-get-newsgroup-headers dependencies force-new)) + ((pred listp) + (let ((dependencies + (or dependencies + (with-current-buffer gnus-summary-buffer + gnus-newsgroup-dependencies)))) + (delq nil (mapcar #'(lambda (header) + (gnus-dependencies-add-header + header dependencies force-new)) + gnus-headers-retrieved-by))))) + (gnus-message 7 "Fetching headers for %s...done" gnus-newsgroup-name))) (defun gnus-select-newsgroup (group &optional read-all select-articles) "Select newsgroup GROUP. @@ -6466,10 +6443,6 @@ The resulting hash table is returned, or nil if no Xrefs were found." (unless (gnus-ephemeral-group-p group) (gnus-group-update-group group t)))))) -;; FIXME: Refactor this with `gnus-get-newsgroup-headers-xover' and -;; extract the necessary bits for the direct-header-return case. Also -;; look at this and see how similar it is to -;; `nnheader-parse-naked-head'. (defun gnus-get-newsgroup-headers (&optional dependencies force-new) (let ((dependencies (or dependencies diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 2e9ee7189d2..3b172db2111 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -2388,14 +2388,7 @@ Typical marks are those that make no sense in a standalone back end, such as a mark that says whether an article is stored in the cache \(which doesn't make sense in a standalone back end).") -(defvar gnus-headers-retrieved-by nil - "Holds the return value of `gnus-retrieve-headers'. -This is either the symbol `nov' or the symbol `headers'. This -value is checked during the summary creation process, when -building threads. A value of `nov' indicates that header -retrieval is relatively cheap and threading is encouraged to -include more old articles. A value of `headers' indicates that -retrieval is expensive and should be minimized.") +(defvar gnus-headers-retrieved-by nil) (defvar gnus-article-reply nil) (defvar gnus-override-method nil) (defvar gnus-opened-servers nil) diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el index ba2934351d6..1e2feda6365 100644 --- a/lisp/gnus/nnvirtual.el +++ b/lisp/gnus/nnvirtual.el @@ -101,10 +101,15 @@ It is computed from the marks of individual component groups.") (erase-buffer) (if (stringp (car articles)) 'headers - (let ((carticles (nnvirtual-partition-sequence articles)) + (let ((vbuf (nnheader-set-temp-buffer + (gnus-get-buffer-create " *virtual headers*"))) + (carticles (nnvirtual-partition-sequence articles)) (sysname (system-name)) - cgroup headers all-headers article prefix) - (pcase-dolist (`(,cgroup . ,articles) carticles) + cgroup carticle article result prefix) + (while carticles + (setq cgroup (caar carticles)) + (setq articles (cdar carticles)) + (pop carticles) (when (and articles (gnus-check-server (gnus-find-method-for-group cgroup) t) @@ -114,37 +119,69 @@ It is computed from the marks of individual component groups.") ;; This is probably evil if people have set ;; gnus-use-cache to nil themselves, but I ;; have no way of finding the true value of it. - (let ((gnus-use-cache t) - (gnus-newsgroup-name cgroup) - (gnus-fetch-old-headers nil)) - (setq headers (gnus-fetch-headers articles)))) - (erase-buffer) - ;; Remove all header article numbers from `articles'. - ;; If there's anything left, those are expired or - ;; canceled articles, so we update the component group - ;; below. - (dolist (h headers) - (setq articles (delq (mail-header-number h) articles) - article (nnvirtual-reverse-map-article - cgroup (mail-header-number h))) - ;; Update all the header numbers according to their - ;; reverse mapping, and drop any with no such mapping. - (when article - ;; Do this first, before we re-set the header's - ;; article number. - (nnvirtual-update-xref-header - h cgroup prefix sysname) - (setf (mail-header-number h) article) - (push h all-headers))) - ;; Anything left in articles is expired or canceled. - ;; Could be smart and not tell it about articles already - ;; known? - (when articles - (gnus-group-make-articles-read cgroup articles)))) + (let ((gnus-use-cache t)) + (setq result (gnus-retrieve-headers + articles cgroup nil)))) + (set-buffer nntp-server-buffer) + ;; If we got HEAD headers, we convert them into NOV + ;; headers. This is slow, inefficient and, come to think + ;; of it, downright evil. So sue me. I couldn't be + ;; bothered to write a header parse routine that could + ;; parse a mixed HEAD/NOV buffer. + (when (eq result 'headers) + (nnvirtual-convert-headers)) + (goto-char (point-min)) + (while (not (eobp)) + (delete-region (point) + (progn + (setq carticle (read nntp-server-buffer)) + (point))) - (sort all-headers (lambda (h1 h2) - (< (mail-header-number h1) - (mail-header-number h2))))))))) + ;; We remove this article from the articles list, if + ;; anything is left in the articles list after going through + ;; the entire buffer, then those articles have been + ;; expired or canceled, so we appropriately update the + ;; component group below. They should be coming up + ;; generally in order, so this shouldn't be slow. + (setq articles (delq carticle articles)) + + (setq article (nnvirtual-reverse-map-article cgroup carticle)) + (if (null article) + ;; This line has no reverse mapping, that means it + ;; was an extra article reference returned by nntp. + (progn + (beginning-of-line) + (delete-region (point) (progn (forward-line 1) (point)))) + ;; Otherwise insert the virtual article number, + ;; and clean up the xrefs. + (princ article nntp-server-buffer) + (nnvirtual-update-xref-header cgroup carticle + prefix sysname) + (forward-line 1)) + ) + + (set-buffer vbuf) + (goto-char (point-max)) + (insert-buffer-substring nntp-server-buffer)) + ;; Anything left in articles is expired or canceled. + ;; Could be smart and not tell it about articles already known? + (when articles + (gnus-group-make-articles-read cgroup articles)) + ) + + ;; The headers are ready for reading, so they are inserted into + ;; the nntp-server-buffer, which is where Gnus expects to find + ;; them. + (prog1 + (with-current-buffer nntp-server-buffer + (erase-buffer) + (insert-buffer-substring vbuf) + ;; FIX FIX FIX, we should be able to sort faster than + ;; this if needed, since each cgroup is sorted, we just + ;; need to merge + (sort-numeric-fields 1 (point-min) (point-max)) + 'nov) + (kill-buffer vbuf))))))) (defvoo nnvirtual-last-accessed-component-group nil) @@ -335,18 +372,61 @@ It is computed from the marks of individual component groups.") ;;; Internal functions. -(defun nnvirtual-update-xref-header (header group prefix sysname) - "Add xref to component GROUP to HEADER. -Also add a server PREFIX any existing xref lines." - (let ((bits (split-string (mail-header-xref header) - nil t "[[:blank:]]")) - (art-no (mail-header-number header))) - (setf (mail-header-xref header) - (concat - (format "%s %s:%d " sysname group art-no) - (mapconcat (lambda (bit) - (concat prefix bit)) - bits " "))))) +(defun nnvirtual-convert-headers () + "Convert HEAD headers into NOV headers." + (with-current-buffer nntp-server-buffer + (let* ((dependencies (make-hash-table :test #'equal)) + (headers (gnus-get-newsgroup-headers dependencies))) + (erase-buffer) + (mapc 'nnheader-insert-nov headers)))) + + +(defun nnvirtual-update-xref-header (group article prefix sysname) + "Edit current NOV header in current buffer to have an xref to the component group, and also server prefix any existing xref lines." + ;; Move to beginning of Xref field, creating a slot if needed. + (beginning-of-line) + (looking-at + "[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t") + (goto-char (match-end 0)) + (unless (search-forward "\t" (point-at-eol) 'move) + (insert "\t")) + + ;; Remove any spaces at the beginning of the Xref field. + (while (eq (char-after (1- (point))) ? ) + (forward-char -1) + (delete-char 1)) + + (insert "Xref: " sysname " " group ":") + (princ article (current-buffer)) + (insert " ") + + ;; If there were existing xref lines, clean them up to have the correct + ;; component server prefix. + (save-restriction + (narrow-to-region (point) + (or (search-forward "\t" (point-at-eol) t) + (point-at-eol))) + (goto-char (point-min)) + (when (re-search-forward "Xref: *[^\n:0-9 ]+ *" nil t) + (replace-match "" t t)) + (goto-char (point-min)) + (when (re-search-forward + (concat (regexp-quote (gnus-group-real-name group)) ":[0-9]+") + nil t) + (replace-match "" t t)) + (unless (eobp) + (insert " ") + (when (not (string= "" prefix)) + (while (re-search-forward "[^ ]+:[0-9]+" nil t) + (save-excursion + (goto-char (match-beginning 0)) + (insert prefix)))))) + + ;; Ensure a trailing \t. + (end-of-line) + (or (eq (char-after (1- (point))) ?\t) + (insert ?\t))) + (defun nnvirtual-possibly-change-server (server) (or (not server) diff --git a/lisp/obsolete/nnir.el b/lisp/obsolete/nnir.el index 0b7d1e454c3..147efed0057 100644 --- a/lisp/obsolete/nnir.el +++ b/lisp/obsolete/nnir.el @@ -504,6 +504,7 @@ Add an entry here when adding a new search engine.") ,@(mapcar (lambda (elem) (list 'const (car elem))) nnir-engines))))) + (defmacro nnir-add-result (dirnam artno score prefix server artlist) "Construct a result vector and add it to ARTLIST. DIRNAM, ARTNO, SCORE, PREFIX and SERVER are passed to From a572b21928a33b7ede445769bde5a67356327fef Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 26 Jan 2021 17:57:26 -0500 Subject: [PATCH 021/107] * lisp/progmodes/sh-script.el (sh-smie-sh-rules): Tweak indent of new `for` The new `for (TEST) { BODY }` syntax introduces various challenges. This patch just fixes a trivial subcase. --- lisp/progmodes/sh-script.el | 14 ++++++++++---- test/manual/indent/shell.sh | 7 +++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index cc045a1b2d1..fd689527676 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1957,12 +1957,18 @@ May return nil if the line should not be treated as continued." ('(:after . "case-)") (- (sh-var-value 'sh-indent-for-case-alt) (sh-var-value 'sh-indent-for-case-label))) (`(:before . ,(or "(" "{" "[" "while" "if" "for" "case")) - (if (not (smie-rule-prev-p "&&" "||" "|")) - (when (smie-rule-hanging-p) - (smie-rule-parent)) + (cond + ((and (equal token "{") (smie-rule-parent-p "for")) + (let ((data (smie-backward-sexp "in"))) + (when (equal (nth 2 data) "for") + `(column . ,(smie-indent-virtual))))) + ((not (smie-rule-prev-p "&&" "||" "|")) + (when (smie-rule-hanging-p) + (smie-rule-parent))) + (t (unless (smie-rule-bolp) (while (equal "|" (nth 2 (smie-backward-sexp 'halfexp)))) - `(column . ,(smie-indent-virtual))))) + `(column . ,(smie-indent-virtual)))))) ;; FIXME: Maybe this handling of ;; should be made into ;; a smie-rule-terminator function that takes the substitute ";" as arg. (`(:before . ,(or ";;" ";&" ";;&")) diff --git a/test/manual/indent/shell.sh b/test/manual/indent/shell.sh index dc184ea0d77..bd4a74f7054 100755 --- a/test/manual/indent/shell.sh +++ b/test/manual/indent/shell.sh @@ -6,6 +6,13 @@ setlock -n /tmp/getmail.lock && echo getmail isn\'t running toto=$(grep hello foo | wc) +myfun () { + for ((it=0; it<${limit}; ++it)) + { + echo "whatever $it" + } +} + # adsgsdg if foo; then From b870e584a4275be83d6878001ee613997282fd37 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 26 Jan 2021 18:17:00 -0500 Subject: [PATCH 022/107] Use lexical-binding in all of `lisp/url` * lisp/url/url-dav.el: Use lexical-binding. (url-dav-process-DAV:prop): Remove unused var `handler-func`. (url-dav-lock-resource): Remove unused var `child-url`. (url-dav-active-locks): Remove unused var `properties`. (url-dav-delete-directory): Remove unused var `props`. (url-dav-file-name-completion): Remove unused var `result`. * lisp/url/url-expand.el (url-expand-file-name): Use \s * lisp/url/url-file.el (url-file): Improve regexp. * lisp/url/url-gw.el: Use lexical-binding. (url-open-stream): Remove unused var `cur-retries`, `retry`, `errobj`. * lisp/url/url-imap.el: Use lexical-binding. (imap-username, imap-password): Declare. * lisp/url/url-mailto.el: Use lexical-binding. (url-mailto): Remove unused var `func`. Use `push`. * lisp/url/url-news.el: Use lexical-binding. (url-news): Remove unused var `article-brackets`. * lisp/url/url-cid.el: * lisp/url/url-cache.el: * lisp/url/url-about.el: * lisp/url/url-tramp.el: * lisp/url/url-proxy.el: * lisp/url/url-privacy.el: * lisp/url/url-nfs.el: * lisp/url/url-ldap.el: * lisp/url/url-misc.el: * lisp/url/url-methods.el: Use lexical-binding. --- lisp/url/url-about.el | 10 ++++++---- lisp/url/url-cache.el | 2 +- lisp/url/url-cid.el | 2 +- lisp/url/url-dav.el | 18 ++++++++++-------- lisp/url/url-expand.el | 2 +- lisp/url/url-file.el | 2 +- lisp/url/url-gw.el | 15 +++++++-------- lisp/url/url-http.el | 25 ++++++++++++------------- lisp/url/url-imap.el | 5 ++++- lisp/url/url-ldap.el | 2 +- lisp/url/url-mailto.el | 11 ++++++----- lisp/url/url-methods.el | 4 ++-- lisp/url/url-misc.el | 2 +- lisp/url/url-news.el | 4 ++-- lisp/url/url-nfs.el | 2 +- lisp/url/url-privacy.el | 4 ++-- lisp/url/url-proxy.el | 2 +- lisp/url/url-tramp.el | 2 +- lisp/url/url.el | 22 +++++++++++----------- 19 files changed, 71 insertions(+), 65 deletions(-) diff --git a/lisp/url/url-about.el b/lisp/url/url-about.el index bff5570f6df..6ae90ccefad 100644 --- a/lisp/url/url-about.el +++ b/lisp/url/url-about.el @@ -1,4 +1,4 @@ -;;; url-about.el --- Show internal URLs +;;; url-about.el --- Show internal URLs -*- lexical-binding: t; -*- ;; Copyright (C) 2001, 2004-2021 Free Software Foundation, Inc. @@ -44,7 +44,7 @@ (defvar url-scheme-registry) -(defun url-about-protocols (url) +(defun url-about-protocols (_url) (url-probe-protocols) (insert "\n" " \n" @@ -73,13 +73,15 @@ "ynchronous
\n" (if (url-scheme-get-property k 'default-port) (format "Default Port: %d
\n" - (url-scheme-get-property k 'default-port)) "") + (url-scheme-get-property k 'default-port)) + "") (if (assoc k url-proxy-services) (format "Proxy: %s
\n" (assoc k url-proxy-services)) "")) ;; Now the description... (insert " " (or (url-scheme-get-property k 'description) "N/A")))) - (sort (let (x) (maphash (lambda (k v) (push k x)) url-scheme-registry) x) 'string-lessp)) + (sort (let (x) (maphash (lambda (k _v) (push k x)) url-scheme-registry) x) + #'string-lessp)) (insert " \n" " \n" "\n")) diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el index acf88eb0212..830e6ba9dcc 100644 --- a/lisp/url/url-cache.el +++ b/lisp/url/url-cache.el @@ -1,4 +1,4 @@ -;;; url-cache.el --- Uniform Resource Locator retrieval tool +;;; url-cache.el --- Uniform Resource Locator retrieval tool -*- lexical-binding: t; -*- ;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc. diff --git a/lisp/url/url-cid.el b/lisp/url/url-cid.el index d465cabc90c..0ca2d8a0737 100644 --- a/lisp/url/url-cid.el +++ b/lisp/url/url-cid.el @@ -1,4 +1,4 @@ -;;; url-cid.el --- Content-ID URL loader +;;; url-cid.el --- Content-ID URL loader -*- lexical-binding: t; -*- ;; Copyright (C) 1998-1999, 2004-2021 Free Software Foundation, Inc. diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el index 12d5a683e97..edb1c1de9fc 100644 --- a/lisp/url/url-dav.el +++ b/lisp/url/url-dav.el @@ -1,4 +1,4 @@ -;;; url-dav.el --- WebDAV support +;;; url-dav.el --- WebDAV support -*- lexical-binding: t; -*- ;; Copyright (C) 2001, 2004-2021 Free Software Foundation, Inc. @@ -133,7 +133,8 @@ Returns nil if WebDAV is not supported." (node-type nil) (props nil) (value nil) - (handler-func nil)) + ;; (handler-func nil) + ) (when (not children) (error "No child nodes in DAV:prop")) @@ -453,7 +454,7 @@ FAILURE-RESULTS is a list of (URL STATUS)." " \n")) (response nil) ; Responses to the LOCK request (result nil) ; For walking thru the response list - (child-url nil) + ;; (child-url nil) (child-status nil) (failures nil) ; List of failure cases (URL . STATUS) (successes nil)) ; List of success cases (URL . STATUS) @@ -468,7 +469,7 @@ FAILURE-RESULTS is a list of (URL STATUS)." ;; status code. (while response (setq result (pop response) - child-url (url-expand-file-name (pop result) url) + ;; child-url (url-expand-file-name (pop result) url) child-status (or (plist-get result 'DAV:status) 500)) (if (url-dav-http-success-p child-status) (push (list url child-status "huh") successes) @@ -478,7 +479,7 @@ FAILURE-RESULTS is a list of (URL STATUS)." (defun url-dav-active-locks (url &optional depth) "Return an assoc list of all active locks on URL." (let ((response (url-dav-get-properties url '(DAV:lockdiscovery) depth)) - (properties nil) + ;; (properties nil) (child nil) (child-url nil) (child-results nil) @@ -676,7 +677,6 @@ Use with care, and even then think three times." If optional second argument RECURSIVE is non-nil, then delete all files in the collection as well." (let ((status nil) - (props nil) (props nil)) (setq props (url-dav-delete-something url lock-token @@ -769,7 +769,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. (when (member 'DAV:collection (plist-get properties 'DAV:resourcetype)) t))) -(defun url-dav-make-directory (url &optional parents) +(defun url-dav-make-directory (url &optional _parents) "Create the directory DIR and any nonexistent parent dirs." (let* ((url-request-extra-headers nil) (url-request-method "MKCOL") @@ -849,7 +849,9 @@ that start with FILE. If there is only one and FILE matches it exactly, returns t. Returns nil if URL contains no name starting with FILE." (let ((matches (url-dav-file-name-all-completions file url)) - (result nil)) + ;; (result nil) + ) + ;; FIXME: Use `try-completion'! (cond ((null matches) ;; No matches diff --git a/lisp/url/url-expand.el b/lisp/url/url-expand.el index a42b4c7ad23..05088e3cac8 100644 --- a/lisp/url/url-expand.el +++ b/lisp/url/url-expand.el @@ -66,7 +66,7 @@ path components followed by `..' are removed, along with the `..' itself." ;; Need to nuke newlines and spaces in the URL, or we open ;; ourselves up to potential security holes. (setq url (mapconcat (lambda (x) - (if (memq x '(? ?\n ?\r)) + (if (memq x '(?\s ?\n ?\r)) "" (char-to-string x))) url ""))) diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el index 52a9588030e..0e2ab5544b9 100644 --- a/lisp/url/url-file.el +++ b/lisp/url/url-file.el @@ -154,7 +154,7 @@ to them." ;; not the compressed one. ;; FIXME should this regexp not include more extensions; basically ;; everything that url-file-find-possibly-compressed-file does? - (setq uncompressed-filename (if (string-match "\\.\\(gz\\|Z\\|z\\)$" filename) + (setq uncompressed-filename (if (string-match "\\.\\(gz\\|Z\\|z\\)\\'" filename) (substring filename 0 (match-beginning 0)) filename)) (setq content-type (mailcap-extension-to-mime diff --git a/lisp/url/url-gw.el b/lisp/url/url-gw.el index 68df67f6486..d2bf843fc36 100644 --- a/lisp/url/url-gw.el +++ b/lisp/url/url-gw.el @@ -1,4 +1,4 @@ -;;; url-gw.el --- Gateway munging for URL loading +;;; url-gw.el --- Gateway munging for URL loading -*- lexical-binding: t; -*- ;; Copyright (C) 1997-1998, 2004-2021 Free Software Foundation, Inc. @@ -222,18 +222,17 @@ overriding the value of `url-gateway-method'." host)) 'native gwm)) - ;; An attempt to deal with denied connections, and attempt - ;; to reconnect - (cur-retries 0) - (retry t) - (errobj nil) - (conn nil)) + ;; An attempt to deal with denied connections, and attempt + ;; to reconnect + ;; (cur-retries 0) + ;; (retry t) + (conn nil)) ;; If the user told us to do DNS for them, do it. (if url-gateway-broken-resolution (setq host (url-gateway-nslookup-host host))) - (condition-case errobj + (condition-case nil ;; This is a clean way to ensure the new process inherits the ;; right coding systems in both Emacs and XEmacs. (let ((coding-system-for-read 'binary) diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 324cf99554d..61e07a0d9ca 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -66,7 +66,7 @@ (defconst url-http-default-port 80 "Default HTTP port.") (defconst url-http-asynchronous-p t "HTTP retrievals are asynchronous.") -(defalias 'url-http-expand-file-name 'url-default-expander) +(defalias 'url-http-expand-file-name #'url-default-expander) (defvar url-http-real-basic-auth-storage nil) (defvar url-http-proxy-basic-auth-storage nil) @@ -150,7 +150,7 @@ request.") ;; These routines will allow us to implement persistent HTTP ;; connections. (defsubst url-http-debug (&rest args) - (apply 'url-debug 'http args)) + (apply #'url-debug 'http args)) (defun url-http-mark-connection-as-busy (host port proc) (url-http-debug "Marking connection as busy: %s:%d %S" host port proc) @@ -1203,8 +1203,7 @@ the end of the document." ;; We got back a headerless malformed response from the ;; server. (url-http-activate-callback)) - ((or (= url-http-response-status 204) - (= url-http-response-status 205)) + ((memq url-http-response-status '(204 205)) (url-http-debug "%d response must have headers only (%s)." url-http-response-status (buffer-name)) (when (url-http-parse-headers) @@ -1239,11 +1238,11 @@ the end of the document." (url-http-debug "Saw HTTP/0.9 response, connection closed means end of document.") (setq url-http-after-change-function - 'url-http-simple-after-change-function)) + #'url-http-simple-after-change-function)) ((equal url-http-transfer-encoding "chunked") (url-http-debug "Saw chunked encoding.") (setq url-http-after-change-function - 'url-http-chunked-encoding-after-change-function) + #'url-http-chunked-encoding-after-change-function) (when (> nd url-http-end-of-headers) (url-http-debug "Calling initial chunked-encoding for extra data at end of headers") @@ -1254,7 +1253,7 @@ the end of the document." (url-http-debug "Got a content-length, being smart about document end.") (setq url-http-after-change-function - 'url-http-content-length-after-change-function) + #'url-http-content-length-after-change-function) (cond ((= 0 url-http-content-length) ;; We got a NULL body! Activate the callback @@ -1275,7 +1274,7 @@ the end of the document." (t (url-http-debug "No content-length, being dumb.") (setq url-http-after-change-function - 'url-http-simple-after-change-function))))) + #'url-http-simple-after-change-function))))) ;; We are still at the beginning of the buffer... must just be ;; waiting for a response. (url-http-debug "Spinning waiting for headers...") @@ -1374,7 +1373,7 @@ The return value of this function is the retrieval buffer." url-http-referer referer) (set-process-buffer connection buffer) - (set-process-filter connection 'url-http-generic-filter) + (set-process-filter connection #'url-http-generic-filter) (pcase (process-status connection) ('connect ;; Asynchronous connection @@ -1388,12 +1387,12 @@ The return value of this function is the retrieval buffer." (url-type url-current-object))) (url-https-proxy-connect connection) (set-process-sentinel connection - 'url-http-end-of-document-sentinel) + #'url-http-end-of-document-sentinel) (process-send-string connection (url-http-create-request))))))) buffer)) (defun url-https-proxy-connect (connection) - (setq url-http-after-change-function 'url-https-proxy-after-change-function) + (setq url-http-after-change-function #'url-https-proxy-after-change-function) (process-send-string connection (format @@ -1441,7 +1440,7 @@ The return value of this function is the retrieval buffer." (with-current-buffer process-buffer (erase-buffer)) (set-process-buffer tls-connection process-buffer) (setq url-http-after-change-function - 'url-http-wait-for-headers-change-function) + #'url-http-wait-for-headers-change-function) (set-process-filter tls-connection 'url-http-generic-filter) (process-send-string tls-connection (url-http-create-request))) @@ -1510,7 +1509,7 @@ The return value of this function is the retrieval buffer." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defalias 'url-http-symbol-value-in-buffer (if (fboundp 'symbol-value-in-buffer) - 'symbol-value-in-buffer + #'symbol-value-in-buffer (lambda (symbol buffer &optional unbound-value) "Return the value of SYMBOL in BUFFER, or UNBOUND-VALUE if it is unbound." (with-current-buffer buffer diff --git a/lisp/url/url-imap.el b/lisp/url/url-imap.el index 05c3e73fb0e..492907f33ff 100644 --- a/lisp/url/url-imap.el +++ b/lisp/url/url-imap.el @@ -1,4 +1,4 @@ -;;; url-imap.el --- IMAP retrieval routines +;;; url-imap.el --- IMAP retrieval routines -*- lexical-binding: t; -*- ;; Copyright (C) 1999, 2004-2021 Free Software Foundation, Inc. @@ -37,6 +37,9 @@ (defconst url-imap-default-port 143 "Default IMAP port.") +(defvar imap-username) +(defvar imap-password) + (defun url-imap-open-host (host port user pass) ;; xxx use user and password (if (fboundp 'nnheader-init-server-buffer) diff --git a/lisp/url/url-ldap.el b/lisp/url/url-ldap.el index 0fa9970fa47..d26562b7f10 100644 --- a/lisp/url/url-ldap.el +++ b/lisp/url/url-ldap.el @@ -1,4 +1,4 @@ -;;; url-ldap.el --- LDAP Uniform Resource Locator retrieval code +;;; url-ldap.el --- LDAP Uniform Resource Locator retrieval code -*- lexical-binding: t; -*- ;; Copyright (C) 1998-1999, 2004-2021 Free Software Foundation, Inc. diff --git a/lisp/url/url-mailto.el b/lisp/url/url-mailto.el index 688f102cabd..72884c07cc9 100644 --- a/lisp/url/url-mailto.el +++ b/lisp/url/url-mailto.el @@ -1,4 +1,4 @@ -;;; url-mail.el --- Mail Uniform Resource Locator retrieval code +;;; url-mail.el --- Mail Uniform Resource Locator retrieval code -*- lexical-binding: t; -*- ;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc. @@ -67,7 +67,7 @@ ;; mailto:wmperry@gnu.org (setf (url-filename url) (concat (url-user url) "@" (url-filename url)))) (setq url (url-filename url)) - (let (to args source-url subject func headers-start) + (let (to args source-url subject headers-start) ;; func (if (string-match (regexp-quote "?") url) (setq headers-start (match-end 0) to (url-unhex-string (substring url 0 (match-beginning 0))) @@ -76,10 +76,11 @@ (setq to (url-unhex-string url))) (setq source-url (url-view-url t)) (if (and url-request-data (not (assoc "subject" args))) - (setq args (cons (list "subject" + (push (list "subject" (concat "Automatic submission from " url-package-name "/" - url-package-version)) args))) + url-package-version)) + args)) (if (and source-url (not (assoc "x-url-from" args))) (setq args (cons (list "x-url-from" source-url) args))) @@ -107,7 +108,7 @@ (replace-regexp-in-string "\r\n" "\n" string)) (cdar args) "\n"))) (url-mail-goto-field (caar args)) - (setq func (intern-soft (concat "mail-" (caar args)))) + ;; (setq func (intern-soft (concat "mail-" (caar args)))) (insert (mapconcat 'identity (cdar args) ", "))) (setq args (cdr args))) ;; (url-mail-goto-field "User-Agent") diff --git a/lisp/url/url-methods.el b/lisp/url/url-methods.el index 7aad741210d..cfe7d5bc6a3 100644 --- a/lisp/url/url-methods.el +++ b/lisp/url/url-methods.el @@ -1,4 +1,4 @@ -;;; url-methods.el --- Load URL schemes as needed +;;; url-methods.el --- Load URL schemes as needed -*- lexical-binding: t; -*- ;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc. @@ -57,7 +57,7 @@ 'file-exists-p 'ignore 'file-attributes 'ignore)) -(defun url-scheme-default-loader (url &optional callback cbargs) +(defun url-scheme-default-loader (url &optional _callback _cbargs) "Signal an error for an unknown URL scheme." (error "Unknown URL scheme: %s" (url-type url))) diff --git a/lisp/url/url-misc.el b/lisp/url/url-misc.el index d3db31d612a..fe2393beb64 100644 --- a/lisp/url/url-misc.el +++ b/lisp/url/url-misc.el @@ -1,4 +1,4 @@ -;;; url-misc.el --- Misc Uniform Resource Locator retrieval code +;;; url-misc.el --- Misc Uniform Resource Locator retrieval code -*- lexical-binding: t; -*- ;; Copyright (C) 1996-1999, 2002, 2004-2021 Free Software Foundation, ;; Inc. diff --git a/lisp/url/url-news.el b/lisp/url/url-news.el index d5f8483ab7a..585a28291ae 100644 --- a/lisp/url/url-news.el +++ b/lisp/url/url-news.el @@ -1,4 +1,4 @@ -;;; url-news.el --- News Uniform Resource Locator retrieval code +;;; url-news.el --- News Uniform Resource Locator retrieval code -*- lexical-binding: t; -*- ;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc. @@ -106,7 +106,7 @@ ;; Find a news reference (let* ((host (or (url-host url) url-news-server)) (port (url-port url)) - (article-brackets nil) + ;; (article-brackets nil) (buf nil) (article (url-unhex-string (url-filename url)))) (url-news-open-host host port (url-user url) (url-password url)) diff --git a/lisp/url/url-nfs.el b/lisp/url/url-nfs.el index 3c80c8059b5..0449930408d 100644 --- a/lisp/url/url-nfs.el +++ b/lisp/url/url-nfs.el @@ -1,4 +1,4 @@ -;;; url-nfs.el --- NFS URL interface +;;; url-nfs.el --- NFS URL interface -*- lexical-binding: t; -*- ;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc. diff --git a/lisp/url/url-privacy.el b/lisp/url/url-privacy.el index e3ca0f66d98..d926775c48d 100644 --- a/lisp/url/url-privacy.el +++ b/lisp/url/url-privacy.el @@ -1,4 +1,4 @@ -;;; url-privacy.el --- Global history tracking for URL package +;;; url-privacy.el --- Global history tracking for URL package -*- lexical-binding: t; -*- ;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc. @@ -23,7 +23,7 @@ (require 'url-vars) -(defun url-device-type (&optional device) +(defun url-device-type (&optional _device) (declare (obsolete nil "27.1")) (or window-system 'tty)) diff --git a/lisp/url/url-proxy.el b/lisp/url/url-proxy.el index 6bf65845098..8436c7a4be2 100644 --- a/lisp/url/url-proxy.el +++ b/lisp/url/url-proxy.el @@ -1,4 +1,4 @@ -;;; url-proxy.el --- Proxy server support +;;; url-proxy.el --- Proxy server support -*- lexical-binding: t; -*- ;; Copyright (C) 1999, 2004-2021 Free Software Foundation, Inc. diff --git a/lisp/url/url-tramp.el b/lisp/url/url-tramp.el index 325d25cb8e2..5b9dd8a2682 100644 --- a/lisp/url/url-tramp.el +++ b/lisp/url/url-tramp.el @@ -1,4 +1,4 @@ -;;; url-tramp.el --- file-name-handler magic invoking Tramp for some protocols +;;; url-tramp.el --- file-name-handler magic invoking Tramp for some protocols -*- lexical-binding: t; -*- ;; Copyright (C) 2014-2021 Free Software Foundation, Inc. diff --git a/lisp/url/url.el b/lisp/url/url.el index 172a3af2b3b..8daf9f0a8e8 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el @@ -156,16 +156,16 @@ If INHIBIT-COOKIES, cookies will neither be stored nor sent to the server. If URL is a multibyte string, it will be encoded as utf-8 and URL-encoded before it's used." -;;; XXX: There is code in Emacs that does dynamic binding -;;; of the following variables around url-retrieve: -;;; url-standalone-mode, url-gateway-unplugged, w3-honor-stylesheets, -;;; url-confirmation-func, url-cookie-multiple-line, -;;; url-cookie-{{,secure-}storage,confirmation} -;;; url-standalone-mode and url-gateway-unplugged should work as -;;; usual. url-confirmation-func is only used in nnwarchive.el and -;;; webmail.el; the latter should be updated. Is -;;; url-cookie-multiple-line needed anymore? The other url-cookie-* -;;; are (for now) only used in synchronous retrievals. + ;; XXX: There is code in Emacs that does dynamic binding + ;; of the following variables around url-retrieve: + ;; url-standalone-mode, url-gateway-unplugged, w3-honor-stylesheets, + ;; url-confirmation-func, url-cookie-multiple-line, + ;; url-cookie-{{,secure-}storage,confirmation} + ;; url-standalone-mode and url-gateway-unplugged should work as + ;; usual. url-confirmation-func is only used in nnwarchive.el and + ;; webmail.el; the latter should be updated. Is + ;; url-cookie-multiple-line needed anymore? The other url-cookie-* + ;; are (for now) only used in synchronous retrievals. (url-retrieve-internal url callback (cons nil cbargs) silent inhibit-cookies)) @@ -210,7 +210,7 @@ URL-encoded before it's used." (asynch (url-scheme-get-property (url-type url) 'asynchronous-p))) (if url-using-proxy (setq asynch t - loader 'url-proxy)) + loader #'url-proxy)) (if asynch (let ((url-current-object url)) (setq buffer (funcall loader url callback cbargs))) From eded2a7ad7d456a417354a2797c18e9a578414d7 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 27 Jan 2021 03:38:49 +0100 Subject: [PATCH 023/107] Try to improve the read-regexp doc string * lisp/replace.el (read-regexp): Attempt to clarify the semantics (bug#46088). --- lisp/replace.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/replace.el b/lisp/replace.el index db5b340631a..cf1dcb4992f 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -835,12 +835,14 @@ If DEFAULTS is a list of strings, the first element is the default return value, but all the elements are accessible using the history command \\\\[next-history-element]. -If DEFAULTS is a non-nil symbol, then if `read-regexp-defaults-function' -is non-nil, we use that in place of DEFAULTS in the following: - If DEFAULTS is the symbol `regexp-history-last', we use the first - element of HISTORY (if specified) or `regexp-history'. - If DEFAULTS is a function, we call it with no arguments and use - what it returns, which should be either nil, a string, or a list of strings. +DEFAULTS can be a symbol. If DEFAULTS is the symbol +`regexp-history-last', we use the first element of HISTORY (if +specified) or `regexp-history'. If DEFAULTS is a symbol with a +function definition, we call it with no arguments and use what it +returns, which should be either nil, a string, or a list of +strings. Other symbol values for DEFAULTS are ignored. If +`read-regexp-defaults-function' is non-nil, its value is used +instead of DEFAULTS in the two cases described in this paragraph. We append the standard values from `read-regexp-suggestions' to DEFAULTS before using it. From f9cc2d48246fe8370e9286866e6115ba8e2acf44 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 27 Jan 2021 03:47:02 +0100 Subject: [PATCH 024/107] read-regexp-suggestions doc string improvement * lisp/replace.el (read-regexp-suggestions): Add a link to the manual to explain what a tag is (bug#46089). --- lisp/replace.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/replace.el b/lisp/replace.el index cf1dcb4992f..32fbc24064c 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -808,10 +808,12 @@ the function that you set this to can check `this-command'." (defun read-regexp-suggestions () "Return a list of standard suggestions for `read-regexp'. -By default, the list includes the tag at point, the last isearch regexp, -the last isearch string, and the last replacement regexp. `read-regexp' -appends the list returned by this function to the end of values available -via \\\\[next-history-element]." +By default, the list includes the \"tag\" at point (see Info +node `(emacs) Identifier Search'), the last isearch regexp, the +last isearch string, and the last replacement regexp. +`read-regexp' appends the list returned by this function to the +end of values available via +\\\\[next-history-element]." (list (find-tag-default-as-regexp) (find-tag-default-as-symbol-regexp) From 883c15fb3244500901bb30bddc66c26e8a6ba200 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 27 Jan 2021 04:27:42 +0100 Subject: [PATCH 025/107] Fix setting of line/point style in calc gnuplot * lisp/calc/calc-graph.el (calc-graph-set-styles): Modern gnuplot requires "ls" before the line style and "ps" before the point style (bug#46070). --- lisp/calc/calc-graph.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el index 4785fb7fba2..423d1e64126 100644 --- a/lisp/calc/calc-graph.el +++ b/lisp/calc/calc-graph.el @@ -1136,11 +1136,11 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (if penbl "linespoints" "lines") (if penbl "points" "dots")))) (if (and pstyle (> pstyle 0)) - (insert " " + (insert " ls " (if (and lstyle (> lstyle 0)) (int-to-string lstyle) "1") - " " (int-to-string pstyle)) + " ps " (int-to-string pstyle)) (if (and lstyle (> lstyle 0)) - (insert " " (int-to-string lstyle))))))) + (insert " ls " (int-to-string lstyle))))))) (calc-graph-view-commands)) (defun calc-graph-zero-x (flag) From 9d50d7a0c6ff742ad682ef63e09c7e7341909b28 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 27 Jan 2021 07:04:08 +0100 Subject: [PATCH 026/107] Fix indentation in sieve-mode * lisp/net/sieve-mode.el (sieve-mode-indent-function): New function. (sieve-mode): Don't inherit from C mode, because the syntax doesn't really resemble C mode that much (except being curly braced). --- lisp/net/sieve-mode.el | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lisp/net/sieve-mode.el b/lisp/net/sieve-mode.el index fbc4e75fae5..7bc1d16122d 100644 --- a/lisp/net/sieve-mode.el +++ b/lisp/net/sieve-mode.el @@ -128,6 +128,9 @@ (modify-syntax-entry ?| "." st) (modify-syntax-entry ?_ "_" st) (modify-syntax-entry ?\' "\"" st) + (modify-syntax-entry ?\{ "(}" st) + (modify-syntax-entry ?\} "){" st) + (modify-syntax-entry ?\" "\"" st) st) "Syntax table in use in sieve-mode buffers.") @@ -178,12 +181,8 @@ 'syntax-table (string-to-syntax "|"))))) ;;;###autoload -(define-derived-mode sieve-mode c-mode "Sieve" +(define-derived-mode sieve-mode prog-mode "Sieve" "Major mode for editing Sieve code. -This is much like C mode except for the syntax of comments. Its keymap -inherits from C mode's and it has the same variables for customizing -indentation. It has its own abbrev table and its own syntax table. - Turning on Sieve mode runs `sieve-mode-hook'." (setq-local paragraph-start (concat "$\\|" page-delimiter)) (setq-local paragraph-separate paragraph-start) @@ -194,8 +193,17 @@ Turning on Sieve mode runs `sieve-mode-hook'." (setq-local syntax-propertize-function #'sieve-syntax-propertize) (setq-local font-lock-defaults '(sieve-font-lock-keywords nil nil ((?_ . "w")))) + (setq-local indent-line-function #'sieve-mode-indent-function) (easy-menu-add-item nil nil sieve-mode-menu)) +(defun sieve-mode-indent-function () + (save-excursion + (beginning-of-line) + (let ((depth (car (syntax-ppss)))) + (when (looking-at "[ \t]*}") + (setq depth (1- depth))) + (indent-line-to (* 2 depth))))) + (provide 'sieve-mode) ;; sieve-mode.el ends here From fb05199b0bf2055d75b7eba52c3ab2fd49d38509 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 25 Jan 2021 22:10:15 +0200 Subject: [PATCH 027/107] Support variable name for previous-window in display-buffer-in-previous-window * lisp/window.el (display-buffer-in-previous-window): Support the value of 'previous-window' entry as a symbol for variable name (bug#45688). --- lisp/window.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/window.el b/lisp/window.el index 0a37d16273f..d5876914201 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -8196,8 +8196,8 @@ such alists. If ALIST has a non-nil `inhibit-same-window' entry, the selected window is not usable. A dedicated window is usable only if it already shows BUFFER. If ALIST contains a `previous-window' -entry, the window specified by that entry is usable even if it -never showed BUFFER before. +entry, the window specified by that entry (either a variable +or a value) is usable even if it never showed BUFFER before. If ALIST contains a `reusable-frames' entry, its value determines which frames to search for a usable window: @@ -8239,6 +8239,7 @@ indirectly called by the latter." 0) (display-buffer-reuse-frames 0) (t (last-nonminibuffer-frame)))) + (previous-window (cdr (assq 'previous-window alist))) best-window second-best-window window) ;; Scan windows whether they have shown the buffer recently. (catch 'best @@ -8252,7 +8253,9 @@ indirectly called by the latter." (throw 'best t))))) ;; When ALIST has a `previous-window' entry, that entry may override ;; anything we found so far. - (when (and (setq window (cdr (assq 'previous-window alist))) + (when (and previous-window (boundp previous-window)) + (setq previous-window (symbol-value previous-window))) + (when (and (setq window previous-window) (window-live-p window) (or (eq buffer (window-buffer window)) (not (window-dedicated-p window)))) From 08574a7f40f27ad29efb8f7d975012ecc9111717 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 27 Jan 2021 11:42:30 +0200 Subject: [PATCH 028/107] * lisp/subr.el (empty-history): Move defvar to functions where it's used. --- lisp/subr.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index f249ec3578c..afa73c72eaa 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2965,8 +2965,6 @@ Also discard all previous input in the minibuffer." (minibuffer-message "Wrong answer") (sit-for 2))) -(defvar empty-history) - (defun read-char-from-minibuffer (prompt &optional chars history) "Read a character from the minibuffer, prompting for it with PROMPT. Like `read-char', but uses the minibuffer to read and return a character. @@ -2981,6 +2979,7 @@ while calling this function, then pressing `help-char' causes it to evaluate `help-form' and display the result. There is no need to explicitly add `help-char' to CHARS; `help-char' is bound automatically to `help-form-show'." + (defvar empty-history) (let* ((empty-history '()) (map (if (consp chars) (or (gethash (list help-form (cons help-char chars)) @@ -3093,8 +3092,6 @@ Also discard all previous input in the minibuffer." "Prefer `read-key' when answering a \"y or n\" question by `y-or-n-p'. Otherwise, use the minibuffer.") -(defvar empty-history) - (defun y-or-n-p (prompt) "Ask user a \"y or n\" question. Return t if answer is \"y\" and nil if it is \"n\". @@ -3190,6 +3187,7 @@ is nil and `use-dialog-box' is non-nil." (discard-input))) (t (setq prompt (funcall padded prompt)) + (defvar empty-history) (let* ((empty-history '()) (enable-recursive-minibuffers t) (msg help-form) From 49eb03d6c8a181fd46adbbcf1f0a976d0a9efa87 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 27 Jan 2021 17:15:46 +0200 Subject: [PATCH 029/107] Improve documentation of 'read-regexp' and friends * doc/emacs/glossary.texi (Glossary): Add "Tag" to the Glossary. * doc/emacs/maintaining.texi (Xref): Mention that identifiers are also known as "tags". * lisp/replace.el (read-regexp, read-regexp-suggestions): Improve wording of doc strings. (Bug#46088) (Bug#46089) --- doc/emacs/glossary.texi | 8 +++++-- doc/emacs/maintaining.texi | 20 +++++++++-------- lisp/replace.el | 44 ++++++++++++++++++++------------------ 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi index 35df06591eb..4f971eb1e01 100644 --- a/doc/emacs/glossary.texi +++ b/doc/emacs/glossary.texi @@ -1369,10 +1369,14 @@ configurations. @xref{Tab Bars}. The tab line is a line of tabs at the top of an Emacs window. Clicking on one of these tabs switches window buffers. @xref{Tab Line}. +@item Tag +A tag is an identifier in a program source. @xref{Xref}. + @anchor{Glossary---Tags Table} @item Tags Table -A tags table is a file that serves as an index to the function -definitions in one or more other files. @xref{Tags Tables}. +A tags table is a file that serves as an index to identifiers: definitions +of functions, macros, data structures, etc., in one or more other files. +@xref{Tags Tables}. @item Termscript File A termscript file contains a record of all characters sent by Emacs to diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 415815473e5..bc276c49046 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1994,19 +1994,21 @@ Of course, you should substitute the proper years and copyright holder. @section Find Identifier References @cindex xref +@cindex tag An @dfn{identifier} is a name of a syntactical subunit of the program: a function, a subroutine, a method, a class, a data type, a macro, etc. In a programming language, each identifier is a symbol in -the language's syntax. Program development and maintenance requires -capabilities to quickly find where each identifier was defined and -referenced, to rename identifiers across the entire project, etc. +the language's syntax. Identifiers are also known as @dfn{tags}. -These capabilities are also useful for finding references in major -modes other than those defined to support programming languages. For -example, chapters, sections, appendices, etc.@: of a text or a @TeX{} -document can be treated as subunits as well, and their names can be -used as identifiers. In this chapter, we use the term ``identifiers'' -to collectively refer to the names of any kind of subunits, in program +Program development and maintenance requires capabilities to quickly +find where each identifier was defined and referenced, to rename +identifiers across the entire project, etc. These capabilities are +also useful for finding references in major modes other than those +defined to support programming languages. For example, chapters, +sections, appendices, etc.@: of a text or a @TeX{} document can be +treated as subunits as well, and their names can be used as +identifiers. In this chapter, we use the term ``identifiers'' to +collectively refer to the names of any kind of subunits, in program source and in other kinds of text alike. Emacs provides a unified interface to these capabilities, called diff --git a/lisp/replace.el b/lisp/replace.el index 32fbc24064c..4483d7f7800 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -808,11 +808,11 @@ the function that you set this to can check `this-command'." (defun read-regexp-suggestions () "Return a list of standard suggestions for `read-regexp'. -By default, the list includes the \"tag\" at point (see Info -node `(emacs) Identifier Search'), the last isearch regexp, the -last isearch string, and the last replacement regexp. -`read-regexp' appends the list returned by this function to the -end of values available via +By default, the list includes the identifier (a.k.a. \"tag\") +at point (see Info node `(emacs) Identifier Search'), the last +isearch regexp, the last isearch string, and the last +replacement regexp. `read-regexp' appends the list returned +by this function to the end of values available via \\\\[next-history-element]." (list (find-tag-default-as-regexp) @@ -827,33 +827,35 @@ Prompt with the string PROMPT. If PROMPT ends in \":\" (followed by optional whitespace), use it as-is. Otherwise, add \": \" to the end, possibly preceded by the default result (see below). -The optional argument DEFAULTS can be either: nil, a string, a list -of strings, or a symbol. We use DEFAULTS to construct the default -return value in case of empty input. +The optional argument DEFAULTS is used to construct the default +return value in case of empty input. DEFAULTS can be nil, a string, +a list of strings, or a symbol. -If DEFAULTS is a string, we use it as-is. +If DEFAULTS is a string, the function uses it as-is. If DEFAULTS is a list of strings, the first element is the default return value, but all the elements are accessible using the history command \\\\[next-history-element]. -DEFAULTS can be a symbol. If DEFAULTS is the symbol -`regexp-history-last', we use the first element of HISTORY (if -specified) or `regexp-history'. If DEFAULTS is a symbol with a -function definition, we call it with no arguments and use what it -returns, which should be either nil, a string, or a list of -strings. Other symbol values for DEFAULTS are ignored. If -`read-regexp-defaults-function' is non-nil, its value is used -instead of DEFAULTS in the two cases described in this paragraph. +If DEFAULTS is the symbol `regexp-history-last', the default return +value will be the first element of HISTORY. If HISTORY is omitted or +nil, `regexp-history' is used instead. +If DEFAULTS is a symbol with a function definition, it is called with +no arguments and should return either nil, a string, or a list of +strings, which will be used as above. +Other symbol values for DEFAULTS are ignored. -We append the standard values from `read-regexp-suggestions' to DEFAULTS -before using it. +If `read-regexp-defaults-function' is non-nil, its value is used +instead of DEFAULTS in the two cases described in the last paragraph. + +Before using whatever value DEFAULTS yields, the function appends the +standard values from `read-regexp-suggestions' to that value. If the first element of DEFAULTS is non-nil (and if PROMPT does not end -in \":\", followed by optional whitespace), we add it to the prompt. +in \":\", followed by optional whitespace), DEFAULT is added to the prompt. The optional argument HISTORY is a symbol to use for the history list. -If nil, uses `regexp-history'." +If nil, use `regexp-history'." (let* ((defaults (if (and defaults (symbolp defaults)) (cond From 932aba674c9a64dfd970d7c2343517c7f4c7a409 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 27 Jan 2021 03:38:49 +0100 Subject: [PATCH 030/107] Try to improve the read-regexp doc string * lisp/replace.el (read-regexp): Attempt to clarify the semantics (bug#46088). (cherry picked from commit eded2a7ad7d456a417354a2797c18e9a578414d7) --- lisp/replace.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/replace.el b/lisp/replace.el index 0288be82d27..a7695951255 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -813,12 +813,14 @@ If DEFAULTS is a list of strings, the first element is the default return value, but all the elements are accessible using the history command \\\\[next-history-element]. -If DEFAULTS is a non-nil symbol, then if `read-regexp-defaults-function' -is non-nil, we use that in place of DEFAULTS in the following: - If DEFAULTS is the symbol `regexp-history-last', we use the first - element of HISTORY (if specified) or `regexp-history'. - If DEFAULTS is a function, we call it with no arguments and use - what it returns, which should be either nil, a string, or a list of strings. +DEFAULTS can be a symbol. If DEFAULTS is the symbol +`regexp-history-last', we use the first element of HISTORY (if +specified) or `regexp-history'. If DEFAULTS is a symbol with a +function definition, we call it with no arguments and use what it +returns, which should be either nil, a string, or a list of +strings. Other symbol values for DEFAULTS are ignored. If +`read-regexp-defaults-function' is non-nil, its value is used +instead of DEFAULTS in the two cases described in this paragraph. We append the standard values from `read-regexp-suggestions' to DEFAULTS before using it. From 0340e9eccbb15492064b8dfda9313793b49de752 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 27 Jan 2021 03:47:02 +0100 Subject: [PATCH 031/107] read-regexp-suggestions doc string improvement * lisp/replace.el (read-regexp-suggestions): Add a link to the manual to explain what a tag is (bug#46089). (cherry picked from commit f9cc2d48246fe8370e9286866e6115ba8e2acf44) --- lisp/replace.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/replace.el b/lisp/replace.el index a7695951255..d1618a485ed 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -786,10 +786,12 @@ the function that you set this to can check `this-command'." (defun read-regexp-suggestions () "Return a list of standard suggestions for `read-regexp'. -By default, the list includes the tag at point, the last isearch regexp, -the last isearch string, and the last replacement regexp. `read-regexp' -appends the list returned by this function to the end of values available -via \\\\[next-history-element]." +By default, the list includes the \"tag\" at point (see Info +node `(emacs) Identifier Search'), the last isearch regexp, the +last isearch string, and the last replacement regexp. +`read-regexp' appends the list returned by this function to the +end of values available via +\\\\[next-history-element]." (list (find-tag-default-as-regexp) (find-tag-default-as-symbol-regexp) From e79e377a4e06d187e56dcad826fb761659abe3f3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 27 Jan 2021 17:15:46 +0200 Subject: [PATCH 032/107] Improve documentation of 'read-regexp' and friends * doc/emacs/glossary.texi (Glossary): Add "Tag" to the Glossary. * doc/emacs/maintaining.texi (Xref): Mention that identifiers are also known as "tags". * lisp/replace.el (read-regexp, read-regexp-suggestions): Improve wording of doc strings. (Bug#46088) (Bug#46089) (cherry picked from commit 49eb03d6c8a181fd46adbbcf1f0a976d0a9efa87) --- doc/emacs/glossary.texi | 8 +++++-- doc/emacs/maintaining.texi | 20 +++++++++-------- lisp/replace.el | 44 ++++++++++++++++++++------------------ 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi index 35df06591eb..4f971eb1e01 100644 --- a/doc/emacs/glossary.texi +++ b/doc/emacs/glossary.texi @@ -1369,10 +1369,14 @@ configurations. @xref{Tab Bars}. The tab line is a line of tabs at the top of an Emacs window. Clicking on one of these tabs switches window buffers. @xref{Tab Line}. +@item Tag +A tag is an identifier in a program source. @xref{Xref}. + @anchor{Glossary---Tags Table} @item Tags Table -A tags table is a file that serves as an index to the function -definitions in one or more other files. @xref{Tags Tables}. +A tags table is a file that serves as an index to identifiers: definitions +of functions, macros, data structures, etc., in one or more other files. +@xref{Tags Tables}. @item Termscript File A termscript file contains a record of all characters sent by Emacs to diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 14911d30e99..9bb3378c3f3 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1860,19 +1860,21 @@ Of course, you should substitute the proper years and copyright holder. @section Find Identifier References @cindex xref +@cindex tag An @dfn{identifier} is a name of a syntactical subunit of the program: a function, a subroutine, a method, a class, a data type, a macro, etc. In a programming language, each identifier is a symbol in -the language's syntax. Program development and maintenance requires -capabilities to quickly find where each identifier was defined and -referenced, to rename identifiers across the entire project, etc. +the language's syntax. Identifiers are also known as @dfn{tags}. -These capabilities are also useful for finding references in major -modes other than those defined to support programming languages. For -example, chapters, sections, appendices, etc.@: of a text or a @TeX{} -document can be treated as subunits as well, and their names can be -used as identifiers. In this chapter, we use the term ``identifiers'' -to collectively refer to the names of any kind of subunits, in program +Program development and maintenance requires capabilities to quickly +find where each identifier was defined and referenced, to rename +identifiers across the entire project, etc. These capabilities are +also useful for finding references in major modes other than those +defined to support programming languages. For example, chapters, +sections, appendices, etc.@: of a text or a @TeX{} document can be +treated as subunits as well, and their names can be used as +identifiers. In this chapter, we use the term ``identifiers'' to +collectively refer to the names of any kind of subunits, in program source and in other kinds of text alike. Emacs provides a unified interface to these capabilities, called diff --git a/lisp/replace.el b/lisp/replace.el index d1618a485ed..416d9f1d1ec 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -786,11 +786,11 @@ the function that you set this to can check `this-command'." (defun read-regexp-suggestions () "Return a list of standard suggestions for `read-regexp'. -By default, the list includes the \"tag\" at point (see Info -node `(emacs) Identifier Search'), the last isearch regexp, the -last isearch string, and the last replacement regexp. -`read-regexp' appends the list returned by this function to the -end of values available via +By default, the list includes the identifier (a.k.a. \"tag\") +at point (see Info node `(emacs) Identifier Search'), the last +isearch regexp, the last isearch string, and the last +replacement regexp. `read-regexp' appends the list returned +by this function to the end of values available via \\\\[next-history-element]." (list (find-tag-default-as-regexp) @@ -805,33 +805,35 @@ Prompt with the string PROMPT. If PROMPT ends in \":\" (followed by optional whitespace), use it as-is. Otherwise, add \": \" to the end, possibly preceded by the default result (see below). -The optional argument DEFAULTS can be either: nil, a string, a list -of strings, or a symbol. We use DEFAULTS to construct the default -return value in case of empty input. +The optional argument DEFAULTS is used to construct the default +return value in case of empty input. DEFAULTS can be nil, a string, +a list of strings, or a symbol. -If DEFAULTS is a string, we use it as-is. +If DEFAULTS is a string, the function uses it as-is. If DEFAULTS is a list of strings, the first element is the default return value, but all the elements are accessible using the history command \\\\[next-history-element]. -DEFAULTS can be a symbol. If DEFAULTS is the symbol -`regexp-history-last', we use the first element of HISTORY (if -specified) or `regexp-history'. If DEFAULTS is a symbol with a -function definition, we call it with no arguments and use what it -returns, which should be either nil, a string, or a list of -strings. Other symbol values for DEFAULTS are ignored. If -`read-regexp-defaults-function' is non-nil, its value is used -instead of DEFAULTS in the two cases described in this paragraph. +If DEFAULTS is the symbol `regexp-history-last', the default return +value will be the first element of HISTORY. If HISTORY is omitted or +nil, `regexp-history' is used instead. +If DEFAULTS is a symbol with a function definition, it is called with +no arguments and should return either nil, a string, or a list of +strings, which will be used as above. +Other symbol values for DEFAULTS are ignored. -We append the standard values from `read-regexp-suggestions' to DEFAULTS -before using it. +If `read-regexp-defaults-function' is non-nil, its value is used +instead of DEFAULTS in the two cases described in the last paragraph. + +Before using whatever value DEFAULTS yields, the function appends the +standard values from `read-regexp-suggestions' to that value. If the first element of DEFAULTS is non-nil (and if PROMPT does not end -in \":\", followed by optional whitespace), we add it to the prompt. +in \":\", followed by optional whitespace), DEFAULT is added to the prompt. The optional argument HISTORY is a symbol to use for the history list. -If nil, uses `regexp-history'." +If nil, use `regexp-history'." (let* ((defaults (if (and defaults (symbolp defaults)) (cond From 45112398cdcfa1e32986ef630dc235ce38d10774 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 27 Jan 2021 16:30:08 +0100 Subject: [PATCH 033/107] * lisp/net/dbus.el (dbus-monitor-handler): Disable buffer undo. --- lisp/net/dbus.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 7a7bbef5364..195ddc6bbac 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -2079,6 +2079,7 @@ daemon, it is rather the timestamp the corresponding D-Bus event has been handled by this function." (with-current-buffer (get-buffer-create "*D-Bus Monitor*") (special-mode) + (buffer-disable-undo) ;; Move forward and backward between messages. (local-set-key [?n] #'forward-paragraph) (local-set-key [?p] #'backward-paragraph) From 12095de8b918b3c44c603bf88bc98f1842910f86 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 27 Jan 2021 16:30:49 +0100 Subject: [PATCH 034/107] Some Tramp fixes * doc/misc/tramp.texi (GVFS-based methods): Ban sftp RemoteCommand option. * lisp/net/tramp-adb.el (tramp-adb-handle-copy-file) (tramp-adb-handle-rename-file): Avoid calling jka-compr when writing the target file. * lisp/net/tramp-sh.el (tramp-sh-handle-file-ownership-preserved-p): Skip GROUP test on *BSD machines. * test/lisp/net/tramp-tests.el (tramp-test17-insert-directory-one-file): Skip for tamp-crypt.el. (tramp--test-sh-no-ls--dired-p): Ignore errors. --- doc/misc/tramp.texi | 3 +++ lisp/net/tramp-adb.el | 10 ++++++++-- lisp/net/tramp-sh.el | 6 ++++++ test/lisp/net/tramp-tests.el | 6 +++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 5d89b065882..efe839574d2 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -1286,6 +1286,9 @@ This method uses @command{sftp} in order to securely access remote hosts. @command{sftp} is a more secure option for connecting to hosts that for security reasons refuse @command{ssh} connections. +When there is a respective entry in your @command{ssh} configuration, +do @emph{not} set the @option{RemoteCommand} option. + @end table @defopt tramp-gvfs-methods diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 2c4ef2acaef..73dffe1d64f 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -636,7 +636,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (copy-directory filename newname keep-date t) (let ((t1 (tramp-tramp-file-p filename)) - (t2 (tramp-tramp-file-p newname))) + (t2 (tramp-tramp-file-p newname)) + ;; We don't want the target file to be compressed, so we + ;; let-bind `jka-compr-inhibit' to t. + (jka-compr-inhibit t)) (with-parsed-tramp-file-name (if t1 filename newname) nil (unless (file-exists-p filename) (tramp-error @@ -717,7 +720,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (delete-directory filename 'recursive)) (let ((t1 (tramp-tramp-file-p filename)) - (t2 (tramp-tramp-file-p newname))) + (t2 (tramp-tramp-file-p newname)) + ;; We don't want the target file to be compressed, so we + ;; let-bind `jka-compr-inhibit' to t. + (jka-compr-inhibit t)) (with-parsed-tramp-file-name (if t1 filename newname) nil (unless (file-exists-p filename) (tramp-error diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index ed3d15377c3..2274efdf8b5 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1708,6 +1708,12 @@ ID-FORMAT valid values are `string' and `integer'." (= (tramp-compat-file-attribute-user-id attributes) (tramp-get-remote-uid v 'integer)) (or (not group) + ;; On BSD-derived systems files always inherit the + ;; parent directory's group, so skip the group-gid + ;; test. + (string-match-p + "BSD\\|DragonFly\\|Darwin" + (tramp-get-connection-property v "uname" "")) (= (tramp-compat-file-attribute-group-id attributes) (tramp-get-remote-gid v 'integer))))))))) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 7757c55c16b..6467c7ee219 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -3192,6 +3192,8 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (ert-deftest tramp-test17-insert-directory-one-file () "Check `insert-directory' inside directory listing." (skip-unless (tramp--test-enabled)) + ;; Relative file names in dired are not supported in tramp-crypt.el. + (skip-unless (not (tramp--test-crypt-p))) (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) (let* ((tmp-name1 @@ -5793,7 +5795,9 @@ Additionally, ls does not support \"--dired\"." (and (tramp--test-sh-p) (with-temp-buffer ;; We must refill the cache. `insert-directory' does it. - (insert-directory tramp-test-temporary-file-directory "-al") + ;; This fails for tramp-crypt.el, so we ignore that. + (ignore-errors + (insert-directory tramp-test-temporary-file-directory "-al")) (not (tramp-get-connection-property tramp-test-vec "ls--dired" nil))))) (defun tramp--test-share-p () From ff0341126918e36777d1b85a3661577442b574cb Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 27 Jan 2021 17:52:51 +0200 Subject: [PATCH 035/107] Fix display of stretches of whitespace in the display margins * src/xdisp.c (produce_stretch_glyph): Truncate the stretch glyph due to line wrap only when drawing in the text area. * src/xterm.c (x_draw_stretch_glyph_string): * src/w32term.c (w32_draw_stretch_glyph_string): Fix the adjustment of the stretch X and width so that stretch glyphs could be drawn in the left margin. Reported by Paul W. Rankin . --- src/w32term.c | 27 +++++++++++++++++++++------ src/xdisp.c | 3 ++- src/xterm.c | 27 +++++++++++++++++++++------ 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/src/w32term.c b/src/w32term.c index 109aa58d732..0ee805a8526 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2404,14 +2404,29 @@ w32_draw_stretch_glyph_string (struct glyph_string *s) else if (!s->background_filled_p) { int background_width = s->background_width; - int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); + int x = s->x, text_left_x = window_box_left_offset (s->w, TEXT_AREA); - /* Don't draw into left margin, fringe or scrollbar area - except for header line and mode line. */ - if (x < left_x && !s->row->mode_line_p) + /* Don't draw into left fringe or scrollbar area except for + header line and mode line. */ + if (x < text_left_x && !s->row->mode_line_p) { - background_width -= left_x - x; - x = left_x; + int left_x = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w); + int right_x = text_left_x; + + if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w)) + left_x += WINDOW_LEFT_FRINGE_WIDTH (s->w); + else + right_x -= WINDOW_LEFT_FRINGE_WIDTH (s->w); + + /* Adjust X and BACKGROUND_WIDTH to fit inside the space + between LEFT_X and RIGHT_X. */ + if (x < left_x) + { + background_width -= left_x - x; + x = left_x; + } + if (x + background_width > right_x) + background_width = right_x - x; } if (background_width > 0) w32_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); diff --git a/src/xdisp.c b/src/xdisp.c index e1e4ff41365..11b9e1becfd 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -29813,7 +29813,8 @@ produce_stretch_glyph (struct it *it) #endif /* HAVE_WINDOW_SYSTEM */ height = 1; - if (width > 0 && it->line_wrap != TRUNCATE + if (width > 0 + && it->area == TEXT_AREA && it->line_wrap != TRUNCATE && it->current_x + width > it->last_visible_x) { width = it->last_visible_x - it->current_x; diff --git a/src/xterm.c b/src/xterm.c index a855d2d67aa..744b80c68a0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3585,14 +3585,29 @@ x_draw_stretch_glyph_string (struct glyph_string *s) else if (!s->background_filled_p) { int background_width = s->background_width; - int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); + int x = s->x, text_left_x = window_box_left_offset (s->w, TEXT_AREA); - /* Don't draw into left margin, fringe or scrollbar area - except for header line and mode line. */ - if (x < left_x && !s->row->mode_line_p) + /* Don't draw into left fringe or scrollbar area except for + header line and mode line. */ + if (x < text_left_x && !s->row->mode_line_p) { - background_width -= left_x - x; - x = left_x; + int left_x = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w); + int right_x = text_left_x; + + if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w)) + left_x += WINDOW_LEFT_FRINGE_WIDTH (s->w); + else + right_x -= WINDOW_LEFT_FRINGE_WIDTH (s->w); + + /* Adjust X and BACKGROUND_WIDTH to fit inside the space + between LEFT_X and RIGHT_X. */ + if (x < left_x) + { + background_width -= left_x - x; + x = left_x; + } + if (x + background_width > right_x) + background_width = right_x - x; } if (background_width > 0) x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); From b0e96e554c0e78c17ee6e092e307112e814e5a65 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 26 Jan 2021 21:11:49 -0500 Subject: [PATCH 036/107] Use lexical-binding in of all lisp/language * lisp/international/titdic-cnv.el (pinyin-convert): Enable lexical-binding in the generated file(s). * lisp/language/ethio-util.el: Use lexical-binding. (ethio-tex-to-fidel-buffer): Use `inhibit-read-only`. Remove unused vars `p` and `ch`. * lisp/language/hanja-util.el: Use lexical-binding. * lisp/language/ind-util.el: Use lexical-binding. (indian-translate-region): Actually use the `from` and `to` arguments. (): Use `dlet`. Remove unused var `current-repertory`. (indian-2-column-to-ucs-region): Remove unused var `pos`. * lisp/language/japan-util.el: Use lexical-binding. (japanese-katakana-region, japanese-hiragana-region) (japanese-zenkaku-region): Remove unused var `next`. * lisp/language/korea-util.el: Use lexical-binding. * lisp/language/lao-util.el: Use lexical-binding. (lao-composition-function): Remove unused var `glyph`. * lisp/language/thai-util.el: Use lexical-binding. (thai-composition-function): Remove unused var `glyph`. * lisp/language/thai-word.el: Use lexical-binding. (thai-forward-word): Remove unused var `tail`. * lisp/language/tibet-util.el: Use lexical-binding. (tibetan-add-components): Remove unused var `tmp`. (tibetan-compose-region): Remove unused vars `str`, `result`, `chars`. * lisp/language/viet-util.el: * lisp/language/tv-util.el: * lisp/language/cyril-util.el: * lisp/language/china-util.el: Use lexical-binding. --- lisp/international/titdic-cnv.el | 6 ++- lisp/language/burmese.el | 4 +- lisp/language/cham.el | 2 +- lisp/language/china-util.el | 2 +- lisp/language/cyril-util.el | 2 +- lisp/language/ethio-util.el | 11 +++--- lisp/language/ethiopic.el | 4 +- lisp/language/hanja-util.el | 2 +- lisp/language/hebrew.el | 6 +-- lisp/language/ind-util.el | 14 +++---- lisp/language/indian.el | 2 +- lisp/language/japan-util.el | 8 ++-- lisp/language/khmer.el | 2 +- lisp/language/korea-util.el | 6 +-- lisp/language/korean.el | 4 +- lisp/language/lao-util.el | 8 ++-- lisp/language/lao.el | 2 +- lisp/language/misc-lang.el | 8 ++-- lisp/language/sinhala.el | 2 +- lisp/language/tai-viet.el | 2 +- lisp/language/thai-util.el | 8 ++-- lisp/language/thai-word.el | 5 +-- lisp/language/tibet-util.el | 64 ++++++++++++++++---------------- lisp/language/tibetan.el | 2 +- lisp/language/tv-util.el | 4 +- lisp/language/viet-util.el | 2 +- 26 files changed, 92 insertions(+), 90 deletions(-) diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index 58c81bfd1f3..753139e5dd8 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el @@ -1212,8 +1212,10 @@ The library is named pinyin.el, and contains the constant (dst-file (cadr command-line-args-left)) (coding-system-for-write 'utf-8-unix)) (with-temp-file dst-file - (insert ";; This file is automatically generated from pinyin.map,\ - by the\n;; function pinyin-convert.\n\n") + (insert ";;; " (file-name-nondirectory dst-file) + " -*- lexical-binding:t -*- +;; This file is automatically generated from pinyin.map, by the +;; function pinyin-convert.\n\n") (insert "(defconst pinyin-character-map\n'(") (let ((pos (point))) (insert-file-contents src-file) diff --git a/lisp/language/burmese.el b/lisp/language/burmese.el index d689e87d785..373f25ac5ca 100644 --- a/lisp/language/burmese.el +++ b/lisp/language/burmese.el @@ -51,7 +51,7 @@ regexp t t)))) regexp)) -(let ((elt (list (vector burmese-composable-pattern 0 'font-shape-gstring) - (vector "." 0 'font-shape-gstring)))) +(let ((elt (list (vector burmese-composable-pattern 0 #'font-shape-gstring) + (vector "." 0 #'font-shape-gstring)))) (set-char-table-range composition-function-table '(#x1000 . #x107F) elt) (set-char-table-range composition-function-table '(#xAA60 . #xAA7B) elt)) diff --git a/lisp/language/cham.el b/lisp/language/cham.el index aa820dc649c..3aac986b437 100644 --- a/lisp/language/cham.el +++ b/lisp/language/cham.el @@ -29,7 +29,7 @@ (set-char-table-range composition-function-table '(#xAA00 . #xAA5F) - (list (vector "[\xAA00-\xAA5F]+" 0 'font-shape-gstring))) + (list (vector "[\xAA00-\xAA5F]+" 0 #'font-shape-gstring))) (set-language-info-alist "Cham" '((charset unicode) diff --git a/lisp/language/china-util.el b/lisp/language/china-util.el index 4bc2eaa2cdd..105e7a735fd 100644 --- a/lisp/language/china-util.el +++ b/lisp/language/china-util.el @@ -1,4 +1,4 @@ -;;; china-util.el --- utilities for Chinese -*- coding: utf-8 -*- +;;; china-util.el --- utilities for Chinese -*- lexical-binding: t; -*- ;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/language/cyril-util.el b/lisp/language/cyril-util.el index 72ceffdf0d6..04e681d743d 100644 --- a/lisp/language/cyril-util.el +++ b/lisp/language/cyril-util.el @@ -1,4 +1,4 @@ -;;; cyril-util.el --- utilities for Cyrillic scripts +;;; cyril-util.el --- utilities for Cyrillic scripts -*- lexical-binding: t; -*- ;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc. diff --git a/lisp/language/ethio-util.el b/lisp/language/ethio-util.el index 174b9ecfda2..9b5fdf24d2b 100644 --- a/lisp/language/ethio-util.el +++ b/lisp/language/ethio-util.el @@ -1,4 +1,4 @@ -;;; ethio-util.el --- utilities for Ethiopic -*- coding: utf-8-emacs; -*- +;;; ethio-util.el --- utilities for Ethiopic -*- coding: utf-8-emacs; lexical-binding: t; -*- ;; Copyright (C) 1997-1998, 2002-2021 Free Software Foundation, Inc. ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -832,11 +832,12 @@ The 2nd and 3rd arguments BEGIN and END specify the region." (set-buffer-modified-p nil))) ;;;###autoload -(defun ethio-tex-to-fidel-buffer nil +(defun ethio-tex-to-fidel-buffer () "Convert fidel-tex commands in the current buffer into fidel chars." (interactive) - (let ((buffer-read-only nil) - (p) (ch)) + (let ((inhibit-read-only t) + ;; (p) (ch) + ) ;; TeX macros to Ethiopic characters (robin-convert-region (point-min) (point-max) "ethiopic-tex") @@ -1018,7 +1019,7 @@ With ARG, insert that many delimiters." ;; ;;;###autoload -(defun ethio-composition-function (pos to font-object string _direction) +(defun ethio-composition-function (pos _to _font-object string _direction) (setq pos (1- pos)) (let ((pattern "\\ce\\(፟\\|\\)")) (if string diff --git a/lisp/language/ethiopic.el b/lisp/language/ethiopic.el index 8573f6177df..209dcd51c90 100644 --- a/lisp/language/ethiopic.el +++ b/lisp/language/ethiopic.el @@ -79,8 +79,8 @@ ))) ;; For automatic composition -(aset composition-function-table ? 'ethio-composition-function) -(aset composition-function-table ?፟ 'ethio-composition-function) +(aset composition-function-table ? #'ethio-composition-function) +(aset composition-function-table ?፟ #'ethio-composition-function) (provide 'ethiopic) diff --git a/lisp/language/hanja-util.el b/lisp/language/hanja-util.el index 313fc63bebd..9e9213536cb 100644 --- a/lisp/language/hanja-util.el +++ b/lisp/language/hanja-util.el @@ -1,4 +1,4 @@ -;;; hanja-util.el --- Korean Hanja util module -*- coding: utf-8 -*- +;;; hanja-util.el --- Korean Hanja util module -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. diff --git a/lisp/language/hebrew.el b/lisp/language/hebrew.el index 389565669a9..c55d23f72d6 100644 --- a/lisp/language/hebrew.el +++ b/lisp/language/hebrew.el @@ -245,9 +245,9 @@ Bidirectional editing is supported."))) (pattern2 (concat base "\u200D" combining))) (set-char-table-range composition-function-table '(#x591 . #x5C7) - (list (vector pattern2 3 'hebrew-shape-gstring) - (vector pattern2 2 'hebrew-shape-gstring) - (vector pattern1 1 'hebrew-shape-gstring) + (list (vector pattern2 3 #'hebrew-shape-gstring) + (vector pattern2 2 #'hebrew-shape-gstring) + (vector pattern1 1 #'hebrew-shape-gstring) [nil 0 hebrew-shape-gstring])) ;; Exclude non-combining characters. (set-char-table-range diff --git a/lisp/language/ind-util.el b/lisp/language/ind-util.el index 4bd1cd76a6d..8d4b2a826e6 100644 --- a/lisp/language/ind-util.el +++ b/lisp/language/ind-util.el @@ -1,4 +1,4 @@ -;;; ind-util.el --- Transliteration and Misc. Tools for Indian Languages -*- coding: utf-8-emacs; -*- +;;; ind-util.el --- Transliteration and Misc. Tools for Indian Languages -*- coding: utf-8-emacs; lexical-binding: t; -*- ;; Copyright (C) 2001-2021 Free Software Foundation, Inc. @@ -40,7 +40,7 @@ (defun indian-regexp-of-hashtbl-keys (hashtbl) "Return the regular expression of hash table keys." (let (keys) - (maphash (lambda (key val) (push key keys)) hashtbl) + (maphash (lambda (key _val) (push key keys)) hashtbl) (regexp-opt keys))) (defvar indian-dev-base-table @@ -565,7 +565,7 @@ (let ((regexp ,(indian-regexp-of-hashtbl-keys (if encode-p (car (eval hashtable)) (cdr (eval hashtable)))))) - (narrow-to-region from to) + (narrow-to-region ,from ,to) (goto-char (point-min)) (while (re-search-forward regexp nil t) (let ((matchstr (gethash (match-string 0) @@ -613,7 +613,7 @@ ;; The followings provide conversion between IS 13194 (ISCII) and UCS. -(let +(dlet ;;Unicode vs IS13194 ;; only Devanagari is supported now. ((ucs-devanagari-to-is13194-alist '((?\x0900 . "[U+0900]") @@ -820,11 +820,11 @@ Returns new end position." (save-restriction (narrow-to-region from to) (goto-char (point-min)) - (let* ((current-repertory is13194-default-repertory)) + ;; (let* ((current-repertory is13194-default-repertory)) (while (re-search-forward indian-ucs-to-is13194-regexp nil t) (replace-match (get-char-code-property (string-to-char (match-string 0)) - 'iscii)))) + 'iscii)));; ) (point-max)))) (defun indian-iscii-to-ucs-region (from to) @@ -1246,7 +1246,7 @@ Returns new end position." (interactive "r") (save-excursion (save-restriction - (let ((pos from) + (let (;; (pos from) (alist (char-table-extra-slot indian-2-column-to-ucs-chartable 0))) (narrow-to-region from to) (decompose-region from to) diff --git a/lisp/language/indian.el b/lisp/language/indian.el index 5ff57966c12..6f9d2703849 100644 --- a/lisp/language/indian.el +++ b/lisp/language/indian.el @@ -381,7 +381,7 @@ South Indian language Malayalam is supported in this language environment.")) (if slot (set-char-table-range composition-function-table key - (list (vector (cdr slot) 0 'font-shape-gstring)))))) + (list (vector (cdr slot) 0 #'font-shape-gstring)))))) char-script-table)) (provide 'indian) diff --git a/lisp/language/japan-util.el b/lisp/language/japan-util.el index 9dce17c4967..948bfef9f22 100644 --- a/lisp/language/japan-util.el +++ b/lisp/language/japan-util.el @@ -1,4 +1,4 @@ -;;; japan-util.el --- utilities for Japanese +;;; japan-util.el --- utilities for Japanese -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -236,7 +236,7 @@ of which charset is `japanese-jisx0201-kana'." (composition (and (not hankaku) (get-char-code-property kana 'kana-composition))) - next slot) + slot) ;; next (if (and composition (setq slot (assq (following-char) composition))) (japanese-replace-region (match-beginning 0) (1+ (point)) (cdr slot)) @@ -258,7 +258,7 @@ of which charset is `japanese-jisx0201-kana'." (while (re-search-forward "\\cK\\|\\ck" nil t) (let* ((kata (preceding-char)) (composition (get-char-code-property kata 'kana-composition)) - next slot) + slot) ;; next (if (and composition (setq slot (assq (following-char) composition))) (japanese-replace-region (match-beginning 0) (1+ (point)) (get-char-code-property @@ -305,7 +305,7 @@ Optional argument KATAKANA-ONLY non-nil means to convert only KATAKANA char." (re-search-forward "\\ca\\|\\ck" nil t))) (let* ((hankaku (preceding-char)) (composition (get-char-code-property hankaku 'kana-composition)) - next slot) + slot) ;; next (if (and composition (setq slot (assq (following-char) composition))) (japanese-replace-region (match-beginning 0) (1+ (point)) (cdr slot)) diff --git a/lisp/language/khmer.el b/lisp/language/khmer.el index 37173c9fb95..6f08e60d601 100644 --- a/lisp/language/khmer.el +++ b/lisp/language/khmer.el @@ -31,7 +31,7 @@ (documentation . t))) (let ((val (list (vector "[\x1780-\x17FF\x19E0-\x19FF\x200C\x200D]+" - 0 'font-shape-gstring)))) + 0 #'font-shape-gstring)))) (set-char-table-range composition-function-table '(#x1780 . #x17FF) val) (set-char-table-range composition-function-table '(#x19E0 . #x19FF) val)) diff --git a/lisp/language/korea-util.el b/lisp/language/korea-util.el index eb7b85bce81..c99ff3c3f2d 100644 --- a/lisp/language/korea-util.el +++ b/lisp/language/korea-util.el @@ -1,4 +1,4 @@ -;;; korea-util.el --- utilities for Korean +;;; korea-util.el --- utilities for Korean -*- lexical-binding: t; -*- ;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -45,7 +45,7 @@ (activate-input-method (concat "korean-hangul" default-korean-keyboard)))) -(defun quail-hangul-switch-symbol-ksc (&rest ignore) +(defun quail-hangul-switch-symbol-ksc (&rest _ignore) "Switch to/from Korean symbol package." (interactive "i") (and current-input-method @@ -54,7 +54,7 @@ default-korean-keyboard)) (activate-input-method "korean-symbol")))) -(defun quail-hangul-switch-hanja (&rest ignore) +(defun quail-hangul-switch-hanja (&rest _ignore) "Switch to/from Korean hanja package." (interactive "i") (and current-input-method diff --git a/lisp/language/korean.el b/lisp/language/korean.el index 22b33a440ef..bdf8240de96 100644 --- a/lisp/language/korean.el +++ b/lisp/language/korean.el @@ -92,10 +92,10 @@ and the following key bindings are available within Korean input methods: (pattern (concat choseong jungseong jongseong))) (set-char-table-range composition-function-table '(#x1100 . #x115F) - (list (vector pattern 0 'font-shape-gstring))) + (list (vector pattern 0 #'font-shape-gstring))) (set-char-table-range composition-function-table '(#xA960 . #xA97C) - (list (vector pattern 0 'font-shape-gstring)))) + (list (vector pattern 0 #'font-shape-gstring)))) (provide 'korean) diff --git a/lisp/language/lao-util.el b/lisp/language/lao-util.el index 59c9850b1a1..c8c3fe4f7e6 100644 --- a/lisp/language/lao-util.el +++ b/lisp/language/lao-util.el @@ -1,4 +1,4 @@ -;;; lao-util.el --- utilities for Lao -*- coding: utf-8; -*- +;;; lao-util.el --- utilities for Lao -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -498,10 +498,10 @@ syllable. In that case, FROM and TO are indexes to STR." (compose-gstring-for-graphic gstring direction) (or (font-shape-gstring gstring direction) (let ((glyph-len (lgstring-glyph-len gstring)) - (i 0) - glyph) + (i 0)) ;; glyph (while (and (< i glyph-len) - (setq glyph (lgstring-glyph gstring i))) + ;; (setq glyph + (lgstring-glyph gstring i)) ;;) (setq i (1+ i))) (compose-glyph-string-relative gstring 0 i 0.1))))) diff --git a/lisp/language/lao.el b/lisp/language/lao.el index 5252f1e60ea..c699d57c15a 100644 --- a/lisp/language/lao.el +++ b/lisp/language/lao.el @@ -66,7 +66,7 @@ (t (string c)))) (cdr l) "")) ;; Element of composition-function-table. - (elt (list (vector regexp 1 'lao-composition-function) + (elt (list (vector regexp 1 #'lao-composition-function) fallback-rule)) ch) (dotimes (i len) diff --git a/lisp/language/misc-lang.el b/lisp/language/misc-lang.el index 0a274f144c2..a2ca678b2be 100644 --- a/lisp/language/misc-lang.el +++ b/lisp/language/misc-lang.el @@ -137,9 +137,9 @@ thin (i.e. 1-dot width) space." composition-function-table '(#x600 . #x74F) (list (vector "[\u200C\u200D][\u0600-\u074F\u200C\u200D]+" - 1 'arabic-shape-gstring) + 1 #'arabic-shape-gstring) (vector "[\u0600-\u074F\u200C\u200D]+" - 0 'arabic-shape-gstring))) + 0 #'arabic-shape-gstring))) ;; The Egyptian Hieroglyph Format Controls were introduced in Unicode ;; Standard v12.0. Apparently, they are not yet well supported in @@ -186,13 +186,13 @@ thin (i.e. 1-dot width) space." ;; doesn't support these controls, the glyphs are ;; displayed individually, and not as a single ;; grapheme cluster. - 1 'font-shape-gstring))) + 1 #'font-shape-gstring))) ;; Grouping controls (set-char-table-range composition-function-table #x13437 (list (vector "\U00013437[\U00013000-\U0001343F]+" - 0 'egyptian-shape-grouping)))) + 0 #'egyptian-shape-grouping)))) (provide 'misc-lang) diff --git a/lisp/language/sinhala.el b/lisp/language/sinhala.el index 90fc41c1c41..99a104ec339 100644 --- a/lisp/language/sinhala.el +++ b/lisp/language/sinhala.el @@ -43,6 +43,6 @@ "[\u0D85-\u0D96][\u0D82-\u0D83]?\\|" ;; any other singleton characters "[\u0D80-\u0DFF]") - 0 'font-shape-gstring))) + 0 #'font-shape-gstring))) ;; sinhala.el ends here diff --git a/lisp/language/tai-viet.el b/lisp/language/tai-viet.el index 17abf136f7f..4549b111a3d 100644 --- a/lisp/language/tai-viet.el +++ b/lisp/language/tai-viet.el @@ -30,7 +30,7 @@ (set-char-table-range composition-function-table '(#xAA80 . #xAADF) - 'tai-viet-composition-function) + #'tai-viet-composition-function) (set-language-info-alist "TaiViet" '((charset unicode) diff --git a/lisp/language/thai-util.el b/lisp/language/thai-util.el index f9c57e8ca83..e11a05445c7 100644 --- a/lisp/language/thai-util.el +++ b/lisp/language/thai-util.el @@ -1,4 +1,4 @@ -;;; thai-util.el --- utilities for Thai -*- coding: utf-8; -*- +;;; thai-util.el --- utilities for Thai -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -232,10 +232,10 @@ positions (integers or markers) specifying the region." (let ((glyph-len (lgstring-glyph-len gstring)) (last-char (lgstring-char gstring (1- (lgstring-char-len gstring)))) - (i 0) - glyph) + (i 0)) ;; glyph (while (and (< i glyph-len) - (setq glyph (lgstring-glyph gstring i))) + ;; (setq glyph + (lgstring-glyph gstring i)) ;; ) (setq i (1+ i))) (if (= last-char ?ำ) (setq i (1- i))) diff --git a/lisp/language/thai-word.el b/lisp/language/thai-word.el index 94c6ab98979..ff1e80298ba 100644 --- a/lisp/language/thai-word.el +++ b/lisp/language/thai-word.el @@ -1,4 +1,4 @@ -;;; thai-word.el -- find Thai word boundaries +;;; thai-word.el -- find Thai word boundaries -*- lexical-binding: t; -*- ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 ;; National Institute of Advanced Industrial Science and Technology (AIST) @@ -10973,8 +10973,7 @@ If COUNT is negative, move point backward (- COUNT) words." ;; special instead of using forward-word. (let ((start (point)) (limit (match-end 0)) - boundaries - tail) + boundaries) ;; tail ;; If thai-forward-word has been called within a Thai ;; region, we must go back until the Thai region starts ;; to do the contextual analysis for finding word diff --git a/lisp/language/tibet-util.el b/lisp/language/tibet-util.el index e741af18740..ddf4a0c0fb1 100644 --- a/lisp/language/tibet-util.el +++ b/lisp/language/tibet-util.el @@ -1,4 +1,4 @@ -;;; tibet-util.el --- utilities for Tibetan -*- coding: utf-8-emacs; -*- +;;; tibet-util.el --- utilities for Tibetan -*- coding: utf-8-emacs; lexical-binding: t; -*- ;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -126,42 +126,42 @@ The returned string has no composition information." (setq t-str-list (cons (substring str idx) t-str-list))) (apply 'concat (nreverse t-str-list)))) -;;; +;; ;;; Functions for composing/decomposing Tibetan sequence. -;;; -;;; A Tibetan syllable is typically structured as follows: -;;; -;;; [Prefix] C [C+] V [M] [Suffix [Post suffix]] -;;; -;;; where C's are all vertically stacked, V appears below or above -;;; consonant cluster and M is always put above the C[C+]V combination. -;;; (Sanskrit visarga, though it is a vowel modifier, is considered -;;; to be a punctuation.) -;;; -;;; Here are examples of the words "bsgrubs" and "hfauM" -;;; -;;; བསྒྲུབས ཧཱུཾ -;;; -;;; M -;;; b s b s h -;;; g fa -;;; r u -;;; u -;;; -;;; Consonants `'' (འ), `w' (ཝ), `y' (ཡ), `r' (ར) take special -;;; forms when they are used as subjoined consonant. Consonant `r' -;;; takes another special form when used as superjoined in such a case -;;; as "rka", while it does not change its form when conjoined with -;;; subjoined `'', `w' or `y' as in "rwa", "rya". +;; +;; A Tibetan syllable is typically structured as follows: +;; +;; [Prefix] C [C+] V [M] [Suffix [Post suffix]] +;; +;; where C's are all vertically stacked, V appears below or above +;; consonant cluster and M is always put above the C[C+]V combination. +;; (Sanskrit visarga, though it is a vowel modifier, is considered +;; to be a punctuation.) +;; +;; Here are examples of the words "bsgrubs" and "hfauM" +;; +;; བསྒྲུབས ཧཱུཾ +;; +;; M +;; b s b s h +;; g fa +;; r u +;; u +;; +;; Consonants `'' (འ), `w' (ཝ), `y' (ཡ), `r' (ར) take special +;; forms when they are used as subjoined consonant. Consonant `r' +;; takes another special form when used as superjoined in such a case +;; as "rka", while it does not change its form when conjoined with +;; subjoined `'', `w' or `y' as in "rwa", "rya". -;; Append a proper composition rule and glyph to COMPONENTS to compose -;; CHAR with a composition that has COMPONENTS. +; Append a proper composition rule and glyph to COMPONENTS to compose +; CHAR with a composition that has COMPONENTS. (defun tibetan-add-components (components char) (let ((last (last components)) (stack-upper '(tc . bc)) (stack-under '(bc . tc)) - rule comp-vowel tmp) + rule comp-vowel) ;; Special treatment for 'a chung. ;; If 'a follows a consonant, turn it into the subjoined form. ;; * Disabled by Tomabechi 2000/06/09 * @@ -246,7 +246,7 @@ The returned string has no composition information." (defun tibetan-compose-region (beg end) "Compose Tibetan text the region BEG and END." (interactive "r") - (let (str result chars) + ;; (let (str result chars) (save-excursion (save-restriction (narrow-to-region beg end) @@ -272,7 +272,7 @@ The returned string has no composition information." (while (< (point) to) (tibetan-add-components components (following-char)) (forward-char 1)) - (compose-region from to components))))))) + (compose-region from to components)))))) ;; ) (defvar tibetan-decompose-precomposition-alist (mapcar (lambda (x) (cons (string-to-char (cdr x)) (car x))) diff --git a/lisp/language/tibetan.el b/lisp/language/tibetan.el index edd9d765b1e..48c7638948c 100644 --- a/lisp/language/tibetan.el +++ b/lisp/language/tibetan.el @@ -605,7 +605,7 @@ This also matches some punctuation characters which need conversion.") ;; For automatic composition. (set-char-table-range composition-function-table '(#xF00 . #xFD1) - (list (vector tibetan-composable-pattern 0 'font-shape-gstring))) + (list (vector tibetan-composable-pattern 0 #'font-shape-gstring))) (provide 'tibetan) diff --git a/lisp/language/tv-util.el b/lisp/language/tv-util.el index 7ce8ee1e500..1a530d350f2 100644 --- a/lisp/language/tv-util.el +++ b/lisp/language/tv-util.el @@ -1,4 +1,4 @@ -;;; tv-util.el --- support for Tai Viet -*- coding: utf-8 -*- +;;; tv-util.el --- support for Tai Viet -*- lexical-binding: t; -*- ;; Copyright (C) 2007, 2008, 2009, 2010, 2011 ;; National Institute of Advanced Industrial Science and Technology (AIST) @@ -128,7 +128,7 @@ ;;;###autoload -(defun tai-viet-composition-function (from to font-object string _direction) +(defun tai-viet-composition-function (from _to _font-object string _direction) (if string (if (string-match tai-viet-re string from) (tai-viet-compose-string from (match-end 0) string)) diff --git a/lisp/language/viet-util.el b/lisp/language/viet-util.el index 177b04bc473..bfaf0f3b94a 100644 --- a/lisp/language/viet-util.el +++ b/lisp/language/viet-util.el @@ -1,4 +1,4 @@ -;;; viet-util.el --- utilities for Vietnamese -*- coding: utf-8; -*- +;;; viet-util.el --- utilities for Vietnamese -*- lexical-binding: t; -*- ;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, From 89327ce68d096da9539f5032f598870ba97155c7 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 27 Jan 2021 12:25:52 -0500 Subject: [PATCH 037/107] * lisp/international/titdic-cnv.el: Revert to utf-8 encoding While it's true that using the iso-2022-jp encoding on the file does allow Emacs to render the two strings differently, this only applies to the source file. The .elc files all use `utf-8-emacs` encoding anyway, so that info is lost. And the difference is even lost before we write the .elc file because when Emacs byte-compiles that code the byte-compiler considers those two strings as "equal" and emits only one string in the byte-code (so the two branches return `eq` strings). So, I think using `iso-2022-jp` is a bad idea here: it gives the illusion that the the `charset` info exists, even it will be lost. Eli discussed it with Handa-san a year ago, and they arrived at the conclusion that the charset information is indeed no longer important. --- lisp/international/titdic-cnv.el | 234 +++++++++++++++---------------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index 753139e5dd8..84e218f1799 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el @@ -1,4 +1,4 @@ -;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package -*- coding:iso-2022-7bit; lexical-binding:t -*- +;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package -*- coding: utf-8-emacs; lexical-binding:t -*- ;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -83,9 +83,9 @@ ;; how to select a translation from a list of candidates. (defvar quail-cxterm-package-ext-info - '(("chinese-4corner" "$(0(?-F(B") - ("chinese-array30" "$(0#R#O(B") - ("chinese-ccdospy" "$AKuF4(B" + '(("chinese-4corner" "四角") + ("chinese-array30" "30") + ("chinese-ccdospy" "缩拼" "Pinyin base input method for Chinese charset GB2312 (`chinese-gb2312'). Pinyin is the standard Roman transliteration method for Chinese. @@ -94,10 +94,10 @@ method `chinese-py'. This input method works almost the same way as `chinese-py'. The difference is that you type a single key for these Pinyin spelling. - Pinyin: zh en eng ang ch an ao ai ong sh ing yu($A(9(B) + Pinyin: zh en eng ang ch an ao ai ong sh ing yu(ü) keyseq: a f g h i j k l s u y v For example: - Chinese: $A0!(B $A9{(B $AVP(B $AND(B $A9b(B $ASq(B $AH+(B + Chinese: 啊 果 中 文 光 玉 全 Pinyin: a guo zhong wen guang yu quan Keyseq: a1 guo4 as1 wf4 guh1 yu..6 qvj6 @@ -106,14 +106,14 @@ For example: For double-width GB2312 characters corresponding to ASCII, use the input method `chinese-qj'.") - ("chinese-ecdict" "$(05CKH(B" + ("chinese-ecdict" "英漢" "In this input method, you enter a Chinese (Big5) character or word by typing the corresponding English word. For example, if you type -\"computer\", \"$(0IZH+(B\" is input. +\"computer\", \"電腦\" is input. \\") - ("chinese-etzy" "$(06/0D(B" + ("chinese-etzy" "倚注" "Zhuyin base input method for Chinese Big5 characters (`chinese-big5-1', `chinese-big5-2'). @@ -122,20 +122,20 @@ compose one Chinese character. In this input method, you enter a Chinese character by first typing keys corresponding to Zhuyin symbols (see the above table) followed by -SPC, 1, 2, 3, or 4 specifying a tone (SPC:$(0?v(N(B, 1:$(0M=Vy(B, 2:$(0Dm(N(B, 3: $(0&9Vy(B, -4:$(0(+Vy(B). +SPC, 1, 2, 3, or 4 specifying a tone (SPC:陰平, 1:輕聲, 2:陽平, 3: 上聲, +4:去聲). \\") - ("chinese-punct-b5" "$(0O:(BB" + ("chinese-punct-b5" "標B" "Input method for Chinese punctuation and symbols of Big5 \(`chinese-big5-1' and `chinese-big5-2').") - ("chinese-punct" "$A1j(BG" + ("chinese-punct" "标G" "Input method for Chinese punctuation and symbols of GB2312 \(`chinese-gb2312').") - ("chinese-py-b5" "$(03<(BB" + ("chinese-py-b5" "拼B" "Pinyin base input method for Chinese Big5 characters \(`chinese-big5-1', `chinese-big5-2'). @@ -153,28 +153,28 @@ method `chinese-qj-b5'. The input method `chinese-py' and `chinese-tonepy' are also Pinyin based, but for the character set GB2312 (`chinese-gb2312').") - ("chinese-qj-b5" "$(0)A(BB") + ("chinese-qj-b5" "全B") - ("chinese-qj" "$AH+(BG") + ("chinese-qj" "全G") - ("chinese-sw" "$AJWN2(B" + ("chinese-sw" "首尾" "Radical base input method for Chinese charset GB2312 (`chinese-gb2312'). In this input method, you enter a Chinese character by typing two -keys. The first key corresponds to the first ($AJW(B) radical, the second -key corresponds to the last ($AN2(B) radical. The correspondence of keys +keys. The first key corresponds to the first (首) radical, the second +key corresponds to the last (尾) radical. The correspondence of keys and radicals is as below: first radical: a b c d e f g h i j k l m n o p q r s t u v w x y z - $APD(B $AZ"(B $AJ,(B $AX<(B $A;p(B $A?Z(B $A^P(B $Ac_(B $AZ%(B $A\3(B $AXi(B $AD>(B $Alj(B $Ab;(B $ATB(B $Afy(B $AJ/(B $AMu(B $A0K(B $AX/(B $AHU(B $AeA(B $Aak(B $AVq(B $AR;(B $AHK(B + 心 冖 尸 丶 火 口 扌 氵 讠 艹 亻 木 礻 饣 月 纟 石 王 八 丿 日 辶 犭 竹 一 人 last radical: a b c d e f g h i j k l m n o p q r s t u v w x y z - $ASV(B $AI=(B $AMA(B $A56(B $AZb(B $A?Z(B $ARB(B $Aqb(B $A4s(B $A6!(B $A[L(B $Ala(B $AJ.(B $A4u(B $AXg(B $ACE(B $A=q(B $AX-(B $AE.(B $ARR(B $A`m(B $AP!(B $A3'(B $A3f(B $A_.(B $A27(B + 又 山 土 刀 阝 口 衣 疋 大 丁 厶 灬 十 歹 冂 门 今 丨 女 乙 囗 小 厂 虫 弋 卜 \\") - ("chinese-tonepy" "$A5wF4(B" + ("chinese-tonepy" "调拼" "Pinyin base input method for Chinese charset GB2312 (`chinese-gb2312'). Pinyin is the standard roman transliteration method for Chinese. @@ -183,18 +183,18 @@ method `chinese-py'. This input method works almost the same way as `chinese-py'. The difference is that you must type 1..5 after each Pinyin spelling to -specify a tone (1:$ARuF=(B, 2:$AQtF=(B, 3:$AIOIy(B, 4$AOBIy(B, 5:$AGaIy(B). +specify a tone (1:阴平, 2:阳平, 3:上声, 4下声, 5:轻声). \\ -For instance, to input $ADc(B, you type \"n i 3 3\", the first \"n i\" is +For instance, to input 你, you type \"n i 3 3\", the first \"n i\" is a Pinyin, the next \"3\" specifies tone, and the last \"3\" selects the third character from the candidate list. For double-width GB2312 characters corresponding to ASCII, use the input method `chinese-qj'.") - ("chinese-zozy" "$(0I\0D(B" + ("chinese-zozy" "零注" "Zhuyin base input method for Chinese Big5 characters (`chinese-big5-1', `chinese-big5-2'). @@ -203,8 +203,8 @@ compose a Chinese character. In this input method, you enter a Chinese character by first typing keys corresponding to Zhuyin symbols (see the above table) followed by -SPC, 6, 3, 4, or 7 specifying a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 3:$(0&9Vy(B, 4:$(0(+Vy(B, -7:$(0M=Vy(B). +SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲, +7:輕聲). \\"))) @@ -354,7 +354,7 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 3:$(0&9Vy (princ (nth 2 (assoc tit-encode tit-encode-list))) (princ "\" \"") (princ (or title - (if (string-match "[:$A!K$(0!(!J(B]+\\([^:$A!K$(0!(!K(B]+\\)" tit-prompt) + (if (string-match "[:∷:【]+\\([^:∷:】]+\\)" tit-prompt) (substring tit-prompt (match-beginning 1) (match-end 1)) tit-prompt))) (princ "\"\n")) @@ -580,7 +580,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." ;; ) (defvar quail-misc-package-ext-info - '(("chinese-b5-tsangchi" "$(06A(BB" + '(("chinese-b5-tsangchi" "倉B" "cangjie-table.b5" big5 "tsang-b5.el" tsang-b5-converter "\ @@ -590,7 +590,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." ;; # unmodified versions is granted without royalty provided ;; # this notice is preserved.") - ("chinese-b5-quick" "$(0X|(BB" + ("chinese-b5-quick" "簡B" "cangjie-table.b5" big5 "quick-b5.el" quick-b5-converter "\ @@ -600,7 +600,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." ;; # unmodified versions is granted without royalty provided ;; # this notice is preserved.") - ("chinese-cns-tsangchi" "$(GT?(BC" + ("chinese-cns-tsangchi" "倉C" "cangjie-table.cns" iso-2022-cn-ext "tsang-cns.el" tsang-cns-converter "\ @@ -610,7 +610,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." ;; # unmodified versions is granted without royalty provided ;; # this notice is preserved.") - ("chinese-cns-quick" "$(Gv|(BC" + ("chinese-cns-quick" "簡C" "cangjie-table.cns" iso-2022-cn-ext "quick-cns.el" quick-cns-converter "\ @@ -620,7 +620,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." ;; # unmodified versions is granted without royalty provided ;; # this notice is preserved.") - ("chinese-py" "$AF4(BG" + ("chinese-py" "拼G" "pinyin.map" cn-gb-2312 "PY.el" py-converter "\ @@ -648,7 +648,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." ;; You should have received a copy of the GNU General Public License along with ;; CCE. If not, see .") - ("chinese-ziranma" "$AWTH;(B" + ("chinese-ziranma" "自然" "ziranma.cin" cn-gb-2312 "ZIRANMA.el" ziranma-converter "\ @@ -676,7 +676,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." ;; You should have received a copy of the GNU General Public License along with ;; CCE. If not, see .") - ("chinese-ctlau" "$AAuTA(B" + ("chinese-ctlau" "刘粤" "CTLau.html" cn-gb-2312 "CTLau.el" ctlau-gb-converter "\ @@ -701,7 +701,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." ;; # You should have received a copy of the GNU General Public License ;; # along with this program. If not, see .") - ("chinese-ctlaub" "$(0N,Gn(B" + ("chinese-ctlaub" "劉粵" "CTLau-b5.html" big5 "CTLau-b5.el" ctlau-b5-converter "\ @@ -731,38 +731,38 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." ;; dictionary in the buffer DICBUF. The input method name of the ;; Quail package is NAME, and the title string is TITLE. -;; TSANG-P is non-nil, generate $(06AQo(B input method. Otherwise -;; generate $(0X|/y(B (simple version of $(06AQo(B). If BIG5-P is non-nil, the +;; TSANG-P is non-nil, generate 倉頡 input method. Otherwise +;; generate 簡易 (simple version of 倉頡). If BIG5-P is non-nil, the ;; input method is for inputting Big5 characters. Otherwise the input ;; method is for inputting CNS characters. (defun tsang-quick-converter (dicbuf tsang-p big5-p) - (let ((fulltitle (if tsang-p (if big5-p "$(06AQo(B" "$(GT?on(B") - (if big5-p "$(0X|/y(B" "$(Gv|Mx(B"))) + (let ((fulltitle (if tsang-p (if big5-p "倉頡" "倉頡") + (if big5-p "簡易" "簡易"))) dic) (goto-char (point-max)) (if big5-p - (insert (format "\"$(0&d'GTT&,!J(B%s$(0!K(BBIG5 + (insert (format "\"中文輸入【%s】BIG5 - $(0KHM$(B%s$(0TT&,WoOu(B + 漢語%s輸入鍵盤 - [Q $(0'D(B] [W $(0(q(B] [E $(0'V(B] [R $(0&H(B] [T $(0'>(B] [Y $(0&4(B] [U $(0&U(B] [I $(0'B(B] [O $(0&*(B] [P $(0'A(B] + [Q 手] [W 田] [E 水] [R 口] [T 廿] [Y 卜] [U 山] [I 戈] [O 人] [P 心] - [A $(0'K(B] [S $(0&T(B] [D $(0'N(B] [F $(0'W(B] [G $(0&I(B] [H $(0*M(B] [J $(0&3(B] [L $(0&d(B] + [A 日] [S 尸] [D 木] [F 火] [G 土] [H 竹] [J 十] [L 中] - [Z ] [X $(0[E(B] [C $(01[(B] [V $(0&M(B] [B $(0'M(B] [N $(0&_(B] [M $(0&"(B] + [Z ] [X 難] [C 金] [V 女] [B 月] [N 弓] [M 一] \\\\\"\n" fulltitle fulltitle)) - (insert (format "\"$(GDcEFrSD+!J(B%s$(G!K(BCNS + (insert (format "\"中文輸入【%s】CNS - $(GiGk#(B%s$(GrSD+uomu(B + 漢語%s輸入鍵盤 - [Q $(GEC(B] [W $(GFp(B] [E $(GEU(B] [R $(GDG(B] [T $(GE=(B] [Y $(GD3(B] [U $(GDT(B] [I $(GEA(B] [O $(GD)(B] [P $(GE@(B] + [Q 手] [W 田] [E 水] [R 口] [T 廿] [Y 卜] [U 山] [I 戈] [O 人] [P 心] - [A $(GEJ(B] [S $(GDS(B] [D $(GEM(B] [F $(GEV(B] [G $(GDH(B] [H $(GHL(B] [J $(GD2(B] [L $(GDc(B] + [A 日] [S 尸] [D 木] [F 火] [G 土] [H 竹] [J 十] [L 中] - [Z ] [X $(GyE(B] [C $(GOZ(B] [V $(GDL(B] [B $(GEL(B] [N $(GD^(B] [M $(GD!(B] + [Z ] [X 難] [C 金] [V 女] [B 月] [N 弓] [M 一] \\\\\"\n" fulltitle fulltitle))) @@ -798,35 +798,35 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." (setq dic (sort dic (lambda (x y) (string< (car x ) (car y))))) (dolist (elt dic) (insert (format "(%S\t%S)\n" (car elt) (cdr elt)))) - (let ((punctuation '((";" "$(0!'!2!"!#!.!/(B" "$(G!'!2!"!#!.!/(B") - (":" "$(0!(!+!3!%!$!&!0!1(B" "$(G!(!+!3!%!$!&!0!1(B") - ("'" "$(0!e!d(B" "$(G!e!d(B") - ("\"" "$(0!g!f!h!i!q(B" "$(G!g!f!h!i!q(B") - ("\\" "$(0"`"b#M(B" "$(G"`"b#M(B") - ("|" "$(0!6!8!:"^(B" "$(G!6!8!:"^(B") - ("/" "$(0"_"a#L(B" "$(G"_"a#L(B") - ("?" "$(0!)!4(B" "$(G!)!4(B") - ("<" "$(0!R"6"A!T"H(B" "$(G!R"6"A!T"H(B") - (">" "$(0!S"7"B!U(B" "$(G!S"7"B!U(B") - ("[" "$(0!F!J!b!H!L!V!Z!X!\(B" "$(G!F!J!b!H!L!V!Z!X!\(B") - ("]" "$(0!G!K!c!I!M!W![!Y!](B" "$(G!G!K!c!I!M!W![!Y!](B") - ("{" "$(0!B!`!D(B " "$(G!B!`!D(B ") - ("}" "$(0!C!a!E(B" "$(G!C!a!E(B") - ("`" "$(0!j!k(B" "$(G!j!k(B") - ("~" "$(0"D"+",!!^!@(B" "$(G!>!^!@(B") - (")" "$(0!?!_!A(B" "$(G!?!_!A(B") - ("-" "$(0!7!9"#"$"1"@(B" "$(G!7!9"#"$"1"@(B") - ("_" "$(0"%"&(B" "$(G"%"&(B") - ("=" "$(0"8"C(B" "$(G"8"C(B") - ("+" "$(0"0"?(B" "$(G"0"?(B")))) + (let ((punctuation '((";" ";﹔,、﹐﹑" ";﹔,、﹐﹑") + (":" ":︰﹕.。‧﹒·" ":︰﹕.。・﹒·") + ("'" "’‘" "’‘") + ("\"" "”“〝〞〃" "”“〝〞〃") + ("\\" "\﹨╲" "\﹨╲") + ("|" "|︱︳∣" "︱︲|") + ("/" "/∕╱" "/∕╱") + ("?" "?﹖" "?﹖") + ("<" "〈<﹤︿∠" "〈<﹤︿∠") + (">" "〉>﹥﹀" "〉>﹦﹀") + ("[" "〔【﹝︹︻「『﹁﹃" "〔【﹝︹︻「『﹁﹃") + ("]" "〕】﹞︺︼」』﹂﹄" "〕】﹞︺︼」』﹂﹄") + ("{" "{﹛︷ " "{﹛︷ ") + ("}" "}﹜︸" "}﹜︸") + ("`" "‵′" "′‵") + ("~" "~﹋﹌︴﹏" "∼﹋﹌") + ("!" "!﹗" "!﹗") + ("@" "@﹫" "@﹫") + ("#" "#﹟" "#﹟") + ("$" "$﹩" "$﹩") + ("%" "%﹪" "%﹪") + ("&" "&﹠" "&﹠") + ("*" "*﹡※☆★" "*﹡※☆★") + ("(" "(﹙︵" "(﹙︵") + (")" ")﹚︶" ")﹚︶") + ("-" "–—¯ ̄-﹣" "—–‾-﹣") + ("_" "_ˍ" "_") + ("=" "=﹦" "=﹥") + ("+" "+﹢" "+﹢")))) (dolist (elt punctuation) (insert (format "(%S %S)\n" (concat "z" (car elt)) (if big5-p (nth 1 elt) (nth 2 elt)))))) @@ -850,11 +850,11 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." (defun py-converter (dicbuf) (goto-char (point-max)) - (insert (format "%S\n" "$A::WVJdHk!KF4Rt!K(B + (insert (format "%S\n" "汉字输入∷拼音∷ - $AF4Rt7=08(B + 拼音方案 - $AP!P4S"NDWVD84z1m!8F4Rt!97{:E#,(B \"u(yu) $ATrSC(B u: $A1mJ>!C(B + 小写英文字母代表「拼音」符号, \"u(yu) 则用 u: 表示∶ Pinyin base input method for Chinese charset GB2312 (`chinese-gb2312'). @@ -868,14 +868,14 @@ character. The sequence is made by the combination of the initials iang ing iong u ua uo uai ui uan un uan ueng yu yue yuan yun (Note: In the correct Pinyin writing, the sequence \"yu\" in the last - four finals should be written by the character u-umlaut `$A(9(B'.) + four finals should be written by the character u-umlaut `ü'.) With this input method, you enter a Chinese character by first entering its pinyin spelling. \\ -For instance, to input $ADc(B, you type \"n i C-n 3\". The first \"n i\" +For instance, to input 你, you type \"n i C-n 3\". The first \"n i\" is a Pinyin, \"C-n\" selects the next group of candidates (each group contains at most 10 characters), \"3\" select the third character in that group. @@ -958,22 +958,22 @@ method `chinese-tonepy' with which you must specify tones by digits table))) (setq dic (sort dic (lambda (x y) (string< (car x) (car y))))) (goto-char (point-max)) - (insert (format "%S\n" "$A::WVJdHk!K!>WTH;!?!K(B + (insert (format "%S\n" "汉字输入∷【自然】∷ - $A<|EL6TUU1m(B: - $A)3)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)7(B - $A)'#Q(B $A)'#W(B $A)'#E(B $A)'#R(B $A)'#T(B $A)'#Y(B $A)'#U(Bsh$A)'#I(Bch$A)'#O(B $A)'#P(B $A)'(B - $A)'(B iu$A)'(B ua$A)'(B e$A)'(B uan$A)'(B ue$A)'(B uai$A)'(B u$A)'(B i$A)'(B o$A)'(B un$A)'(B - $A)'(B $A)'(B ia$A)'(B $A)'(B van$A)'(B ve$A)'(B ing$A)'(B $A)'(B $A)'(B uo$A)'(B vn$A)'(B - $A);)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)?(B - $A)'#A(B $A)'#S(B $A)'#D(B $A)'#F(B $A)'#G(B $A)'#H(B $A)'#J(B $A)'#K(B $A)'#L(B $A)'(B - $A)'(B a$A)'(Biong$A)'(Buang$A)'(B en$A)'(B eng$A)'(B ang$A)'(B an$A)'(B ao$A)'(B ai$A)'(B - $A)'(B $A)'(B ong$A)'(Biang$A)'(B $A)'(B ng$A)'(B $A)'(B $A)'(B $A)'(B $A)'(B - $A);)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)%)7(B - $A)'#Z(B $A)'#X(B $A)'#C(B $A)'#V(Bzh$A)'#B(B $A)'#N(B $A)'#M(B $A)'#,(B $A)'#.(B $A)'(B $A#/(B $A)'(B - $A)'(B ei$A)'(B ie$A)'(B iao$A)'(B ui$A)'(B ou$A)'(B in$A)'(B ian$A)'G0R3)':sR3)'7{:E)'(B - $A)'(B $A)'(B $A)'(B $A)'(B v$A)'(B $A)'(B $A)'(B $A)'(B $A)'(B $A)'(B $A)'(B - $A);)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)?(B + 键盘对照表: + ┏━━┳━━┳━━┳━━┳━━┳━━┳━━┳━━┳━━┳━━┓ + ┃Q ┃W ┃E ┃R ┃T ┃Y ┃Ush┃Ich┃O ┃P ┃ + ┃ iu┃ ua┃ e┃ uan┃ ue┃ uai┃ u┃ i┃ o┃ un┃ + ┃ ┃ ia┃ ┃ van┃ ve┃ ing┃ ┃ ┃ uo┃ vn┃ + ┗┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┛ + ┃A ┃S ┃D ┃F ┃G ┃H ┃J ┃K ┃L ┃ + ┃ a┃iong┃uang┃ en┃ eng┃ ang┃ an┃ ao┃ ai┃ + ┃ ┃ ong┃iang┃ ┃ ng┃ ┃ ┃ ┃ ┃ + ┗┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━━┓ + ┃Z ┃X ┃C ┃Vzh┃B ┃N ┃M ┃, ┃. ┃ / ┃ + ┃ ei┃ ie┃ iao┃ ui┃ ou┃ in┃ ian┃前页┃后页┃符号┃ + ┃ ┃ ┃ ┃ v┃ ┃ ┃ ┃ ┃ ┃ ┃ + ┗━━┻━━┻━━┻━━┻━━┻━━┻━━┻━━┻━━┻━━┛ Pinyin base input method for Chinese GB2312 characters (`chinese-gb2312'). @@ -985,34 +985,34 @@ method `chinese-py'. Unlike the standard spelling of Pinyin, in this input method all initials and finals are assigned to single keys (see the above table). For instance, the initial \"ch\" is assigned to the key `i', the final -\"iu\" is assigned to the key `q', and tones 1, 2, 3, 4, and $AGaIy(B are +\"iu\" is assigned to the key `q', and tones 1, 2, 3, 4, and 轻声 are assigned to the keys `q', `w', `e', `r', `t' respectively. \\ To input one-letter words, you type 4 keys, the first two for the Pinyin of the letter, next one for tone, and the last one is always a -quote ('). For instance, \"vsq'\" input $AVP(B. Exceptions are these +quote ('). For instance, \"vsq'\" input 中. Exceptions are these letters. You can input them just by typing a single key. - Character: $A04(B $A2;(B $A4N(B $A5D(B $A6~(B $A7"(B $A8v(B $A:M(B $A3v(B $A<0(B $A?I(B $AAK(B $AC;(B + Character: 按 不 次 的 二 发 个 和 出 及 可 了 没 Key: a b c d e f g h i j k l m - Character: $ADc(B $AE7(B $AF,(B $AF_(B $AHK(B $AH}(B $AK{(B $AJG(B $AWE(B $ANR(B $AP!(B $AR;(B $ATZ(B + Character: 你 欧 片 七 人 三 他 是 着 我 小 一 在 Key: n o p q r s t u v w x y z To input two-letter words, you have two ways. One way is to type 4 keys, two for the first Pinyin, two for the second Pinyin. For -instance, \"vsgo\" inputs $AVP9z(B. Another way is to type 3 keys: 2 +instance, \"vsgo\" inputs 中国. Another way is to type 3 keys: 2 initials of two letters, and quote ('). For instance, \"vg'\" also -inputs $AVP9z(B. +inputs 中国. To input three-letter words, you type 4 keys: initials of three -letters, and the last is quote ('). For instance, \"bjy'2\" inputs $A11(B -$A>)Q<(B (the last `2' is to select one of the candidates). +letters, and the last is quote ('). For instance, \"bjy'2\" inputs 北 +京鸭 (the last `2' is to select one of the candidates). To input words of more than three letters, you type 4 keys, initials of the first three letters and the last letter. For instance, -\"bjdt\" inputs $A11>)5gJSL((B. +\"bjdt\" inputs 北京电视台. To input symbols and punctuation, type `/' followed by one of `a' to `z', then select one of the candidates.")) @@ -1059,7 +1059,7 @@ To input symbols and punctuation, type `/' followed by one of `a' to ;; which the file is converted have no Big5 equivalent. Go ;; through and delete them. (goto-char pos) - (while (search-forward "$(0!{(B" nil t) + (while (search-forward "□" nil t) (delete-char -1)) ;; Uppercase keys in dictionary need to be downcased. Backslashes ;; at the beginning of keys need to be turned into double @@ -1083,31 +1083,31 @@ To input symbols and punctuation, type `/' followed by one of `a' to (defun ctlau-gb-converter (dicbuf) (ctlau-converter dicbuf -"$A::WVJdHk!KAuN}OiJ=TARt!K(B +"汉字输入∷刘锡祥式粤音∷ - $AAuN}OiJ=TASoW"Rt7=08(B + 刘锡祥式粤语注音方案 Sidney Lau's Cantonese transcription scheme as described in his book \"Elementary Cantonese\", The Government Printer, Hong Kong, 1972. - This file was prepared by Fung Fung Lee ($A@n7c7e(B). + This file was prepared by Fung Fung Lee (李枫峰). Originally converted from CTCPS3.tit Last modified: June 2, 1993. Some infrequent GB characters are accessed by typing \\, followed by - the Cantonese romanization of the respective radical ($A2?JW(B).")) + the Cantonese romanization of the respective radical (部首).")) (defun ctlau-b5-converter (dicbuf) (ctlau-converter dicbuf -"$(0KH)tTT&,!(N,Tg>A*#Gn5x!((B +"漢字輸入:劉錫祥式粵音: - $(0N,Tg>A*#GnM$0D5x'J7{(B + 劉錫祥式粵語注音方案 Sidney Lau's Cantonese transcription scheme as described in his book \"Elementary Cantonese\", The Government Printer, Hong Kong, 1972. - This file was prepared by Fung Fung Lee ($(0,XFS76(B). + This file was prepared by Fung Fung Lee (李楓峰). Originally converted from CTCPS3.tit Last modified: June 2, 1993. Some infrequent characters are accessed by typing \\, followed by - the Cantonese romanization of the respective radical ($(0?f5}(B).")) + the Cantonese romanization of the respective radical (部首).")) (declare-function dos-8+3-filename "dos-fns.el" (filename)) From 2d8daac122e71dd5ee69a991c9c1dd0d31c2433f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 27 Jan 2021 12:35:19 -0500 Subject: [PATCH 038/107] * lisp/international/titdic-cnv.el (tsang-quick-converter): Simplify Merge branches which only differed in the `charset` property of the strings they intended to return, since that info gets lost later on anyway. --- lisp/international/titdic-cnv.el | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index 84e218f1799..ce5c04293ad 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el @@ -375,7 +375,7 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲, ;; Arg DOCSTRING (let ((doc (concat tit-prompt "\n")) (comments (if tit-comments - (mapconcat 'identity (nreverse tit-comments) "\n"))) + (mapconcat #'identity (nreverse tit-comments) "\n"))) (doc-ext (nth 2 (assoc package quail-cxterm-package-ext-info)))) (if comments (setq doc (concat doc "\n" comments "\n"))) @@ -737,12 +737,10 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." ;; method is for inputting CNS characters. (defun tsang-quick-converter (dicbuf tsang-p big5-p) - (let ((fulltitle (if tsang-p (if big5-p "倉頡" "倉頡") - (if big5-p "簡易" "簡易"))) + (let ((fulltitle (if tsang-p "倉頡" "簡易")) dic) (goto-char (point-max)) - (if big5-p - (insert (format "\"中文輸入【%s】BIG5 + (insert (format "\"中文輸入【%s】%s 漢語%s輸入鍵盤 @@ -753,19 +751,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." [Z ] [X 難] [C 金] [V 女] [B 月] [N 弓] [M 一] \\\\\"\n" - fulltitle fulltitle)) - (insert (format "\"中文輸入【%s】CNS - - 漢語%s輸入鍵盤 - - [Q 手] [W 田] [E 水] [R 口] [T 廿] [Y 卜] [U 山] [I 戈] [O 人] [P 心] - - [A 日] [S 尸] [D 木] [F 火] [G 土] [H 竹] [J 十] [L 中] - - [Z ] [X 難] [C 金] [V 女] [B 月] [N 弓] [M 一] - -\\\\\"\n" - fulltitle fulltitle))) + fulltitle (if big5-p "BIG5" "CNS") fulltitle)) (insert " '((\".\" . quail-next-translation-block) (\",\" . quail-prev-translation-block)) nil nil)\n\n") @@ -953,7 +939,7 @@ method `chinese-tonepy' with which you must specify tones by digits (= (length (aref trans i)) 1)) (setq i (1+ i))) (if (= i len) - (setq trans (mapconcat 'identity trans ""))))) + (setq trans (mapconcat #'identity trans ""))))) (setq dic (cons (cons key trans) dic))) table))) (setq dic (sort dic (lambda (x y) (string< (car x) (car y))))) From 85f8b575001ec8c3503d7e8746862e49c0c7a3bf Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 27 Jan 2021 20:08:43 +0200 Subject: [PATCH 039/107] Support multi-line prompt and contents in previous-line-or-history-element. * lisp/simple.el (previous-line-or-history-element): Move to the beginning of minibuffer contents if there is editable minibuffer contents on the same line after moving point to the prompt (bug#46033). Fix minimal old-column from 0 to 1 to put point at the beginning of minibuffer contents after going to the previous history element. --- lisp/simple.el | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index c878fdab921..e82b138b0da 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2472,14 +2472,24 @@ previous element of the minibuffer history in the minibuffer." (save-excursion (goto-char (1- prompt-end)) (current-column))) - 0) + 1) (current-column))))) (condition-case nil (with-no-warnings (previous-line arg) ;; Avoid moving point to the prompt (when (< (point) (minibuffer-prompt-end)) - (signal 'beginning-of-buffer nil))) + ;; If there is minibuffer contents on the same line + (if (<= (minibuffer-prompt-end) + (save-excursion + (if (or truncate-lines (not line-move-visual)) + (end-of-line) + (end-of-visual-line)) + (point))) + ;; Move to the beginning of minibuffer contents + (goto-char (minibuffer-prompt-end)) + ;; Otherwise, go to the previous history element + (signal 'beginning-of-buffer nil)))) (beginning-of-buffer ;; Restore old position since `line-move-visual' moves point to ;; the beginning of the line when it fails to go to the previous line. From f5d30d9d8b7665216e596b11730964937c6c610d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 27 Jan 2021 10:10:44 -0800 Subject: [PATCH 040/107] * admin/notes/unicode: titdic-cnv.el is now utf-8. --- admin/notes/unicode | 9 --------- 1 file changed, 9 deletions(-) diff --git a/admin/notes/unicode b/admin/notes/unicode index 45455d897f3..d69d5418e26 100644 --- a/admin/notes/unicode +++ b/admin/notes/unicode @@ -256,15 +256,6 @@ nontrivial changes to the build process. etc/tutorials/TUTORIAL.ja - * iso-2022-7bit - - This file contains multiple Chinese charsets, and converting it - to UTF-8 would lose the charset property and would change the - code's behavior. Although this could be worked around by - propertizing the strings, that hasn't been done. - - lisp/international/titdic-cnv.el - * utf-8-emacs These files contain characters that cannot be encoded in UTF-8. From 9f25ca5107fdb0b6da268d0a41a30aa2e55a1c64 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 27 Jan 2021 20:33:13 +0200 Subject: [PATCH 041/107] * lisp/replace.el (query-replace-read-from-suggestions): New function. (query-replace-read-from): Use it instead of hard-coded '(car search-ring)'. (read-regexp-suggestions): Add the active region (bug#41692). --- lisp/replace.el | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/lisp/replace.el b/lisp/replace.el index 4483d7f7800..cbf24bedef4 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -186,6 +186,21 @@ See `replace-regexp' and `query-replace-regexp-eval'.") length) length))))) +(defun query-replace-read-from-suggestions () + "Return a list of standard suggestions for `query-replace-read-from'. +By default, the list includes the active region, the identifier +(a.k.a. \"tag\") at point (see Info node `(emacs) Identifier Search'), +the last isearch string, and the last replacement regexp. +`query-replace-read-from' appends the list returned +by this function to the end of values available via +\\\\[next-history-element]." + (delq nil (list (when (use-region-p) + (buffer-substring-no-properties + (region-beginning) (region-end))) + (find-tag-default) + (car search-ring) + (car (symbol-value query-replace-from-history-variable))))) + (defun query-replace-read-from (prompt regexp-flag) "Query and return the `from' argument of a query-replace operation. Prompt with PROMPT. REGEXP-FLAG non-nil means the response should be a regexp. @@ -242,7 +257,8 @@ wants to replace FROM with TO." (if regexp-flag (read-regexp prompt nil 'minibuffer-history) (read-from-minibuffer - prompt nil nil nil nil (car search-ring) t))))) + prompt nil nil nil nil + (query-replace-read-from-suggestions) t))))) (to)) (if (and (zerop (length from)) query-replace-defaults) (cons (caar query-replace-defaults) @@ -808,13 +824,16 @@ the function that you set this to can check `this-command'." (defun read-regexp-suggestions () "Return a list of standard suggestions for `read-regexp'. -By default, the list includes the identifier (a.k.a. \"tag\") -at point (see Info node `(emacs) Identifier Search'), the last -isearch regexp, the last isearch string, and the last +By default, the list includes the active region, the identifier +(a.k.a. \"tag\") at point (see Info node `(emacs) Identifier Search'), +the last isearch regexp, the last isearch string, and the last replacement regexp. `read-regexp' appends the list returned by this function to the end of values available via \\\\[next-history-element]." (list + (when (use-region-p) + (buffer-substring-no-properties + (region-beginning) (region-end))) (find-tag-default-as-regexp) (find-tag-default-as-symbol-regexp) (car regexp-search-ring) From d168110a322389a9f991d7a5bdd1cf777642c990 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 27 Jan 2021 17:35:28 -0500 Subject: [PATCH 042/107] =?UTF-8?q?*=20lisp/emacs-lisp/macroexp.el=20(macr?= =?UTF-8?q?oexp--expand-all):=20Perform=20=CE=B2-reduction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also, in `funcall` macroexpand the function before checking to see if we can remove the `funcall`. (macroexp-if): Trim trailing `nil` in the generated code while we're at it. --- lisp/emacs-lisp/macroexp.el | 39 ++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index aa49bccc8d0..78f0b636a74 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -241,9 +241,22 @@ Assumes the caller has bound `macroexpand-all-environment'." form)) (`(,(and fun `(lambda . ,_)) . ,args) ;; Embedded lambda in function position. - (macroexp--cons (macroexp--all-forms fun 2) - (macroexp--all-forms args) - form)) + ;; If the byte-optimizer is loaded, try to unfold this, + ;; i.e. rewrite it to (let () ). We'd do it in the optimizer + ;; anyway, but doing it here (i.e. earlier) can sometimes avoid the + ;; creation of a closure, thus resulting in much better code. + (let ((newform (if (not (fboundp 'byte-compile-unfold-lambda)) + 'macroexp--not-unfolded + ;; Don't unfold if byte-opt is not yet loaded. + (byte-compile-unfold-lambda form)))) + (if (or (eq newform 'macroexp--not-unfolded) + (eq newform form)) + ;; Unfolding failed for some reason, avoid infinite recursion. + (macroexp--cons (macroexp--all-forms fun 2) + (macroexp--all-forms args) + form) + (macroexp--expand-all newform)))) + ;; The following few cases are for normal function calls that ;; are known to funcall one of their arguments. The byte ;; compiler has traditionally handled these functions specially @@ -257,17 +270,21 @@ Assumes the caller has bound `macroexpand-all-environment'." (macroexp--warn-and-return (format "%s quoted with ' rather than with #'" (list 'lambda (nth 1 f) '...)) - (macroexp--expand-all `(,fun ,f . ,args)))) + (macroexp--expand-all `(,fun #',f . ,args)))) ;; Second arg is a function: (`(,(and fun (or 'sort)) ,arg1 ',(and f `(lambda . ,_)) . ,args) (macroexp--warn-and-return (format "%s quoted with ' rather than with #'" (list 'lambda (nth 1 f) '...)) - (macroexp--expand-all `(,fun ,arg1 ,f . ,args)))) - (`(funcall #',(and f (pred symbolp)) . ,args) - ;; Rewrite (funcall #'foo bar) to (foo bar), in case `foo' - ;; has a compiler-macro. - (macroexp--expand-all `(,f . ,args))) + (macroexp--expand-all `(,fun ,arg1 #',f . ,args)))) + (`(funcall ,exp . ,args) + (let ((eexp (macroexp--expand-all exp)) + (eargs (macroexp--all-forms args))) + ;; Rewrite (funcall #'foo bar) to (foo bar), in case `foo' + ;; has a compiler-macro, or to unfold it. + (pcase eexp + (`#',f (macroexp--expand-all `(,f . ,eargs))) + (_ `(funcall ,eexp . ,eargs))))) (`(,func . ,_) ;; Macro expand compiler macros. This cannot be delayed to ;; byte-optimize-form because the output of the compiler-macro can @@ -360,12 +377,12 @@ Never returns an empty list." (t `(cond (,test ,@(macroexp-unprogn then)) (,(nth 1 else) ,@(macroexp-unprogn (nth 2 else))) - (t ,@(nthcdr 3 else)))))) + ,@(let ((def (nthcdr 3 else))) (if def '((t ,@def)))))))) ((eq (car-safe else) 'cond) `(cond (,test ,@(macroexp-unprogn then)) ,@(cdr else))) ;; Invert the test if that lets us reduce the depth of the tree. ((memq (car-safe then) '(if cond)) (macroexp-if `(not ,test) else then)) - (t `(if ,test ,then ,@(macroexp-unprogn else))))) + (t `(if ,test ,then ,@(if else (macroexp-unprogn else)))))) (defmacro macroexp-let2 (test sym exp &rest body) "Evaluate BODY with SYM bound to an expression for EXP's value. From d93bca019713e98228aca9f4d1a4838a72b1cf92 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 27 Jan 2021 18:51:09 -0500 Subject: [PATCH 043/107] * lisp/emacs-lisp/pcase.el (pcase--split-pred): Handle `memq` pred. Improve handling of the `member` tests generated from (or 'a 'b 'c). This will expand (pcase EXP ((and (or 1 2 3) (guard (FOO))) EXP1) (1 EXP2) (6 EXP3)) to (cond ((memql '(3 2 1) EXP) (cond ((FOO) EXP1) ((eql EXP 1) EXP2))) ((eql EXP 6) EXP3)) rather than to (cond ((memql '(3 2 1) EXP) (cond ((FOO) EXP1) ((eql EXP 1) EXP2) ((eql EXP 6) EXP3))) ((eql EXP 1) EXP2) ((eql EXP 6) EXP3)) --- lisp/emacs-lisp/pcase.el | 44 ++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index bfd577c5d14..cf129c453ec 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -683,11 +683,6 @@ A and B can be one of: ;; and catch at least the easy cases such as (bug#14773). (not (macroexp--fgrep (mapcar #'car vars) (cadr upat))))) '(:pcase--succeed . :pcase--fail)) - ;; In case UPAT is of the form (pred (not PRED)) - ((and (eq 'pred (car upat)) (eq 'not (car-safe (cadr upat)))) - (let* ((test (cadr (cadr upat))) - (res (pcase--split-pred vars `(pred ,test) pat))) - (cons (cdr res) (car res)))) ;; In case PAT is of the form (pred (not PRED)) ((and (eq 'pred (car-safe pat)) (eq 'not (car-safe (cadr pat)))) (let* ((test (cadr (cadr pat))) @@ -696,19 +691,34 @@ A and B can be one of: ((eq x :pcase--fail) :pcase--succeed))))) (cons (funcall reverse (car res)) (funcall reverse (cdr res))))) - ((and (eq 'pred (car upat)) - (let ((otherpred - (cond ((eq 'pred (car-safe pat)) (cadr pat)) - ((not (eq 'quote (car-safe pat))) nil) - ((consp (cadr pat)) #'consp) - ((stringp (cadr pat)) #'stringp) - ((vectorp (cadr pat)) #'vectorp) - ((byte-code-function-p (cadr pat)) - #'byte-code-function-p)))) - (pcase--mutually-exclusive-p (cadr upat) otherpred))) + ;; All the rest below presumes UPAT is of the form (pred ...). + ((not (eq 'pred (car upat))) nil) + ;; In case UPAT is of the form (pred (not PRED)) + ((eq 'not (car-safe (cadr upat))) + (let* ((test (cadr (cadr upat))) + (res (pcase--split-pred vars `(pred ,test) pat))) + (cons (cdr res) (car res)))) + ((let ((otherpred + (cond ((eq 'pred (car-safe pat)) (cadr pat)) + ((not (eq 'quote (car-safe pat))) nil) + ((consp (cadr pat)) #'consp) + ((stringp (cadr pat)) #'stringp) + ((vectorp (cadr pat)) #'vectorp) + ((byte-code-function-p (cadr pat)) + #'byte-code-function-p)))) + (pcase--mutually-exclusive-p (cadr upat) otherpred)) '(:pcase--fail . nil)) - ((and (eq 'pred (car upat)) - (eq 'quote (car-safe pat)) + ;; Since we turn (or 'a 'b 'c) into (pred (pcase--flip (memq '(a b c)))) + ;; try and preserve the info we get from that memq test. + ((and (eq 'pcase--flip (car-safe (cadr upat))) + (memq (cadr (cadr upat)) '(memq member memql)) + (eq 'quote (car-safe (nth 2 (cadr upat)))) + (eq 'quote (car-safe pat))) + (let ((set (cadr (nth 2 (cadr upat))))) + (if (member (cadr pat) set) + '(nil . :pcase--fail) + '(:pcase--fail . nil)))) + ((and (eq 'quote (car-safe pat)) (symbolp (cadr upat)) (or (symbolp (cadr pat)) (stringp (cadr pat)) (numberp (cadr pat))) (get (cadr upat) 'side-effect-free) From 30914167fd49e208c483541663f0275253e42227 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 27 Jan 2021 18:53:58 -0500 Subject: [PATCH 044/107] * lisp/emacs-lisp/macroexp.el (macroexp-if): Fix typo --- lisp/emacs-lisp/macroexp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 78f0b636a74..e842222b7c3 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -377,7 +377,7 @@ Never returns an empty list." (t `(cond (,test ,@(macroexp-unprogn then)) (,(nth 1 else) ,@(macroexp-unprogn (nth 2 else))) - ,@(let ((def (nthcdr 3 else))) (if def '((t ,@def)))))))) + ,@(let ((def (nthcdr 3 else))) (if def `((t ,@def)))))))) ((eq (car-safe else) 'cond) `(cond (,test ,@(macroexp-unprogn then)) ,@(cdr else))) ;; Invert the test if that lets us reduce the depth of the tree. From 2a71831eb3dcd122ee4f91254b31a801922c7917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Thu, 28 Jan 2021 04:18:12 +0100 Subject: [PATCH 045/107] Allow project/xref packages to be used in Emacs 26.1 * lisp/progmodes/project.el: Change Package-Requires to Emacs 26.1 (bug#44671). * lisp/progmodes/xref.el: Ditto. --- lisp/progmodes/project.el | 4 ++-- lisp/progmodes/xref.el | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 768cd58ae44..fc5e30111e5 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1,8 +1,8 @@ ;;; project.el --- Operations on the current project -*- lexical-binding: t; -*- ;; Copyright (C) 2015-2021 Free Software Foundation, Inc. -;; Version: 0.5.3 -;; Package-Requires: ((emacs "26.3") (xref "1.0.2")) +;; Version: 0.5.4 +;; Package-Requires: ((emacs "26.1") (xref "1.0.2")) ;; This is a GNU ELPA :core package. Avoid using functionality that ;; not compatible with the version of Emacs recorded above. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 898cb4fb4c1..07a65d4ed93 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2014-2021 Free Software Foundation, Inc. ;; Version: 1.0.4 -;; Package-Requires: ((emacs "26.3")) +;; Package-Requires: ((emacs "26.1")) ;; This is a GNU ELPA :core package. Avoid functionality that is not ;; compatible with the version of Emacs recorded above. From 9b01bc568278a939bd7e36a37623153d07171894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20J=C3=B6rg?= Date: Thu, 28 Jan 2021 04:22:21 +0100 Subject: [PATCH 046/107] perl-mode.el: Eliminate keywords which are not in Perl. * lisp/progmodes/perl-mode.el (perl-imenu-generic-expression): Remove keywords which are not part of Perl. (perl-font-lock-keywords-2): Remove keywords which are not part of Perl (bug#46024). (These keywords are part of Raku; aka. Perl 6.) --- lisp/progmodes/perl-mode.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index d047dd543c2..0120e4a7cd1 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -143,7 +143,7 @@ '(;; Functions (nil "^[ \t]*sub\\s-+\\([-[:alnum:]+_:]+\\)" 1) ;;Variables - ("Variables" "^[ \t]*\\(?:anon\\|argument\\|has\\|local\\|my\\|our\\|state\\|supersede\\)\\s-+\\([$@%][-[:alnum:]+_:]+\\)\\s-*=" 1) + ("Variables" "^[ \t]*\\(?:has\\|local\\|my\\|our\\|state\\)\\s-+\\([$@%][-[:alnum:]+_:]+\\)\\s-*=" 1) ("Packages" "^[ \t]*package\\s-+\\([-[:alnum:]+_:]+\\);" 1) ("Doc sections" "^=head[0-9][ \t]+\\(.*\\)" 1)) "Imenu generic expression for Perl mode. See `imenu-generic-expression'.") @@ -188,9 +188,8 @@ "\\>") ;; ;; Fontify declarators and prefixes as types. - ("\\<\\(anon\\|argument\\|has\\|local\\|my\\|our\\|state\\|supersede\\)\\>" . font-lock-type-face) ; declarators - ("\\<\\(let\\|temp\\)\\>" . font-lock-type-face) ; prefixes - ;; + ("\\<\\(has\\|local\\|my\\|our\\|state\\)\\>" . font-lock-type-face) ; declarators + ;; ;; Fontify function, variable and file name references. ("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face) ;; Additionally fontify non-scalar variables. `perl-non-scalar-variable' From e4c667079086528c6e0a9eead9c2d4d5f5b7c6e1 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 28 Jan 2021 06:21:40 +0100 Subject: [PATCH 047/107] Fix Gnus icalendar button navigation * lisp/gnus/gnus-icalendar.el (gnus-icalendar-insert-button): Mark buttons correctly for TAB navigation (bug#46135). --- lisp/gnus/gnus-icalendar.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index 1e0e2071018..9811e8b440f 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -835,6 +835,7 @@ These will be used to retrieve the RSVP information from ical events." keymap ,gnus-mime-button-map face ,gnus-article-button-face follow-link t + category t button t gnus-data ,data)))) From 0870ebb3cbfcb097d85eea5eacaf992dd88ed204 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 28 Jan 2021 07:09:18 +0100 Subject: [PATCH 048/107] Allow commenting out white space lines in latex-mode * lisp/newcomment.el (comment-region-default-1): Allow commenting out whitespace-only regions (bug#41793). * lisp/textmodes/tex-mode.el (latex--comment-region): Use it. (latex-mode): Set a comment style shim. --- lisp/newcomment.el | 30 +++++++++++++++++++++--------- lisp/textmodes/tex-mode.el | 7 ++++++- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 5d0d1053f4b..4216fc1a397 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -1221,21 +1221,33 @@ changed with `comment-style'." ;; FIXME: maybe we should call uncomment depending on ARG. (funcall comment-region-function beg end arg))) -(defun comment-region-default-1 (beg end &optional arg) +(defun comment-region-default-1 (beg end &optional arg noadjust) + "Comment region between BEG and END. +See `comment-region' for ARG. If NOADJUST, do not skip past +leading/trailing space when determining the region to comment +out." (let* ((numarg (prefix-numeric-value arg)) (style (cdr (assoc comment-style comment-styles))) (lines (nth 2 style)) (block (nth 1 style)) (multi (nth 0 style))) - ;; We use `chars' instead of `syntax' because `\n' might be - ;; of end-comment syntax rather than of whitespace syntax. - ;; sanitize BEG and END - (goto-char beg) (skip-chars-forward " \t\n\r") (beginning-of-line) - (setq beg (max beg (point))) - (goto-char end) (skip-chars-backward " \t\n\r") (end-of-line) - (setq end (min end (point))) - (if (>= beg end) (error "Nothing to comment")) + (if noadjust + (when (bolp) + (setq end (1- end))) + ;; We use `chars' instead of `syntax' because `\n' might be + ;; of end-comment syntax rather than of whitespace syntax. + ;; sanitize BEG and END + (goto-char beg) + (skip-chars-forward " \t\n\r") + (beginning-of-line) + (setq beg (max beg (point))) + (goto-char end) + (skip-chars-backward " \t\n\r") + (end-of-line) + (setq end (min end (point))) + (when (>= beg end) + (error "Nothing to comment"))) ;; sanitize LINES (setq lines diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index c4e4864da17..ce665e61656 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -1169,7 +1169,12 @@ subshell is initiated, `tex-shell-hook' is run." (setq-local outline-regexp latex-outline-regexp) (setq-local outline-level #'latex-outline-level) (setq-local forward-sexp-function #'latex-forward-sexp) - (setq-local skeleton-end-hook nil)) + (setq-local skeleton-end-hook nil) + (setq-local comment-region-function #'latex--comment-region) + (setq-local comment-style 'plain)) + +(defun latex--comment-region (beg end &optional arg) + (comment-region-default-1 beg end arg t)) ;;;###autoload (define-derived-mode slitex-mode latex-mode "SliTeX" From e7e7ef15886ce28d1d1873164e7ee17a6a5878e0 Mon Sep 17 00:00:00 2001 From: Mattias M Date: Thu, 28 Jan 2021 07:34:10 +0100 Subject: [PATCH 049/107] Fix fill-paragraph in asm-mode * lisp/progmodes/asm-mode.el: The value of fill-prefix ought to be nil not "\t" so that fill-context-prefix can do its thing. In fact, fill-prefix does not have to be set at all becuase asm-mode derives from prog-mode and fill-prefix is set in simple.el. * test/lisp/progmodes/asm-mode-tests.el: Add relevant test (bug#41064). Copyright-paperwork-exempt: yes --- lisp/progmodes/asm-mode.el | 3 +-- test/lisp/progmodes/asm-mode-tests.el | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el index 62ff783fbac..99b2ec6d87e 100644 --- a/lisp/progmodes/asm-mode.el +++ b/lisp/progmodes/asm-mode.el @@ -141,8 +141,7 @@ Special commands: (setq-local comment-add 1) (setq-local comment-start-skip "\\(?:\\s<+\\|/[/*]+\\)[ \t]*") (setq-local comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)") - (setq-local comment-end "") - (setq fill-prefix "\t")) + (setq-local comment-end "")) (defun asm-indent-line () "Auto-indent the current line." diff --git a/test/lisp/progmodes/asm-mode-tests.el b/test/lisp/progmodes/asm-mode-tests.el index 6ae4fdf5850..87872179d93 100644 --- a/test/lisp/progmodes/asm-mode-tests.el +++ b/test/lisp/progmodes/asm-mode-tests.el @@ -69,4 +69,14 @@ (should (string-match-p ";;; \nlabel:" (buffer-string))) (should (= (current-column) 4)))) +(ert-deftest asm-mode-tests-fill-comment () + (asm-mode-tests--with-temp-buffer + (call-interactively #'comment-dwim) + (insert "Pellentesque condimentum, magna ut suscipit hendrerit, \ +ipsum augue ornare nulla, non luctus diam neque sit amet urna.") + (call-interactively #'fill-paragraph) + (should (equal (buffer-string) "\t;; Pellentesque condimentum, \ +magna ut suscipit hendrerit,\n\t;; ipsum augue ornare nulla, non \ +luctus diam neque sit amet\n\t;; urna.")))) + ;;; asm-mode-tests.el ends here From 8992f8abf348b5b4eb2b2074d00b9c9aaaa6df17 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 28 Jan 2021 08:40:15 +0100 Subject: [PATCH 050/107] Make the default `whitespace-enable-predicate' use `derived-mode-p' * lisp/whitespace.el (whitespace-enable-predicate): Use `derived-mode-p' to check modes instead of `eq' (bug#40481). --- etc/NEWS | 5 +++++ lisp/whitespace.el | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index e038076e96c..f12c94d6491 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1098,6 +1098,11 @@ If present in 'whitespace-style' (as it is by default), the final character in the buffer will be highlighted if the buffer doesn't end with a newline. +--- +*** The default 'whitespace-enable-predicate' predicate has changed. +It used to check elements in the list version of +'whitespace-global-modes' with 'eq', but now uses 'derived-mode-p'. + ** Texinfo --- diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 7b8e5b7cc11..22bfae06975 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -1000,8 +1000,8 @@ See also `whitespace-style', `whitespace-newline' and ((eq whitespace-global-modes t)) ((listp whitespace-global-modes) (if (eq (car-safe whitespace-global-modes) 'not) - (not (memq major-mode (cdr whitespace-global-modes))) - (memq major-mode whitespace-global-modes))) + (not (apply #'derived-mode-p (cdr whitespace-global-modes))) + (apply #'derived-mode-p whitespace-global-modes))) (t nil)) ;; ...we have a display (not running a batch job) (not noninteractive) From 64d464886983378b9fa62a38b31ec6fc996f587b Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 28 Jan 2021 09:57:48 +0100 Subject: [PATCH 051/107] Fix numerical `comment-padding' value * lisp/newcomment.el (comment-padright): Allow using a number for `comment-padding', like the doc string says (bug#40056). --- lisp/newcomment.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 4216fc1a397..ea47eec4fda 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -832,12 +832,17 @@ Ensure that `comment-normalize-vars' has been called before you use this." (when (and (stringp str) (string-match "\\S-" str)) ;; Separate the actual string from any leading/trailing padding (string-match "\\`\\s-*\\(.*?\\)\\s-*\\'" str) - (let ((s (match-string 1 str)) ;actual string + (let ((s (match-string 1 str)) ;actual string (lpad (substring str 0 (match-beginning 1))) ;left padding - (rpad (concat (substring str (match-end 1)) ;original right padding - (substring comment-padding ;additional right padding - (min (- (match-end 0) (match-end 1)) - (length comment-padding))))) + (rpad (concat + (substring str (match-end 1)) ;original right padding + (if (numberp comment-padding) + (make-string (min comment-padding + (- (match-end 0) (match-end 1))) + ?\s) + (substring comment-padding ;additional right padding + (min (- (match-end 0) (match-end 1)) + (length comment-padding)))))) ;; We can only duplicate C if the comment-end has multiple chars ;; or if comments can be nested, else the comment-end `}' would ;; be turned into `}}}' where only the first ends the comment @@ -852,7 +857,7 @@ Ensure that `comment-normalize-vars' has been called before you use this." (concat (mapconcat (lambda (c) (concat (regexp-quote (string c)) "?")) lpad "") ;padding is not required (regexp-quote s) - (when multi "+") ;the last char of S might be repeated + (when multi "+") ;the last char of S might be repeated (mapconcat (lambda (c) (concat (regexp-quote (string c)) "?")) rpad "")))))) ;padding is not required From 0120f45db630753bc8c4d6c43f7cdb7f953144fd Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 28 Jan 2021 13:10:45 +0100 Subject: [PATCH 052/107] Protect against bad results from libravatar * lisp/image/gravatar.el (gravatar--service-libravatar): Don't have (gravatar-retrieve "foobar@zjp.codes" 'ignore) (which returns a CNAME) bug out. --- lisp/image/gravatar.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el index 4f37834a27f..b1e2a314ce8 100644 --- a/lisp/image/gravatar.el +++ b/lisp/image/gravatar.el @@ -160,12 +160,16 @@ to track whether you're reading a specific mail." (cond ((and result ;there is a result - (let* ((data (mapcar (lambda (record) + (let* ((answers (dns-get 'answers result)) + (data (mapcar (lambda (record) (dns-get 'data (cdr record))) - (dns-get 'answers result))) - (priorities (mapcar (lambda (r) - (dns-get 'priority r)) - data)) + ;; We may get junk data back (or CNAME; + ;; ignore). + (and (eq (dns-get 'type answers) 'SRV) + answers))) + (priorities (and (mapcar (lambda (r) + (dns-get 'priority r)) + data))) (max-priority (if priorities (apply #'max priorities) 0)) From 62233c9824047e989cb72c8e2d05e4b4444fe0be Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 28 Jan 2021 08:43:01 -0500 Subject: [PATCH 053/107] Use lexical-binding in lisp/{term,nxml,language} * test/lisp/electric-tests.el: * lisp/term/w32console.el: * lisp/nxml/rng-util.el: * leim/leim-ext.el: Use lexical-binding. * lisp/international/titdic-cnv.el (tit-process-header) (miscdic-convert): * lisp/international/mule-cmds.el (leim-list-header): * lisp/international/ja-dic-cnv.el (skkdic-convert): Use lexical-binding in the generated file. --- leim/leim-ext.el | 12 ++++++------ lisp/international/ja-dic-cnv.el | 3 ++- lisp/international/mule-cmds.el | 2 +- lisp/international/quail.el | 2 +- lisp/international/titdic-cnv.el | 4 ++++ lisp/nxml/rng-util.el | 2 +- lisp/term/w32console.el | 2 +- test/lisp/electric-tests.el | 2 +- 8 files changed, 17 insertions(+), 12 deletions(-) diff --git a/leim/leim-ext.el b/leim/leim-ext.el index 2378f6fdb4f..687379db9f0 100644 --- a/leim/leim-ext.el +++ b/leim/leim-ext.el @@ -1,4 +1,4 @@ -;; leim-ext.el -- extra leim configuration -*- coding:utf-8; -*- +;; leim-ext.el -- extra leim configuration -*- lexical-binding: t; -*- ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 @@ -39,13 +39,13 @@ (eval-after-load "quail/Punct-b5" '(quail-defrule " " ?  nil t)) -(register-input-method "ucs" "UTF-8" 'ucs-input-activate "U+" +(register-input-method "ucs" "UTF-8" #'ucs-input-activate "U+" "Unicode input as hex in the form Uxxxx.") (register-input-method "korean-hangul" "UTF-8" - 'hangul-input-method-activate + #'hangul-input-method-activate "한2" "Hangul 2-Bulsik Input" 'hangul2-input-method @@ -54,7 +54,7 @@ (register-input-method "korean-hangul3f" "UTF-8" - 'hangul-input-method-activate + #'hangul-input-method-activate "한3f" "Hangul 3-Bulsik final Input" 'hangul3-input-method @@ -63,7 +63,7 @@ (register-input-method "korean-hangul390" "UTF-8" - 'hangul-input-method-activate + #'hangul-input-method-activate "한390" "Hangul 3-Bulsik 390 Input" 'hangul390-input-method @@ -72,7 +72,7 @@ (register-input-method "korean-hangul3" "UTF-8" - 'hangul-input-method-activate + #'hangul-input-method-activate "한390" "Hangul 3-Bulsik 390 Input" 'hangul390-input-method diff --git a/lisp/international/ja-dic-cnv.el b/lisp/international/ja-dic-cnv.el index 155c85fb42f..3be7849df19 100644 --- a/lisp/international/ja-dic-cnv.el +++ b/lisp/international/ja-dic-cnv.el @@ -342,7 +342,8 @@ The name of generated file is specified by the variable `ja-dic-filename'." (with-current-buffer buf (erase-buffer) (buffer-disable-undo) - (insert ";;; ja-dic.el --- dictionary for Japanese input method\n" + (insert ";;; ja-dic.el --- dictionary for Japanese input method" + " -*- lexical-binding:t -*-\n" ";;\tGenerated by the command `skkdic-convert'\n" ";;\tOriginal SKK dictionary file: " (file-relative-name (expand-file-name filename) dirname) diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 347e6782590..8202c3ee27a 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -1279,7 +1279,7 @@ in the format of Lisp expression for registering each input method. Emacs loads this file at startup time.") (defconst leim-list-header (format-message -";;; %s -- list of LEIM (Library of Emacs Input Method) -*-coding: utf-8;-*- +";;; %s --- list of LEIM (Library of Emacs Input Method) -*- lexical-binding:t -*- ;; ;; This file is automatically generated. ;; diff --git a/lisp/international/quail.el b/lisp/international/quail.el index 9698d461535..0901115cffe 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el @@ -3013,7 +3013,7 @@ of each directory." ;; At first, clean up the file. (with-current-buffer list-buf - (goto-char 1) + (goto-char (point-min)) ;; Insert the correct header. (if (looking-at (regexp-quote leim-list-header)) diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index ce5c04293ad..64d66443760 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el @@ -269,6 +269,8 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲, (tit-moveleft ",<") (tit-keyprompt nil)) + (princ (format ";;; %s -*- lexical-binding:t -*-\n" + (file-name-nondirectory filename))) (princ ";; Quail package `") (princ package) (princ "\n") @@ -1133,6 +1135,8 @@ the generated Quail package is saved." ;; Explicitly set eol format to `unix'. (setq coding-system-for-write 'utf-8-unix) (with-temp-file (expand-file-name quailfile dirname) + (insert (format ";;; %s -*- lexical-binding:t -*-\n" + (file-name-nondirectory quailfile))) (insert (format-message ";; Quail package `%s'\n" name)) (insert (format-message ";; Generated by the command `miscdic-convert'\n")) diff --git a/lisp/nxml/rng-util.el b/lisp/nxml/rng-util.el index 59465c371eb..a20e95086cb 100644 --- a/lisp/nxml/rng-util.el +++ b/lisp/nxml/rng-util.el @@ -1,4 +1,4 @@ -;;; rng-util.el --- utility functions for RELAX NG library +;;; rng-util.el --- utility functions for RELAX NG library -*- lexical-binding: t; -*- ;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc. diff --git a/lisp/term/w32console.el b/lisp/term/w32console.el index 8859f13bd20..4a925cd84c3 100644 --- a/lisp/term/w32console.el +++ b/lisp/term/w32console.el @@ -1,4 +1,4 @@ -;;; w32console.el -- Setup w32 console keys and colors. +;;; w32console.el -- Setup w32 console keys and colors. -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 1b7beeaa366..05a6989664d 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -1,4 +1,4 @@ -;;; electric-tests.el --- tests for electric.el +;;; electric-tests.el --- tests for electric.el -*- lexical-binding: t; -*- ;; Copyright (C) 2013-2021 Free Software Foundation, Inc. From a8c4f8041cc64e3dafc0e435bab8043d7165ffff Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 28 Jan 2021 15:09:18 +0100 Subject: [PATCH 054/107] Simplify auto-revert buffer list by watch descriptor (Bug#44639) * lisp/autorevert.el (auto-revert--buffer-by-watch-descriptor): Rename from `auto-revert--buffers-by-watch-descriptor'. Make it an assoc list. (auto-revert-notify-rm-watch, auto-revert-notify-add-watch) (auto-revert-notify-handler): Adapt accordingly. Based on a patch provided by Spencer Baugh . (Bug#44639) --- lisp/autorevert.el | 101 ++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 56 deletions(-) diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 1b2d68939ad..57258f9c833 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -355,10 +355,9 @@ the list of old buffers.") (add-hook 'after-set-visited-file-name-hook #'auto-revert-set-visited-file-name) -(defvar auto-revert--buffers-by-watch-descriptor - (make-hash-table :test 'equal) - "A hash table mapping notification descriptors to lists of buffers. -The buffers use that descriptor for auto-revert notifications. +(defvar auto-revert--buffer-by-watch-descriptor nil + "An association list mapping notification descriptors to buffers. +The buffer uses that descriptor for auto-revert notifications. The key is equal to `auto-revert-notify-watch-descriptor' in each buffer.") @@ -630,16 +629,12 @@ will use an up-to-date value of `auto-revert-interval'." (defun auto-revert-notify-rm-watch () "Disable file notification for current buffer's associated file." - (let ((desc auto-revert-notify-watch-descriptor) - (table auto-revert--buffers-by-watch-descriptor)) - (when desc - (let ((buffers (delq (current-buffer) (gethash desc table)))) - (if buffers - (puthash desc buffers table) - (remhash desc table))) - (ignore-errors - (file-notify-rm-watch desc)) - (remove-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch t))) + (when-let ((desc auto-revert-notify-watch-descriptor)) + (setq auto-revert--buffer-by-watch-descriptor + (assoc-delete-all desc auto-revert--buffer-by-watch-descriptor)) + (ignore-errors + (file-notify-rm-watch desc)) + (remove-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch t)) (setq auto-revert-notify-watch-descriptor nil auto-revert-notify-modified-p nil)) @@ -660,13 +655,10 @@ will use an up-to-date value of `auto-revert-interval'." (if buffer-file-name '(change attribute-change) '(change)) 'auto-revert-notify-handler)))) (when auto-revert-notify-watch-descriptor - (setq auto-revert-notify-modified-p t) - (puthash - auto-revert-notify-watch-descriptor - (cons (current-buffer) - (gethash auto-revert-notify-watch-descriptor - auto-revert--buffers-by-watch-descriptor)) - auto-revert--buffers-by-watch-descriptor) + (setq auto-revert-notify-modified-p t + auto-revert--buffer-by-watch-descriptor + (cons (cons auto-revert-notify-watch-descriptor (current-buffer)) + auto-revert--buffer-by-watch-descriptor)) (add-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch nil t)))) ;; If we have file notifications, we want to update the auto-revert buffers @@ -696,8 +688,8 @@ system.") (action (nth 1 event)) (file (nth 2 event)) (file1 (nth 3 event)) ;; Target of `renamed'. - (buffers (gethash descriptor - auto-revert--buffers-by-watch-descriptor))) + (buffer (alist-get descriptor auto-revert--buffer-by-watch-descriptor + nil nil #'equal))) ;; Check, that event is meant for us. (cl-assert descriptor) ;; Since we watch a directory, a file name must be returned. @@ -706,9 +698,9 @@ system.") (when auto-revert-debug (message "auto-revert-notify-handler %S" event)) - (if (eq action 'stopped) - ;; File notification has stopped. Continue with polling. - (cl-dolist (buffer buffers) + (when (buffer-live-p buffer) + (if (eq action 'stopped) + ;; File notification has stopped. Continue with polling. (with-current-buffer buffer (when (or ;; A buffer associated with a file. @@ -721,38 +713,35 @@ system.") (auto-revert-notify-rm-watch) ;; Restart the timer if it wasn't running. (unless auto-revert-timer - (auto-revert-set-timer))))) + (auto-revert-set-timer)))) - ;; Loop over all buffers, in order to find the intended one. - (cl-dolist (buffer buffers) - (when (buffer-live-p buffer) - (with-current-buffer buffer - (when (or - ;; A buffer associated with a file. - (and (stringp buffer-file-name) - (or - (and (memq - action '(attribute-changed changed created)) - (string-equal - (file-name-nondirectory file) - (file-name-nondirectory buffer-file-name))) - (and (eq action 'renamed) - (string-equal - (file-name-nondirectory file1) - (file-name-nondirectory buffer-file-name))))) - ;; A buffer w/o a file, like dired. - (and (null buffer-file-name) - (memq action '(created renamed deleted)))) - ;; Mark buffer modified. - (setq auto-revert-notify-modified-p t) + (with-current-buffer buffer + (when (or + ;; A buffer associated with a file. + (and (stringp buffer-file-name) + (or + (and (memq + action '(attribute-changed changed created)) + (string-equal + (file-name-nondirectory file) + (file-name-nondirectory buffer-file-name))) + (and (eq action 'renamed) + (string-equal + (file-name-nondirectory file1) + (file-name-nondirectory buffer-file-name))))) + ;; A buffer w/o a file, like dired. + (and (null buffer-file-name) + (memq action '(created renamed deleted)))) + ;; Mark buffer modified. + (setq auto-revert-notify-modified-p t) - ;; Revert the buffer now if we're not locked out. - (unless auto-revert--lockout-timer - (auto-revert-handler) - (setq auto-revert--lockout-timer - (run-with-timer - auto-revert--lockout-interval nil - #'auto-revert--end-lockout buffer))))))))))) + ;; Revert the buffer now if we're not locked out. + (unless auto-revert--lockout-timer + (auto-revert-handler) + (setq auto-revert--lockout-timer + (run-with-timer + auto-revert--lockout-interval nil + #'auto-revert--end-lockout buffer)))))))))) (defun auto-revert--end-lockout (buffer) "End the lockout period after a notification. From ac102bb966f7944babbd8594684550905eecca0a Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 28 Jan 2021 15:09:29 +0100 Subject: [PATCH 055/107] * lisp/net/ange-ftp.el (ange-ftp-ls): Handle several "--dired" switches. --- lisp/net/ange-ftp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 9559b125135..fa13dd57d1d 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -2547,7 +2547,7 @@ can parse the output from a DIR listing for a host of type TYPE.") FILE is the full name of the remote file, LSARGS is any args to pass to the `ls' command, and PARSE specifies that the output should be parsed and stored away in the internal cache." - (when (string-match "^--dired\\s-+" lsargs) + (while (string-match "^--dired\\s-+" lsargs) (setq lsargs (replace-match "" nil t lsargs))) ;; If parse is t, we assume that file is a directory. i.e. we only parse ;; full directory listings. From 91f9d6788e83e619b2df5a30ca4ab9f4be0a11b0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 28 Jan 2021 12:13:29 -0500 Subject: [PATCH 056/107] * test/Makefile.in (emacs): Use the C locale This fixes spurious test failures in my environment for `diff-mode-test-font-lock-syntax-one-line` (where my `diff` otherwise returns "No newline at end of file" in French) and for various tests in `emacs-module-tests` because errors signal "Abandon" instead of "Abort". --- test/Makefile.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/Makefile.in b/test/Makefile.in index c5e86df3761..f907602a622 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -122,8 +122,9 @@ MODULES_EMACSOPT := endif # The actual Emacs command run in the targets below. -# Prevent any setting of EMACSLOADPATH in user environment causing problems. -emacs = EMACSLOADPATH= \ +# Prevent any setting of EMACSLOADPATH in user environment causing problems, +# and prevent locals to influence the text of the errors we expect to receive. +emacs = LANG=C EMACSLOADPATH= \ EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \ $(GDB) "$(EMACS)" $(MODULES_EMACSOPT) $(EMACSOPT) From 6c601689a40079dd6c253f15a690a3c0cf6918df Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 24 Jan 2021 00:53:38 +0100 Subject: [PATCH 057/107] ; * lisp/dired-aux.el (dired-compress-files-alist): Minor doc fix. --- lisp/dired-aux.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index c765e4be45d..ec864d54d69 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1179,7 +1179,7 @@ archive to which you want to compress, and CMD is the corresponding command. Within CMD, %i denotes the input file(s), and %o denotes the -output file. %i path(s) are relative, while %o is absolute.") +output file. %i path(s) are relative, while %o is absolute.") ;;;###autoload (defun dired-do-compress-to () From 80d964ec8b64a1c604c99aa51ecdbd813d739a90 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 15:08:51 +0100 Subject: [PATCH 058/107] Add missing file systems to etc-fstab-generic-mode * lisp/generic-x.el (etc-fstab-generic-mode): Add entries for missing file systems. --- lisp/generic-x.el | 69 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/lisp/generic-x.el b/lisp/generic-x.el index f3ea22a4a30..60cf8468a4e 100644 --- a/lisp/generic-x.el +++ b/lisp/generic-x.el @@ -1490,41 +1490,104 @@ like an INI file. You can add this hook to `find-file-hook'." (define-generic-mode etc-fstab-generic-mode '(?#) '("adfs" + "ados" "affs" + "anon_inodefs" + "atfs" + "audiofs" "autofs" + "bdev" + "befs" + "bfs" + "binfmt_misc" + "btrfs" + "cd9660" + "cfs" + "cgroup" + "cifs" "coda" "coherent" + "configfs" + "cpuset" "cramfs" + "devfs" "devpts" + "devtmpfs" + "e2compr" "efs" "ext2" + "ext2fs" "ext3" "ext4" + "fdesc" + "ffs" + "filecore" + "fuse" + "fuseblk" + "fusectl" "hfs" "hpfs" + "hugetlbfs" "iso9660" + "jffs" + "jffs2" "jfs" + "kernfs" + "lfs" + "linprocfs" + "mfs" "minix" + "mqueue" "msdos" "ncpfs" "nfs" + "nfsd" + "nilfs2" + "none" "ntfs" + "null" + "nwfs" + "overlay" + "ovlfs" + "pipefs" + "portal" "proc" + "procfs" + "pstore" + "ptyfs" "qnx4" + "ramfs" "reiserfs" "romfs" + "securityfs" + "shm" "smbfs" - "cifs" - "usbdevfs" - "sysv" + "sockfs" + "squashfs" + "sshfs" + "std" + "subfs" "sysfs" + "sysv" + "tcfs" "tmpfs" "udf" "ufs" + "umap" "umsdos" + "union" + "usbdevfs" + "usbfs" + "userfs" "vfat" + "vs3fs" + "vxfs" + "wrapfs" + "wvfs" + "xenfs" "xenix" "xfs" + "zisofs" "swap" "auto" "ignore") From 4cded88b0ebb005f67447cd07da016eb0b7ef4a4 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 17:05:06 +0100 Subject: [PATCH 059/107] * lisp/generic-x.el (hosts-generic-mode): Support IPv6 addresses. --- lisp/generic-x.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/generic-x.el b/lisp/generic-x.el index 60cf8468a4e..bd03f287fc7 100644 --- a/lisp/generic-x.el +++ b/lisp/generic-x.el @@ -365,7 +365,8 @@ your changes into effect." (define-generic-mode hosts-generic-mode '(?#) '("localhost") - '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face)) + '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face) + ("\\<\\([0-9A-Fa-f:]+\\)\\>" 1 font-lock-constant-face)) '("[hH][oO][sS][tT][sS]\\'") nil "Generic mode for HOSTS files.")) From b04f1c0cec5bc722fd5823861044f212206c3d3b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 18:16:49 +0100 Subject: [PATCH 060/107] Add cross-reference to with-eval-after-load * lisp/subr.el (eval-after-load): Doc fix; add cross-reference to 'with-eval-after-load'. --- lisp/subr.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/subr.el b/lisp/subr.el index afa73c72eaa..34129ea38a0 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4921,7 +4921,9 @@ file, FORM is evaluated immediately after the provide statement. Usually FILE is just a library name like \"font-lock\" or a feature name like `font-lock'. -This function makes or adds to an entry on `after-load-alist'." +This function makes or adds to an entry on `after-load-alist'. + +See also `with-eval-after-load'." (declare (compiler-macro (lambda (whole) (if (eq 'quote (car-safe form)) From 592a230832257e915aa3ed798a1f0210df639031 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 28 Jan 2021 12:27:09 -0500 Subject: [PATCH 061/107] * src/fns.c (hash_string): Fix bug#46111 Use `memcpy` instead of an unaligned memory access. On x86 at least, GCC turns this `memcpy` into a single `mov`, so it's about as fast. --- src/fns.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/fns.c b/src/fns.c index 7ab2e8f1a03..bd4afa0c4e9 100644 --- a/src/fns.c +++ b/src/fns.c @@ -4599,33 +4599,29 @@ sweep_weak_table (struct Lisp_Hash_Table *h, bool remove_entries_p) EMACS_UINT hash_string (char const *ptr, ptrdiff_t len) { - EMACS_UINT const *p = (EMACS_UINT const *) ptr; - EMACS_UINT const *end = (EMACS_UINT const *) (ptr + len); + char const *p = ptr; + char const *end = ptr + len; EMACS_UINT hash = len; /* At most 8 steps. We could reuse SXHASH_MAX_LEN, of course, * but dividing by 8 is cheaper. */ - ptrdiff_t step = 1 + ((end - p) >> 3); + ptrdiff_t step = sizeof hash + ((end - p) >> 3); - /* Beware: `end` might be unaligned, so `p < end` is not always the same - * as `p <= end - 1`. */ - while (p <= end - 1) + while (p + sizeof hash <= end) { - EMACS_UINT c = *p; + EMACS_UINT c; + /* We presume that the compiler will replace this `memcpy` with + a single load/move instruction when applicable. */ + memcpy (&c, p, sizeof hash); p += step; hash = sxhash_combine (hash, c); } - if (p < end) - { /* A few last bytes remain (smaller than an EMACS_UINT). */ - /* FIXME: We could do this without a loop, but it'd require - endian-dependent code :-( */ - char const *p1 = (char const *)p; - char const *end1 = (char const *)end; - do - { - unsigned char c = *p1++; - hash = sxhash_combine (hash, c); - } - while (p1 < end1); + /* A few last bytes may remain (smaller than an EMACS_UINT). */ + /* FIXME: We could do this without a loop, but it'd require + endian-dependent code :-( */ + while (p < end) + { + unsigned char c = *p++; + hash = sxhash_combine (hash, c); } return hash; From c407b54cf37ae56f65a75f5238f86898be7d8159 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 18:35:45 +0100 Subject: [PATCH 062/107] * lisp/ezimage.el: Use lexical-binding. --- lisp/ezimage.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ezimage.el b/lisp/ezimage.el index 9c1d8599101..13f5c039a7f 100644 --- a/lisp/ezimage.el +++ b/lisp/ezimage.el @@ -1,4 +1,4 @@ -;;; ezimage --- Generalized Image management +;;; ezimage.el --- Generalized Image management -*- lexical-binding: t -*- ;; Copyright (C) 1999-2021 Free Software Foundation, Inc. From f782f1a8e07c7ef689e9f3a763259a030883c5c6 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 18:49:17 +0100 Subject: [PATCH 063/107] * lisp/leim/quail/compose.el: Use lexical-binding. --- lisp/leim/quail/compose.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/leim/quail/compose.el b/lisp/leim/quail/compose.el index f7ac83aec5b..264a9b479b3 100644 --- a/lisp/leim/quail/compose.el +++ b/lisp/leim/quail/compose.el @@ -1,4 +1,4 @@ -;;; compose.el --- Quail package for Multi_key character composition -*-coding: utf-8;-*- +;;; compose.el --- Quail package for Multi_key character composition -*-coding: utf-8; lexical-binding: t -*- ;; Copyright (C) 2020-2021 Free Software Foundation, Inc. From aca93f67239e82f7c63444525e00337db8f168fe Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 18:49:29 +0100 Subject: [PATCH 064/107] * lisp/leim/quail/viqr.el: Use lexical-binding. --- lisp/leim/quail/viqr.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/leim/quail/viqr.el b/lisp/leim/quail/viqr.el index b7591b15e05..d127ff247cf 100644 --- a/lisp/leim/quail/viqr.el +++ b/lisp/leim/quail/viqr.el @@ -1,4 +1,4 @@ -;;; viqr.el --- Quail packages for inputting Vietnamese with VIQR system -*-coding: utf-8;-*- +;;; viqr.el --- Quail packages for inputting Vietnamese with VIQR system -*-coding: utf-8; lexical-binding: t -*- ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, ;; 2006, 2007, 2008, 2009, 2010, 2011 From a8caa66906b157c9c2b4c4dc1c447b6a9e747c5e Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 19:06:18 +0100 Subject: [PATCH 065/107] Avoid recommending Google * doc/misc/org.texi (Link Abbreviations): * lisp/net/webjump.el (webjump-sample-sites): * lisp/org/ol.el (org-link-shell-confirm-function) (org-link-elisp-confirm-function): * lisp/org/org.el (org-highlight-links): * lisp/wdired.el: Avoid recommending Google. squash! Avoid recommending Google --- doc/misc/org.texi | 6 +++--- lisp/net/webjump.el | 3 --- lisp/org/ol.el | 8 ++++---- lisp/org/org.el | 2 +- lisp/wdired.el | 4 ++-- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/doc/misc/org.texi b/doc/misc/org.texi index 5eeb098cc72..8902d628875 100644 --- a/doc/misc/org.texi +++ b/doc/misc/org.texi @@ -4071,7 +4071,7 @@ the link. Such a function will be called with the tag as the only argument. With the above setting, you could link to a specific bug with -@samp{[[bugzilla:129]]}, search the web for @samp{OrgMode} with @samp{[[google:OrgMode]]}, +@samp{[[bugzilla:129]]}, search the web for @samp{OrgMode} with @samp{[[duckduckgo:OrgMode]]}, show the map location of the Free Software Foundation @samp{[[gmap:51 Franklin Street, Boston]]} or of Carsten office @samp{[[omap:Science Park 904, Amsterdam, The Netherlands]]} and find out what the Org author is doing @@ -4082,8 +4082,8 @@ can define them in the file with @cindex @samp{LINK}, keyword @example -#+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id= -#+LINK: google http://www.google.com/search?q=%s +#+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id= +#+LINK: duckduckgo https://duckduckgo.com/?q=%s @end example In-buffer completion (see @ref{Completion}) can be used after @samp{[} to diff --git a/lisp/net/webjump.el b/lisp/net/webjump.el index e5941ae652e..1fa625c3245 100644 --- a/lisp/net/webjump.el +++ b/lisp/net/webjump.el @@ -96,9 +96,6 @@ ("DuckDuckGo" . [simple-query "duckduckgo.com" "duckduckgo.com/?q=" ""]) - ("Google" . - [simple-query "www.google.com" - "www.google.com/search?q=" ""]) ("Google Groups" . [simple-query "groups.google.com" "groups.google.com/groups?q=" ""]) diff --git a/lisp/org/ol.el b/lisp/org/ol.el index d1db1683bbe..994e30f4f43 100644 --- a/lisp/org/ol.el +++ b/lisp/org/ol.el @@ -376,9 +376,9 @@ changes to the current buffer." Shell links can be dangerous: just think about a link - [[shell:rm -rf ~/*][Google Search]] + [[shell:rm -rf ~/*][Web Search]] -This link would show up in your Org document as \"Google Search\", +This link would show up in your Org document as \"Web Search\", but really it would remove your entire home directory. Therefore we advise against setting this variable to nil. Just change it to `y-or-n-p' if you want to confirm with a @@ -401,9 +401,9 @@ single keystroke rather than having to type \"yes\"." "Non-nil means ask for confirmation before executing Emacs Lisp links. Elisp links can be dangerous: just think about a link - [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]] + [[elisp:(shell-command \"rm -rf ~/*\")][Web Search]] -This link would show up in your Org document as \"Google Search\", +This link would show up in your Org document as \"Web Search\", but really it would remove your entire home directory. Therefore we advise against setting this variable to nil. Just change it to `y-or-n-p' if you want to confirm with a diff --git a/lisp/org/org.el b/lisp/org/org.el index 43aa0a178a9..2d21a44fb48 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -1846,7 +1846,7 @@ link types. The types are: bracket The recommended [[link][description]] or [[link]] links with hiding. angle Links in angular brackets that may contain whitespace like . -plain Plain links in normal text, no whitespace, like http://google.com. +plain Plain links in normal text, no whitespace, like https://gnu.org. radio Text that is matched by a radio target, see manual for details. tag Tag settings in a headline (link to tag search). date Time stamps (link to calendar). diff --git a/lisp/wdired.el b/lisp/wdired.el index f4a0b6d9a93..037eb31245b 100644 --- a/lisp/wdired.el +++ b/lisp/wdired.el @@ -68,8 +68,8 @@ ;;; Change Log: -;; Google is your friend (previous versions with complete changelogs -;; were posted to gnu.emacs.sources) +;; Previous versions with complete changelogs were posted to +;; gnu.emacs.sources. ;;; Code: From 50c7de093a4e699fb86b05b8fdd6b6a47a886106 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 19:21:41 +0100 Subject: [PATCH 066/107] * lisp/wdired.el: Minor doc fixes. --- lisp/wdired.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lisp/wdired.el b/lisp/wdired.el index 037eb31245b..a096abd106f 100644 --- a/lisp/wdired.el +++ b/lisp/wdired.el @@ -27,26 +27,26 @@ ;; wdired.el (the "w" is for writable) provides an alternative way of ;; renaming files. ;; -;; Have you ever wished to use C-x r t (string-rectangle), M-% +;; Have you ever wanted to use C-x r t (string-rectangle), M-% ;; (query-replace), M-c (capitalize-word), etc... to change the name of -;; the files in a "dired" buffer? Now you can do this. All the power -;; of Emacs commands are available to renaming files! +;; the files in a "dired" buffer? Now you can do this. All the power +;; of Emacs commands are available when renaming files! ;; ;; This package provides a function that makes the filenames of a ;; dired buffer editable, by changing the buffer mode (which inhibits -;; all of the commands of dired mode). Here you can edit the names of +;; all of the commands of dired mode). Here you can edit the names of ;; one or more files and directories, and when you press C-c C-c, the ;; renaming takes effect and you are back to dired mode. ;; -;; Another things you can do with WDired: +;; Other things you can do with WDired: ;; -;; - To move files to another directory (by typing their path, +;; - Move files to another directory (by typing their path, ;; absolute or relative, as a part of the new filename). ;; -;; - To change the target of symbolic links. +;; - Change the target of symbolic links. ;; -;; - To change the permission bits of the filenames (in systems with a -;; working unix-alike `dired-chmod-program'). See and customize the +;; - Change the permission bits of the filenames (in systems with a +;; working unix-alike `dired-chmod-program'). See and customize the ;; variable `wdired-allow-to-change-permissions'. To change a single ;; char (toggling between its two more usual values) you can press ;; the space bar over it or left-click the mouse. To set any char to @@ -56,7 +56,7 @@ ;; the change would affect to their targets, and this would not be ;; WYSIWYG :-). ;; -;; - To mark files for deletion, by deleting their whole filename. +;; - Mark files for deletion, by deleting their whole filename. ;;; Usage: From c8c4d65d6510724acd40527a9af67e21e3cf4d5e Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 28 Jan 2021 21:27:26 +0200 Subject: [PATCH 067/107] Use isearch-tmm-menubar when tmm-menubar is called in isearch-mode (bug#43966) * lisp/isearch.el (isearch-menu-bar-commands): Add tmm-menubar to defaults. (isearch-mode-map): Remove remapping of tmm-menubar to isearch-tmm-menubar. * lisp/tmm.el (tmm-menubar): Call isearch-tmm-menubar in isearch-mode. --- lisp/isearch.el | 3 +-- lisp/tmm.el | 14 ++++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index a86678572c4..a1e3fe2c3f0 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -513,7 +513,7 @@ This is like `describe-bindings', but displays only Isearch keys." (call-interactively command))) (defvar isearch-menu-bar-commands - '(isearch-tmm-menubar menu-bar-open mouse-minor-mode-menu) + '(isearch-tmm-menubar tmm-menubar menu-bar-open mouse-minor-mode-menu) "List of commands that can open a menu during Isearch.") (defvar isearch-menu-bar-yank-map @@ -787,7 +787,6 @@ This is like `describe-bindings', but displays only Isearch keys." (define-key map [menu-bar search-menu] (list 'menu-item "Isearch" isearch-menu-bar-map)) - (define-key map [remap tmm-menubar] 'isearch-tmm-menubar) map) "Keymap for `isearch-mode'.") diff --git a/lisp/tmm.el b/lisp/tmm.el index e49246a5c4f..2040f522700 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -56,12 +56,14 @@ to invoke `tmm-menubar' instead, customize the variable `tty-menu-open-use-tmm' to a non-nil value." (interactive) (run-hooks 'menu-bar-update-hook) - (let ((menu-bar (menu-bar-keymap)) - (menu-bar-item-cons (and x-position - (menu-bar-item-at-x x-position)))) - (tmm-prompt menu-bar - nil - (and menu-bar-item-cons (car menu-bar-item-cons))))) + (if isearch-mode + (isearch-tmm-menubar) + (let ((menu-bar (menu-bar-keymap)) + (menu-bar-item-cons (and x-position + (menu-bar-item-at-x x-position)))) + (tmm-prompt menu-bar + nil + (and menu-bar-item-cons (car menu-bar-item-cons)))))) ;;;###autoload (defun tmm-menubar-mouse (event) From 991c8946b6e9c87403dc2691100566cb98577de1 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 28 Jan 2021 14:42:21 -0500 Subject: [PATCH 068/107] Use lexical-binding in all of `lisp/emacs-lisp` * lisp/emacs-lisp/bindat.el: Use lexical-binding. (bindat--unpack-group, bindat--length-group, bindat--pack-group): Declare `last` and `tag` as dyn-scoped. (bindat-unpack, bindat-pack): Bind `bindat-raw` and `bindat-idx` via `let` rather than via the formal arglist. * lisp/emacs-lisp/package-x.el: * lisp/emacs-lisp/generic.el: * lisp/emacs-lisp/eieio-opt.el: * lisp/emacs-lisp/derived.el: * lisp/emacs-lisp/crm.el: Use lexical-binding. * lisp/emacs-lisp/helper.el: Use lexical-binding. (Helper-help-map): Move initialization into declaration. * lisp/emacs-lisp/regi.el: Use lexical-binding. (regi-interpret): Remove unused var `tstart`. Declare `curframe`, `curentry` and `curline` as dyn-scoped. * lisp/emacs-lisp/shadow.el: Use lexical-binding. (load-path-shadows-find): Remove unused var `file`. Tighten a regexp, use `push`. * lisp/emacs-lisp/tcover-ses.el: Use lexical-binding. Require `ses`. Remove correspondingly redundant declarations. (ses--curcell-overlay): Declare. (ses-exercise): Use `dlet` and use a properly-prefixed var name. Fix name of `curcell-overlay` variable. * lisp/emacs-lisp/unsafep.el: Use lexical-binding. (unsafep): Bind `unsafep-vars` via `let` rather than via the formal arglist. --- admin/notes/unicode | 1 + lisp/emacs-lisp/bindat.el | 112 +++++++++++++++++++--------------- lisp/emacs-lisp/crm.el | 2 +- lisp/emacs-lisp/derived.el | 2 +- lisp/emacs-lisp/eieio-opt.el | 2 +- lisp/emacs-lisp/generic.el | 9 +-- lisp/emacs-lisp/helper.el | 29 +++++---- lisp/emacs-lisp/package-x.el | 2 +- lisp/emacs-lisp/regi.el | 51 ++++++++-------- lisp/emacs-lisp/shadow.el | 22 ++++--- lisp/emacs-lisp/tcover-ses.el | 32 ++++------ lisp/emacs-lisp/unsafep.el | 9 +-- 12 files changed, 143 insertions(+), 130 deletions(-) diff --git a/admin/notes/unicode b/admin/notes/unicode index d69d5418e26..bcede9c6ed1 100644 --- a/admin/notes/unicode +++ b/admin/notes/unicode @@ -267,6 +267,7 @@ nontrivial changes to the build process. lisp/language/tibetan.el lisp/leim/quail/ethiopic.el lisp/leim/quail/tibetan.el + lisp/international/titdic-cnv.el * binary files diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index 5f432b80bc2..0d9ba57d663 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -1,4 +1,4 @@ -;;; bindat.el --- binary data structure packing and unpacking. +;;; bindat.el --- binary data structure packing and unpacking. -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. @@ -198,7 +198,7 @@ (defun bindat--unpack-u8 () (prog1 - (aref bindat-raw bindat-idx) + (aref bindat-raw bindat-idx) (setq bindat-idx (1+ bindat-idx)))) (defun bindat--unpack-u16 () @@ -276,6 +276,8 @@ (t nil))) (defun bindat--unpack-group (spec) + (with-suppressed-warnings ((lexical last)) + (defvar last)) (let (struct last) (while spec (let* ((item (car spec)) @@ -287,11 +289,11 @@ data) (setq spec (cdr spec)) (if (and (consp field) (eq (car field) 'eval)) - (setq field (eval (car (cdr field))))) + (setq field (eval (car (cdr field)) t))) (if (and type (consp type) (eq (car type) 'eval)) - (setq type (eval (car (cdr type))))) + (setq type (eval (car (cdr type)) t))) (if (and len (consp len) (eq (car len) 'eval)) - (setq len (eval (car (cdr len))))) + (setq len (eval (car (cdr len)) t))) (if (memq field '(eval fill align struct union)) (setq tail 2 len type @@ -304,48 +306,51 @@ (cond ((eq type 'eval) (if field - (setq data (eval len)) - (eval len))) + (setq data (eval len t)) + (eval len t))) ((eq type 'fill) (setq bindat-idx (+ bindat-idx len))) ((eq type 'align) (while (/= (% bindat-idx len) 0) (setq bindat-idx (1+ bindat-idx)))) ((eq type 'struct) - (setq data (bindat--unpack-group (eval len)))) + (setq data (bindat--unpack-group (eval len t)))) ((eq type 'repeat) (let ((index 0) (count len)) (while (< index count) - (setq data (cons (bindat--unpack-group (nthcdr tail item)) data)) + (push (bindat--unpack-group (nthcdr tail item)) data) (setq index (1+ index))) (setq data (nreverse data)))) ((eq type 'union) + (with-suppressed-warnings ((lexical tag)) + (defvar tag)) (let ((tag len) (cases (nthcdr tail item)) case cc) (while cases (setq case (car cases) cases (cdr cases) cc (car case)) (if (or (equal cc tag) (equal cc t) - (and (consp cc) (eval cc))) + (and (consp cc) (eval cc t))) (setq data (bindat--unpack-group (cdr case)) cases nil))))) (t (setq data (bindat--unpack-item type len vectype) last data))) (if data - (if field - (setq struct (cons (cons field data) struct)) - (setq struct (append data struct)))))) + (setq struct (if field + (cons (cons field data) struct) + (append data struct)))))) struct)) -(defun bindat-unpack (spec bindat-raw &optional bindat-idx) - "Return structured data according to SPEC for binary data in BINDAT-RAW. -BINDAT-RAW is a unibyte string or vector. -Optional third arg BINDAT-IDX specifies the starting offset in BINDAT-RAW." - (when (multibyte-string-p bindat-raw) +(defun bindat-unpack (spec raw &optional idx) + "Return structured data according to SPEC for binary data in RAW. +RAW is a unibyte string or vector. +Optional third arg IDX specifies the starting offset in RAW." + (when (multibyte-string-p raw) (error "String is multibyte")) - (unless bindat-idx (setq bindat-idx 0)) - (bindat--unpack-group spec)) + (let ((bindat-idx (or idx 0)) + (bindat-raw raw)) + (bindat--unpack-group spec))) (defun bindat-get-field (struct &rest field) "In structured data STRUCT, return value of field named FIELD. @@ -373,6 +378,8 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (ip . 4))) (defun bindat--length-group (struct spec) + (with-suppressed-warnings ((lexical last)) + (defvar last)) (let (last) (while spec (let* ((item (car spec)) @@ -383,32 +390,31 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (tail 3)) (setq spec (cdr spec)) (if (and (consp field) (eq (car field) 'eval)) - (setq field (eval (car (cdr field))))) + (setq field (eval (car (cdr field)) t))) (if (and type (consp type) (eq (car type) 'eval)) - (setq type (eval (car (cdr type))))) + (setq type (eval (car (cdr type)) t))) (if (and len (consp len) (eq (car len) 'eval)) - (setq len (eval (car (cdr len))))) + (setq len (eval (car (cdr len)) t))) (if (memq field '(eval fill align struct union)) (setq tail 2 len type type field field nil)) (if (and (consp len) (not (eq type 'eval))) - (setq len (apply 'bindat-get-field struct len))) + (setq len (apply #'bindat-get-field struct len))) (if (not len) (setq len 1)) (while (eq type 'vec) - (let ((vlen 1)) - (if (consp vectype) - (setq len (* len (nth 1 vectype)) - type (nth 2 vectype)) - (setq type (or vectype 'u8) - vectype nil)))) + (if (consp vectype) + (setq len (* len (nth 1 vectype)) + type (nth 2 vectype)) + (setq type (or vectype 'u8) + vectype nil))) (cond ((eq type 'eval) (if field - (setq struct (cons (cons field (eval len)) struct)) - (eval len))) + (setq struct (cons (cons field (eval len t)) struct)) + (eval len t))) ((eq type 'fill) (setq bindat-idx (+ bindat-idx len))) ((eq type 'align) @@ -416,7 +422,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (setq bindat-idx (1+ bindat-idx)))) ((eq type 'struct) (bindat--length-group - (if field (bindat-get-field struct field) struct) (eval len))) + (if field (bindat-get-field struct field) struct) (eval len t))) ((eq type 'repeat) (let ((index 0) (count len)) (while (< index count) @@ -425,13 +431,15 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (nthcdr tail item)) (setq index (1+ index))))) ((eq type 'union) + (with-suppressed-warnings ((lexical tag)) + (defvar tag)) (let ((tag len) (cases (nthcdr tail item)) case cc) (while cases (setq case (car cases) cases (cdr cases) cc (car case)) (if (or (equal cc tag) (equal cc t) - (and (consp cc) (eval cc))) + (and (consp cc) (eval cc t))) (progn (bindat--length-group struct (cdr case)) (setq cases nil)))))) @@ -536,6 +544,8 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (setq bindat-idx (+ bindat-idx len))))) (defun bindat--pack-group (struct spec) + (with-suppressed-warnings ((lexical last)) + (defvar last)) (let (last) (while spec (let* ((item (car spec)) @@ -546,11 +556,11 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (tail 3)) (setq spec (cdr spec)) (if (and (consp field) (eq (car field) 'eval)) - (setq field (eval (car (cdr field))))) + (setq field (eval (car (cdr field)) t))) (if (and type (consp type) (eq (car type) 'eval)) - (setq type (eval (car (cdr type))))) + (setq type (eval (car (cdr type)) t))) (if (and len (consp len) (eq (car len) 'eval)) - (setq len (eval (car (cdr len))))) + (setq len (eval (car (cdr len)) t))) (if (memq field '(eval fill align struct union)) (setq tail 2 len type @@ -563,8 +573,8 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (cond ((eq type 'eval) (if field - (setq struct (cons (cons field (eval len)) struct)) - (eval len))) + (setq struct (cons (cons field (eval len t)) struct)) + (eval len t))) ((eq type 'fill) (setq bindat-idx (+ bindat-idx len))) ((eq type 'align) @@ -572,7 +582,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (setq bindat-idx (1+ bindat-idx)))) ((eq type 'struct) (bindat--pack-group - (if field (bindat-get-field struct field) struct) (eval len))) + (if field (bindat-get-field struct field) struct) (eval len t))) ((eq type 'repeat) (let ((index 0) (count len)) (while (< index count) @@ -581,13 +591,15 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (nthcdr tail item)) (setq index (1+ index))))) ((eq type 'union) + (with-suppressed-warnings ((lexical tag)) + (defvar tag)) (let ((tag len) (cases (nthcdr tail item)) case cc) (while cases (setq case (car cases) cases (cdr cases) cc (car case)) (if (or (equal cc tag) (equal cc t) - (and (consp cc) (eval cc))) + (and (consp cc) (eval cc t))) (progn (bindat--pack-group struct (cdr case)) (setq cases nil)))))) @@ -596,19 +608,19 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (bindat--pack-item last type len vectype) )))))) -(defun bindat-pack (spec struct &optional bindat-raw bindat-idx) +(defun bindat-pack (spec struct &optional raw idx) "Return binary data packed according to SPEC for structured data STRUCT. -Optional third arg BINDAT-RAW is a pre-allocated unibyte string or vector to +Optional third arg RAW is a pre-allocated unibyte string or vector to pack into. -Optional fourth arg BINDAT-IDX is the starting offset into BINDAT-RAW." - (when (multibyte-string-p bindat-raw) +Optional fourth arg IDX is the starting offset into RAW." + (when (multibyte-string-p raw) (error "Pre-allocated string is multibyte")) - (let ((no-return bindat-raw)) - (unless bindat-idx (setq bindat-idx 0)) - (unless bindat-raw - (setq bindat-raw (make-string (+ bindat-idx (bindat-length spec struct)) 0))) + (let* ((bindat-idx (or idx 0)) + (bindat-raw + (or raw + (make-string (+ bindat-idx (bindat-length spec struct)) 0)))) (bindat--pack-group struct spec) - (if no-return nil bindat-raw))) + (if raw nil bindat-raw))) ;; Misc. format conversions diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el index eb3193c8213..e106815817e 100644 --- a/lisp/emacs-lisp/crm.el +++ b/lisp/emacs-lisp/crm.el @@ -1,4 +1,4 @@ -;;; crm.el --- read multiple strings with completion +;;; crm.el --- read multiple strings with completion -*- lexical-binding: t; -*- ;; Copyright (C) 1985-1986, 1993-2021 Free Software Foundation, Inc. diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el index 42528429aaf..54528b2fb91 100644 --- a/lisp/emacs-lisp/derived.el +++ b/lisp/emacs-lisp/derived.el @@ -1,4 +1,4 @@ -;;; derived.el --- allow inheritance of major modes +;;; derived.el --- allow inheritance of major modes -*- lexical-binding: t; -*- ;; (formerly mode-clone.el) ;; Copyright (C) 1993-1994, 1999, 2001-2021 Free Software Foundation, diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el index edf4d34b649..e65f424cbab 100644 --- a/lisp/emacs-lisp/eieio-opt.el +++ b/lisp/emacs-lisp/eieio-opt.el @@ -1,4 +1,4 @@ -;;; eieio-opt.el -- eieio optional functions (debug, printing, speedbar) +;;; eieio-opt.el -- eieio optional functions (debug, printing, speedbar) -*- lexical-binding: t; -*- ;; Copyright (C) 1996, 1998-2003, 2005, 2008-2021 Free Software ;; Foundation, Inc. diff --git a/lisp/emacs-lisp/generic.el b/lisp/emacs-lisp/generic.el index 93f780eac2f..6db1bbbb224 100644 --- a/lisp/emacs-lisp/generic.el +++ b/lisp/emacs-lisp/generic.el @@ -1,4 +1,4 @@ -;;; generic.el --- defining simple major modes with comment and font-lock +;;; generic.el --- defining simple major modes with comment and font-lock -*- lexical-binding: t; -*- ;; ;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc. ;; @@ -245,7 +245,6 @@ Some generic modes are defined in `generic-x.el'." "Set up comment functionality for generic mode." (let ((chars nil) (comstyles) - (comstyle "") (comment-start nil)) ;; Go through all the comments. @@ -269,14 +268,16 @@ Some generic modes are defined in `generic-x.el'." ;; Store the relevant info but don't update yet. (push (cons c0 (concat (cdr (assoc c0 chars)) "1")) chars) (push (cons c1 (concat (cdr (assoc c1 chars)) - (concat "2" comstyle))) chars))) + (concat "2" comstyle))) + chars))) (if (= (length end) 1) (modify-syntax-entry (aref end 0) (concat ">" comstyle) st) (let ((c0 (aref end 0)) (c1 (aref end 1))) ;; Store the relevant info but don't update yet. (push (cons c0 (concat (cdr (assoc c0 chars)) - (concat "3" comstyle))) chars) + (concat "3" comstyle))) + chars) (push (cons c1 (concat (cdr (assoc c1 chars)) "4")) chars))))) ;; Process the chars that were part of a 2-char comment marker diff --git a/lisp/emacs-lisp/helper.el b/lisp/emacs-lisp/helper.el index 737f3ec2f33..a5f21a55924 100644 --- a/lisp/emacs-lisp/helper.el +++ b/lisp/emacs-lisp/helper.el @@ -1,4 +1,4 @@ -;;; helper.el --- utility help package supporting help in electric modes +;;; helper.el --- utility help package supporting help in electric modes -*- lexical-binding: t; -*- ;; Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc. @@ -39,20 +39,19 @@ ;; keymap either. -(defvar Helper-help-map nil) -(if Helper-help-map - nil - (setq Helper-help-map (make-keymap)) - ;(fillarray Helper-help-map 'undefined) - (define-key Helper-help-map "m" 'Helper-describe-mode) - (define-key Helper-help-map "b" 'Helper-describe-bindings) - (define-key Helper-help-map "c" 'Helper-describe-key-briefly) - (define-key Helper-help-map "k" 'Helper-describe-key) - ;(define-key Helper-help-map "f" 'Helper-describe-function) - ;(define-key Helper-help-map "v" 'Helper-describe-variable) - (define-key Helper-help-map "?" 'Helper-help-options) - (define-key Helper-help-map (char-to-string help-char) 'Helper-help-options) - (fset 'Helper-help-map Helper-help-map)) +(defvar Helper-help-map + (let ((map (make-sparse-keymap))) + ;(fillarray map 'undefined) + (define-key map "m" 'Helper-describe-mode) + (define-key map "b" 'Helper-describe-bindings) + (define-key map "c" 'Helper-describe-key-briefly) + (define-key map "k" 'Helper-describe-key) + ;(define-key map "f" 'Helper-describe-function) + ;(define-key map "v" 'Helper-describe-variable) + (define-key map "?" 'Helper-help-options) + (define-key map (char-to-string help-char) 'Helper-help-options) + (fset 'Helper-help-map map) + map)) (defun Helper-help-scroller () (let ((blurb (or (and (boundp 'Helper-return-blurb) diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el index 8a0853ce445..b723643ffb9 100644 --- a/lisp/emacs-lisp/package-x.el +++ b/lisp/emacs-lisp/package-x.el @@ -1,4 +1,4 @@ -;;; package-x.el --- Package extras +;;; package-x.el --- Package extras -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. diff --git a/lisp/emacs-lisp/regi.el b/lisp/emacs-lisp/regi.el index 38b202fa101..527af1ddf24 100644 --- a/lisp/emacs-lisp/regi.el +++ b/lisp/emacs-lisp/regi.el @@ -1,4 +1,4 @@ -;;; regi.el --- REGular expression Interpreting engine +;;; regi.el --- REGular expression Interpreting engine -*- lexical-binding: t; -*- ;; Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc. @@ -153,7 +153,7 @@ useful information: ;; set up the narrowed region (and start end - (let* ((tstart start) + (let* (;; (tstart start) (start (min start end)) (end (max start end))) (narrow-to-region @@ -206,30 +206,33 @@ useful information: ;; if the line matched, package up the argument list and ;; funcall the FUNC (if match-p - (let* ((curline (buffer-substring - (regi-pos 'bol) - (regi-pos 'eol))) - (curframe current-frame) - (curentry entry) - (result (eval func)) - (step (or (cdr (assq 'step result)) 1)) - ) - ;; changing frame on the fly? - (if (assq 'frame result) - (setq working-frame (cdr (assq 'frame result)))) + (with-suppressed-warnings + ((lexical curframe curentry curline)) + (defvar curframe) (defvar curentry) (defvar curline) + (let* ((curline (buffer-substring + (regi-pos 'bol) + (regi-pos 'eol))) + (curframe current-frame) + (curentry entry) + (result (eval func)) + (step (or (cdr (assq 'step result)) 1)) + ) + ;; changing frame on the fly? + (if (assq 'frame result) + (setq working-frame (cdr (assq 'frame result)))) - ;; continue processing current frame? - (if (memq 'continue result) - (setq current-frame (cdr current-frame)) - (forward-line step) - (setq current-frame working-frame)) + ;; continue processing current frame? + (if (memq 'continue result) + (setq current-frame (cdr current-frame)) + (forward-line step) + (setq current-frame working-frame)) - ;; abort current frame? - (if (memq 'abort result) - (progn - (setq donep t) - (throw 'regi-throw-top t))) - ) ; end-let + ;; abort current frame? + (if (memq 'abort result) + (progn + (setq donep t) + (throw 'regi-throw-top t))) + )) ; end-let ;; else if no match occurred, then process the next ;; frame-entry on the current line diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el index 168e5e46f37..c1d05941239 100644 --- a/lisp/emacs-lisp/shadow.el +++ b/lisp/emacs-lisp/shadow.el @@ -1,4 +1,4 @@ -;;; shadow.el --- locate Emacs Lisp file shadowings +;;; shadow.el --- locate Emacs Lisp file shadowings -*- lexical-binding: t; -*- ;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc. @@ -58,8 +58,7 @@ (defcustom load-path-shadows-compare-text nil "If non-nil, then shadowing files are reported only if their text differs. This is slower, but filters out some innocuous shadowing." - :type 'boolean - :group 'lisp-shadow) + :type 'boolean) (defun load-path-shadows-find (&optional path) "Return a list of Emacs Lisp files that create shadows. @@ -78,8 +77,7 @@ See the documentation for `list-load-path-shadows' for further information." dir-case-insensitive ; `file-name-case-insensitive-p' of dir. curr-files ; This dir's Emacs Lisp files. orig-dir ; Where the file was first seen. - files-seen-this-dir ; Files seen so far in this dir. - file) ; The current file. + files-seen-this-dir) ; Files seen so far in this dir. (dolist (pp (or path load-path)) (setq dir (directory-file-name (file-truename (or pp ".")))) (if (member dir true-names) @@ -109,7 +107,7 @@ See the documentation for `list-load-path-shadows' for further information." (dolist (file curr-files) - (if (string-match "\\.gz$" file) + (if (string-match "\\.gz\\'" file) (setq file (substring file 0 -3))) (setq file (substring file 0 (if (string= (substring file -1) "c") -4 -3))) @@ -125,9 +123,13 @@ See the documentation for `list-load-path-shadows' for further information." ;; XXX.elc (or vice-versa) when they are in the same directory. (setq files-seen-this-dir (cons file files-seen-this-dir)) - (if (setq orig-dir (assoc file files - (when dir-case-insensitive - (lambda (f1 f2) (eq (compare-strings f1 nil nil f2 nil nil t) t))))) + (if (setq orig-dir + (assoc file files + (when dir-case-insensitive + (lambda (f1 f2) + (eq (compare-strings f1 nil nil + f2 nil nil t) + t))))) ;; This file was seen before, we have a shadowing. ;; Report it unless the files are identical. (let ((base1 (concat (cdr orig-dir) "/" (car orig-dir))) @@ -142,7 +144,7 @@ See the documentation for `list-load-path-shadows' for further information." (append shadows (list base1 base2))))) ;; Not seen before, add it to the list of seen files. - (setq files (cons (cons file dir) files))))))) + (push (cons file dir) files)))))) ;; Return the list of shadowings. shadows)) diff --git a/lisp/emacs-lisp/tcover-ses.el b/lisp/emacs-lisp/tcover-ses.el index 7de9d547ce4..fb9cd8f47df 100644 --- a/lisp/emacs-lisp/tcover-ses.el +++ b/lisp/emacs-lisp/tcover-ses.el @@ -1,4 +1,4 @@ -;;;; testcover-ses.el -- Example use of `testcover' to test "SES" +;;;; testcover-ses.el -- Example use of `testcover' to test "SES" -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. @@ -19,21 +19,14 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + +;; FIXME: Convert to ERT and move to `test/'? + +;;; Code: + (require 'testcover) - -(defvar ses-initial-global-parameters) -(defvar ses-mode-map) - -(declare-function ses-set-curcell "ses") -(declare-function ses-update-cells "ses") -(declare-function ses-load "ses") -(declare-function ses-vector-delete "ses") -(declare-function ses-create-header-string "ses") -(declare-function ses-read-cell "ses") -(declare-function ses-read-symbol "ses") -(declare-function ses-command-hook "ses") -(declare-function ses-jump "ses") - +(require 'ses) ;;;Here are some macros that exercise SES. Set `pause' to t if you want the ;;;macros to pause after each step. @@ -652,6 +645,7 @@ spreadsheet files with invalid formatting." (testcover-start "ses.el" t)) (require 'unsafep)) ;In case user has safe-functions = t! +(defvar ses--curcell-overlay) ;;;######################################################################### (defun ses-exercise () @@ -674,8 +668,8 @@ spreadsheet files with invalid formatting." (ses-load)) ;;ses-vector-delete is always called from buffer-undo-list with the same ;;symbol as argument. We'll give it a different one here. - (let ((x [1 2 3])) - (ses-vector-delete 'x 0 0)) + (dlet ((tcover-ses--x [1 2 3])) + (ses-vector-delete 'tcover-ses--x 0 0)) ;;ses-create-header-string behaves differently in a non-window environment ;;but we always test under windows. (let ((window-system (not window-system))) @@ -704,7 +698,7 @@ spreadsheet files with invalid formatting." (ses-mode))))) ;;Test error-handling in command hook, outside a macro. ;;This will ring the bell. - (let (curcell-overlay) + (let (ses--curcell-overlay) (ses-command-hook)) ;;Due to use of run-with-timer, ses-command-hook sometimes gets called ;;after we switch to another buffer. @@ -720,4 +714,4 @@ spreadsheet files with invalid formatting." ;;Could do this here: (testcover-end "ses.el") (message "Done")) -;; testcover-ses.el ends here. +;;; testcover-ses.el ends here. diff --git a/lisp/emacs-lisp/unsafep.el b/lisp/emacs-lisp/unsafep.el index f46d9c77eae..d52a6c796db 100644 --- a/lisp/emacs-lisp/unsafep.el +++ b/lisp/emacs-lisp/unsafep.el @@ -1,4 +1,4 @@ -;;;; unsafep.el -- Determine whether a Lisp form is safe to evaluate +;;;; unsafep.el -- Determine whether a Lisp form is safe to evaluate -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. @@ -129,15 +129,16 @@ in the parse.") (put x 'safe-function t)) ;;;###autoload -(defun unsafep (form &optional unsafep-vars) +(defun unsafep (form &optional vars) "Return nil if evaluating FORM couldn't possibly do any harm. Otherwise result is a reason why FORM is unsafe. -UNSAFEP-VARS is a list of symbols with local bindings." +VARS is a list of symbols with local bindings like `unsafep-vars'." (catch 'unsafep (if (or (eq safe-functions t) ;User turned off safety-checking (atom form)) ;Atoms are never unsafe (throw 'unsafep nil)) - (let* ((fun (car form)) + (let* ((unsafep-vars vars) + (fun (car form)) (reason (unsafep-function fun)) arg) (cond From 11c504c9d2742cd7b19a2ed188b6545c9e86d206 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 21:28:03 +0100 Subject: [PATCH 069/107] Define compat alias obsolete * lisp/generic-x.el (generic-mode-ini-file-find-file-hook): Define compat alias introduced after rename in 22.1 obsolete. --- lisp/generic-x.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/generic-x.el b/lisp/generic-x.el index bd03f287fc7..0063cb73b3b 100644 --- a/lisp/generic-x.el +++ b/lisp/generic-x.el @@ -416,7 +416,8 @@ like an INI file. You can add this hook to `find-file-hook'." (goto-char (point-min)) (and (looking-at "^\\s-*\\[.*\\]") (ini-generic-mode))))) -(defalias 'generic-mode-ini-file-find-file-hook 'ini-generic-mode-find-file-hook)) +(define-obsolete-function-alias 'generic-mode-ini-file-find-file-hook + #'ini-generic-mode-find-file-hook "28.1")) ;;; Windows REG files ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax! From 554ec932ba37e0191df33959abaec9e1bfdaa891 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 21:35:34 +0100 Subject: [PATCH 070/107] Use lexical-binding in generic-x.el * lisp/generic-x.el: Use lexical-binding. Remove redundant :groups. (generic-rul-mode-setup-function): Prefer setq-local. --- lisp/generic-x.el | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/lisp/generic-x.el b/lisp/generic-x.el index 0063cb73b3b..be8d41bde00 100644 --- a/lisp/generic-x.el +++ b/lisp/generic-x.el @@ -1,4 +1,4 @@ -;;; generic-x.el --- A collection of generic modes +;;; generic-x.el --- A collection of generic modes -*- lexical-binding: t -*- ;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc. @@ -121,14 +121,12 @@ "If non-nil, add a hook to enter `default-generic-mode' automatically. This is done if the first few lines of a file in fundamental mode start with a hash comment character." - :group 'generic-x :type 'boolean) (defcustom generic-lines-to-scan 3 "Number of lines that `generic-mode-find-file-hook' looks at. Relevant when deciding whether to enter Default-Generic mode automatically. This variable should be set to a small positive number." - :group 'generic-x :type 'integer) (defcustom generic-find-file-regexp "^#" @@ -137,7 +135,6 @@ Files in fundamental mode whose first few lines contain a match for this regexp, should be put into Default-Generic mode instead. The number of lines tested for the matches is specified by the value of the variable `generic-lines-to-scan', which see." - :group 'generic-x :type 'regexp) (defcustom generic-ignore-files-regexp "[Tt][Aa][Gg][Ss]\\'" @@ -146,7 +143,6 @@ Files whose names match this regular expression should not be put into Default-Generic mode, even if they have lines which match the regexp in `generic-find-file-regexp'. If the value is nil, `generic-mode-find-file-hook' does not check the file names." - :group 'generic-x :type '(choice (const :tag "Don't check file names" nil) regexp)) ;; This generic mode is always defined @@ -249,7 +245,6 @@ This hook will be installed if the variable Each entry in the list should be a symbol. If you set this variable directly, without using customize, you must reload generic-x to put your changes into effect." - :group 'generic-x :type (let (list) (dolist (mode (sort (append generic-default-modes @@ -1298,19 +1293,16 @@ like an INI file. You can add this hook to `find-file-hook'." ;; here manually instead (defun generic-rul-mode-setup-function () - (make-local-variable 'parse-sexp-ignore-comments) - (make-local-variable 'comment-start) (make-local-variable 'comment-start-skip) - (make-local-variable 'comment-end) (setq imenu-generic-expression - '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)) - parse-sexp-ignore-comments t - comment-end "*/" - comment-start "/*" -;;; comment-end "" -;;; comment-start "//" -;;; comment-start-skip "" - ) + '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))) + (setq-local parse-sexp-ignore-comments t + comment-end "*/" + comment-start "/*" +;;; comment-end "" +;;; comment-start "//" +;;; comment-start-skip "" + ) ;; (set-syntax-table rul-generic-mode-syntax-table) (setq-local font-lock-syntax-table rul-generic-mode-syntax-table)) @@ -1460,7 +1452,7 @@ like an INI file. You can add this hook to `find-file-hook'." ":" ;; Password, UID and GID (mapconcat - 'identity + #'identity (make-list 3 "\\([^:]+\\)") ":") ":" @@ -1640,8 +1632,7 @@ like an INI file. You can add this hook to `find-file-hook'." (((class color) (min-colors 88)) (:background "red1")) (((class color)) (:background "red")) (t (:weight bold))) - "Font Lock mode face used to highlight TABs." - :group 'generic-x) + "Font Lock mode face used to highlight TABs.") (defface show-tabs-space '((((class grayscale) (background light)) (:background "DimGray" :weight bold)) @@ -1649,8 +1640,7 @@ like an INI file. You can add this hook to `find-file-hook'." (((class color) (min-colors 88)) (:background "yellow1")) (((class color)) (:background "yellow")) (t (:weight bold))) - "Font Lock mode face used to highlight spaces." - :group 'generic-x) + "Font Lock mode face used to highlight spaces.") (define-generic-mode show-tabs-generic-mode nil ;; no comment char From ae7fe263b28cc87f5d8c8770b7d321ff436a12bb Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 21:55:31 +0100 Subject: [PATCH 071/107] ; Fix my previous commit * lisp/generic-x.el (generic-mode-ini-file-find-file-hook): Fix my previous commit; for some reason 'function' produces a warning here while 'quote' does not. --- lisp/generic-x.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/generic-x.el b/lisp/generic-x.el index be8d41bde00..4c6e1189003 100644 --- a/lisp/generic-x.el +++ b/lisp/generic-x.el @@ -412,7 +412,7 @@ like an INI file. You can add this hook to `find-file-hook'." (and (looking-at "^\\s-*\\[.*\\]") (ini-generic-mode))))) (define-obsolete-function-alias 'generic-mode-ini-file-find-file-hook - #'ini-generic-mode-find-file-hook "28.1")) + 'ini-generic-mode-find-file-hook "28.1")) ;;; Windows REG files ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax! From a50fe43337eef4b287784527f33cceab4f9ab30c Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 21:45:26 +0100 Subject: [PATCH 072/107] * lisp/progmodes/bat-mode.el: Use lexical-binding. --- lisp/progmodes/bat-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el index 44295c3f679..7ba8a69775e 100644 --- a/lisp/progmodes/bat-mode.el +++ b/lisp/progmodes/bat-mode.el @@ -1,4 +1,4 @@ -;;; bat-mode.el --- Major mode for editing DOS/Windows scripts +;;; bat-mode.el --- Major mode for editing DOS/Windows scripts -*- lexical-binding: t -*- ;; Copyright (C) 2003, 2008-2021 Free Software Foundation, Inc. From cb97581870cb1e3c211e4cead5f14f6cb67e4c8f Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 28 Jan 2021 22:06:35 +0100 Subject: [PATCH 073/107] Use lexical-binding in nroff-mode.el * lisp/textmodes/nroff-mode.el: Use lexical-binding. Remove redundant :group args. --- lisp/textmodes/nroff-mode.el | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el index 896578513cf..fe70e925b05 100644 --- a/lisp/textmodes/nroff-mode.el +++ b/lisp/textmodes/nroff-mode.el @@ -1,4 +1,4 @@ -;;; nroff-mode.el --- GNU Emacs major mode for editing nroff source +;;; nroff-mode.el --- GNU Emacs major mode for editing nroff source -*- lexical-binding: t -*- ;; Copyright (C) 1985-1986, 1994-1995, 1997, 2001-2021 Free Software ;; Foundation, Inc. @@ -43,7 +43,6 @@ (defcustom nroff-electric-mode nil "Non-nil means automatically closing requests when you insert an open." - :group 'nroff :type 'boolean) (defvar nroff-mode-map @@ -111,7 +110,7 @@ ;; arguments in common cases, like \f. (concat "\\\\" ; backslash "\\(" ; followed by various possibilities - (mapconcat 'identity + (mapconcat #'identity '("[f*n]*\\[.+?]" ; some groff extensions "(.." ; two chars after ( "[^(\"#]" ; single char escape @@ -119,13 +118,11 @@ "\\)") ) "Font-lock highlighting control in `nroff-mode'." - :group 'nroff :type '(repeat regexp)) (defcustom nroff-mode-hook nil "Hook run by function `nroff-mode'." - :type 'hook - :group 'nroff) + :type 'hook) ;;;###autoload (define-derived-mode nroff-mode text-mode "Nroff" From 3ddea271cc9542e29829629991a4073ab3cf5db9 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 29 Jan 2021 05:52:51 +0100 Subject: [PATCH 074/107] Slight gravatar.el code clean up * lisp/image/gravatar.el (gravatar--service-libravatar): Clean the code up slightly. --- lisp/image/gravatar.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el index b1e2a314ce8..f6f056a2baf 100644 --- a/lisp/image/gravatar.el +++ b/lisp/image/gravatar.el @@ -167,13 +167,12 @@ to track whether you're reading a specific mail." ;; ignore). (and (eq (dns-get 'type answers) 'SRV) answers))) - (priorities (and (mapcar (lambda (r) - (dns-get 'priority r)) - data))) - (max-priority (if priorities - (apply #'max priorities) - 0)) - (sum 0) top) + (priorities (mapcar (lambda (r) + (dns-get 'priority r)) + data)) + (max-priority (apply #'max 0 priorities)) + (sum 0) + top) ;; Attempt to find all records with the same maximal ;; priority, and calculate the sum of their weights. (dolist (ent data) From bab133e6d0bff03e5ddd7f43eca169f4843d5860 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 29 Jan 2021 02:47:38 +0100 Subject: [PATCH 075/107] Use lexical-binding in find-cmd.el and add tests * lisp/find-cmd.el: Use lexical-binding. * test/lisp/find-cmd-tests.el: New file. --- lisp/find-cmd.el | 4 ++-- test/lisp/find-cmd-tests.el | 45 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 test/lisp/find-cmd-tests.el diff --git a/lisp/find-cmd.el b/lisp/find-cmd.el index 5866b308551..bb2e97d8662 100644 --- a/lisp/find-cmd.el +++ b/lisp/find-cmd.el @@ -1,4 +1,4 @@ -;;; find-cmd.el --- Build a valid find(1) command with sexps +;;; find-cmd.el --- Build a valid find(1) command with sexps -*- lexical-binding: t -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -28,7 +28,7 @@ ;; (find-cmd '(prune (name ".svn" ".git" ".CVS")) ;; '(and (or (name "*.pl" "*.pm" "*.t") ;; (mtime "+1")) -;; (fstype "nfs" "ufs")))) +;; (fstype "nfs" "ufs"))) ;; will become (un-wrapped): diff --git a/test/lisp/find-cmd-tests.el b/test/lisp/find-cmd-tests.el new file mode 100644 index 00000000000..b8e0f273988 --- /dev/null +++ b/test/lisp/find-cmd-tests.el @@ -0,0 +1,45 @@ +;;; find-cmd-tests.el --- tests for find-cmd.el. -*- lexical-binding: t -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(require 'find-cmd) + +(ert-deftest find-cmd-test-find-cmd () + (should + (string-match + (rx "find " (+ any) + " \\( \\( -name .svn -or -name .git -or -name .CVS \\)" + " -prune -or -true \\)" + " \\( \\( \\(" " -name \\*.pl -or -name \\*.pm -or -name \\*.t \\)" + " -or -mtime \\+1 \\) -and \\( -fstype nfs -or -fstype ufs \\) \\) ") + (find-cmd '(prune (name ".svn" ".git" ".CVS")) + '(and (or (name "*.pl" "*.pm" "*.t") + (mtime "+1")) + (fstype "nfs" "ufs")))))) + +(ert-deftest find-cmd-test-find-cmd/error-unknown-atom () + (should-error (find-cmd '(unknown 123)))) + +(ert-deftest find-cmd-test-find-cmd/error-wrong-argnum () + (should-error (find-cmd '(name)))) + +(provide 'find-cmd-tests) +;;; find-cmd-tests.el ends here From a27512e21c710ab39a0b811701a952db482204c1 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 29 Jan 2021 02:55:34 +0100 Subject: [PATCH 076/107] * lisp/flow-ctrl.el: Use lexical-binding. * lisp/flow-ctrl.el (enable-flow-control): Minor cleanup. --- lisp/flow-ctrl.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lisp/flow-ctrl.el b/lisp/flow-ctrl.el index 656edf2eb09..adb52d7253a 100644 --- a/lisp/flow-ctrl.el +++ b/lisp/flow-ctrl.el @@ -1,4 +1,4 @@ -;;; flow-ctrl.el --- help for lusers on cu(1) or ttys with wired-in ^S/^Q flow control +;;; flow-ctrl.el --- help for lusers on cu(1) or ttys with wired-in ^S/^Q flow control -*- lexical-binding: t -*- ;; Copyright (C) 1990-1991, 1994, 2001-2021 Free Software Foundation, ;; Inc. @@ -64,12 +64,11 @@ With arg, enable flow control mode if arg is positive, otherwise disable." (progn ;; Turn flow control off, and stop exchanging chars. (set-input-mode t nil (nth 2 (current-input-mode))) - (if keyboard-translate-table - (progn - (aset keyboard-translate-table flow-control-c-s-replacement nil) - (aset keyboard-translate-table ?\^s nil) - (aset keyboard-translate-table flow-control-c-q-replacement nil) - (aset keyboard-translate-table ?\^q nil)))) + (when keyboard-translate-table + (aset keyboard-translate-table flow-control-c-s-replacement nil) + (aset keyboard-translate-table ?\^s nil) + (aset keyboard-translate-table flow-control-c-q-replacement nil) + (aset keyboard-translate-table ?\^q nil))) ;; Turn flow control on. ;; Tell emacs to pass C-s and C-q to OS. (set-input-mode nil t (nth 2 (current-input-mode))) From e52f2ec968a73a3f29939cf62d67a5ffe811ee09 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 29 Jan 2021 04:43:57 +0100 Subject: [PATCH 077/107] Remove Emacs 21 compat code from sasl.el * lisp/net/sasl.el (sasl-read-passphrase): Remove compat code; 'read-passwd' is preloaded since Emacs 22. --- lisp/net/sasl.el | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lisp/net/sasl.el b/lisp/net/sasl.el index 7f0431afb60..d2e08f7e3ed 100644 --- a/lisp/net/sasl.el +++ b/lisp/net/sasl.el @@ -161,15 +161,8 @@ the current challenge. At the first time STEP should be set to nil." (if function (vector function (funcall function client step))))) -(defvar sasl-read-passphrase nil) +(defvar sasl-read-passphrase 'read-passwd) (defun sasl-read-passphrase (prompt) - (if (not sasl-read-passphrase) - (if (functionp 'read-passwd) - (setq sasl-read-passphrase 'read-passwd) - (if (load "passwd" t) - (setq sasl-read-passphrase 'read-passwd) - (autoload 'ange-ftp-read-passwd "ange-ftp") - (setq sasl-read-passphrase 'ange-ftp-read-passwd)))) (funcall sasl-read-passphrase prompt)) (defun sasl-unique-id () From de51d94721efb90b153d70dc15691c16d0fbb46a Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 29 Jan 2021 06:46:14 +0100 Subject: [PATCH 078/107] Mention using buffer-list-update-hook in recentf-mode * lisp/recentf.el (recentf-mode): Mention using `buffer-list-update-hook' (bug#46153). --- lisp/recentf.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/recentf.el b/lisp/recentf.el index a28a3977a76..d39a523289f 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el @@ -1352,7 +1352,14 @@ That is, remove duplicates, non-kept, and excluded files." When Recentf mode is enabled, a \"Open Recent\" submenu is displayed in the \"File\" menu, containing a list of files that -were operated on recently, in the most-recently-used order." +were operated on recently, in the most-recently-used order. + +By default, only operations like opening a file, writing a buffer +to a file, and killing a buffer is counted as \"operating\" on +the file. If instead you want to prioritize files that appear in +buffers you switch to a lot, you can say something like the following: + + (add-hook 'buffer-list-update-hook 'recentf-track-opened-file)" :global t :group 'recentf :keymap recentf-mode-map From 5f650422e4a4c44ffc5ee0be4ec969765a307c7b Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 29 Jan 2021 06:50:38 +0100 Subject: [PATCH 079/107] Set revert-buffer-function in shell command output buffers * simple.el (shell-command, shell-command-on-region): Set revert-buffer-function in shell command output buffers (bug#46151). --- lisp/simple.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/simple.el b/lisp/simple.el index e82b138b0da..64ee0421356 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3991,6 +3991,9 @@ impose the use of a shell (with its need to quote arguments)." (start-process-shell-command "Shell" buffer command))) (setq mode-line-process '(":%s")) (shell-mode) + (setq revert-buffer-function + (lambda (&rest _) + (async-shell-command command (current-buffer)))) (set-process-sentinel proc #'shell-command-sentinel) ;; Use the comint filter for proper handling of ;; carriage motion (see comint-inhibit-carriage-motion). @@ -4257,6 +4260,9 @@ characters." buffer)))) ;; Report the output. (with-current-buffer buffer + (setq revert-buffer-function + (lambda (&rest _) + (shell-command command))) (setq mode-line-process (cond ((null exit-status) " - Error") From 0b80935d37f4a089ee7e925e246622dcd4b1addb Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 29 Jan 2021 07:04:43 +0100 Subject: [PATCH 080/107] Fix position in empty buffers in checkdoc-file-comments-engine * lisp/emacs-lisp/checkdoc.el (checkdoc-file-comments-engine): Don't give invalid positions on empty buffers (bug#39987). --- lisp/emacs-lisp/checkdoc.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 76638ec13b1..9722792a5a5 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2362,7 +2362,9 @@ Code:, and others referenced in the style guide." (checkdoc-create-error (format "The footer should be: (provide '%s)\\n;;; %s%s ends here" fn fn fe) - (1- (point-max)) (point-max))))) + ;; The buffer may be empty. + (max (point-min) (1- (point-max))) + (point-max))))) err)) ;; The below checks will not return errors if the user says NO From 9fb859010fa624f4b63ad4a1a8ba22a0f64f16f2 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 29 Jan 2021 07:15:35 +0100 Subject: [PATCH 081/107] flymake-diagnostic-beg/end doc string and error reporting improvement * lisp/progmodes/flymake.el (flymake-diagnostic-beg): (flymake-diagnostic-end): Improve doc string and error reporting (bug#39971). --- lisp/progmodes/flymake.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 460af718aad..5d96c62b418 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -352,12 +352,20 @@ diagnostics at BEG." (flymake--diag-accessor flymake-diagnostic-data flymake--diag-data backend) (defun flymake-diagnostic-beg (diag) - "Get Flymake diagnostic DIAG's start position." - (overlay-start (flymake--diag-overlay diag))) + "Get Flymake diagnostic DIAG's start position. +This position only be queried after DIAG has been reported to Flymake." + (let ((overlay (flymake--diag-overlay diag))) + (unless overlay + (error "DIAG %s not reported to Flymake yet" diag)) + (overlay-start overlay))) (defun flymake-diagnostic-end (diag) - "Get Flymake diagnostic DIAG's end position." - (overlay-end (flymake--diag-overlay diag))) + "Get Flymake diagnostic DIAG's end position. +This position only be queried after DIAG has been reported to Flymake." + (let ((overlay (flymake--diag-overlay diag))) + (unless overlay + (error "DIAG %s not reported to Flymake yet" diag)) + (overlay-end overlay))) (cl-defun flymake--overlays (&key beg end filter compare key) "Get flymake-related overlays. From 3f92d0093246c6f17f04f97282f95c81a398ea30 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 29 Jan 2021 07:22:14 +0100 Subject: [PATCH 082/107] operating-system-release doc string improvement * src/editfns.c (syms_of_editfns): Be more precise about what `operating-system-release' is (bug#39940). --- src/editfns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editfns.c b/src/editfns.c index 6f04c998915..3b2876f01e8 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4479,7 +4479,7 @@ functions if all the text being accessed has this property. */); doc: /* The user's name, based upon the real uid only. */); DEFVAR_LISP ("operating-system-release", Voperating_system_release, - doc: /* The release of the operating system Emacs is running on. */); + doc: /* The operating system kernel version Emacs is running on. */); DEFVAR_BOOL ("binary-as-unsigned", binary_as_unsigned, From 1275dc4711af77c9c223063dcd149d782d497463 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 29 Jan 2021 07:40:06 +0100 Subject: [PATCH 083/107] Improve fontifying of #| ... |# in `lisp-mode' * lisp/emacs-lisp/lisp-mode.el (lisp-mode): Fontify the end delimiter in #| ... |# correctly (bug#39820). --- lisp/emacs-lisp/lisp-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index c96d849d442..3918fa01b2a 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -775,6 +775,7 @@ or to switch back to an existing one." (setq-local find-tag-default-function 'lisp-find-tag-default) (setq-local comment-start-skip "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") + (setq-local comment-end "|#") (setq imenu-case-fold-search t)) (defun lisp-find-tag-default () From d4e9d191aeba9076db06857a90649f6fcddc7f3b Mon Sep 17 00:00:00 2001 From: Marco Wahl Date: Fri, 29 Jan 2021 08:01:12 +0100 Subject: [PATCH 084/107] Add a command for redisplay during keyboard macros * doc/emacs/kmacro.texi (Basic Keyboard Macro): Document it (bug#39252). * lisp/kmacro.el (kdb-macro-redisplay): New function. (kmacro-keymap): Bind it. --- doc/emacs/kmacro.texi | 8 ++++++++ etc/NEWS | 3 +++ lisp/kmacro.el | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/doc/emacs/kmacro.texi b/doc/emacs/kmacro.texi index adb2ab8d561..e713c6ef8c0 100644 --- a/doc/emacs/kmacro.texi +++ b/doc/emacs/kmacro.texi @@ -179,6 +179,14 @@ itself counts as the first repetition, since it is executed as you define it, so @kbd{C-u 4 C-x )} executes the macro immediately 3 additional times. +@findex kdb-macro-redisplay +@kindex C-x C-k Q + While executing a long-running keyboard macro, it can sometimes be +useful to trigger a redisplay (to show how far we've gotten). The +@kbd{C-x C-k Q} can be used for this. As a not very useful example, +@kbd{C-x ( M-f C-x C-k Q C-x )} will create a macro that will +redisplay once per iteration when saying @kbd{C-u 42 C-x e}. + @node Keyboard Macro Ring @section The Keyboard Macro Ring diff --git a/etc/NEWS b/etc/NEWS index f12c94d6491..8e233f8f196 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1577,6 +1577,9 @@ This allows mode-specific alterations to how `thing-at-point' works. ** Miscellaneous ++++ +*** New command `C-x C-k Q' to force redisplay in keyboard macros. + --- *** New user option 'remember-diary-regexp'. diff --git a/lisp/kmacro.el b/lisp/kmacro.el index bb8dacf4f48..303f38a59b6 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -172,6 +172,7 @@ macro to be executed before appending to it." (define-key map "\C-k" 'kmacro-end-or-call-macro-repeat) (define-key map "r" 'apply-macro-to-region-lines) (define-key map "q" 'kbd-macro-query) ;; Like C-x q + (define-key map "Q" 'kdb-macro-redisplay) ;; macro ring (define-key map "\C-n" 'kmacro-cycle-ring-next) @@ -1298,6 +1299,16 @@ To customize possible responses, change the \"bindings\" in (kmacro-push-ring) (setq last-kbd-macro kmacro-step-edit-new-macro)))) +(defun kdb-macro-redisplay () + "Force redisplay during kbd macro execution." + (interactive) + (or executing-kbd-macro + defining-kbd-macro + (user-error "Not defining or executing kbd macro")) + (when executing-kbd-macro + (let ((executing-kbd-macro nil)) + (redisplay)))) + (provide 'kmacro) ;;; kmacro.el ends here From 4e27a260e5886ee9f51877c4e66306e411c195e1 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 29 Jan 2021 08:16:04 +0100 Subject: [PATCH 085/107] Describe pointer shapes in the manual * doc/lispref/frames.texi (Pointer Shape): Describe what the typical pointer shapes are (and add `nhdrag') (bug#39246). --- doc/lispref/frames.texi | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 19c80fad53d..9b4716b93d5 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -3761,10 +3761,31 @@ for instance using the window manager, then this produces a quit and You can specify the mouse pointer style for particular text or images using the @code{pointer} text property, and for images with the @code{:pointer} and @code{:map} image properties. The values you can -use in these properties are @code{text} (or @code{nil}), @code{arrow}, -@code{hand}, @code{vdrag}, @code{hdrag}, @code{modeline}, and -@code{hourglass}. @code{text} stands for the usual mouse pointer -style used over text. +use in these properties are in the table below. The actual shapes +may vary between systems; the descriptions are examples. + +@table @code +@item text +@itemx nil +The usual mouse pointer style used over text (an ``I''-like shape). + +@item arrow +@itemx vdrag +@itemx modeline +An arrow that points north-west. + +@item hand +A hand that points upwards. + +@item hdrag +A right-left arrow. + +@item nhdrag +An up-down arrow. + +@item hourglass +A rotating ring. +@end table Over void parts of the window (parts that do not correspond to any of the buffer contents), the mouse pointer usually uses the From 19afd6de25eb836014301009620091be6f0012b0 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 29 Jan 2021 08:18:52 +0100 Subject: [PATCH 086/107] Fix previous commit regarding revert-buffer-function * simple.el (shell-command, shell-command-on-region): Set revert-buffer-function buffer-locally, not globally. Also, avoid an unnecessary call to (current-buffer) by taking advantage of the closure (bug#46151). --- lisp/simple.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 64ee0421356..742fc5004dc 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3991,9 +3991,9 @@ impose the use of a shell (with its need to quote arguments)." (start-process-shell-command "Shell" buffer command))) (setq mode-line-process '(":%s")) (shell-mode) - (setq revert-buffer-function - (lambda (&rest _) - (async-shell-command command (current-buffer)))) + (setq-local revert-buffer-function + (lambda (&rest _) + (async-shell-command command buffer))) (set-process-sentinel proc #'shell-command-sentinel) ;; Use the comint filter for proper handling of ;; carriage motion (see comint-inhibit-carriage-motion). @@ -4260,9 +4260,9 @@ characters." buffer)))) ;; Report the output. (with-current-buffer buffer - (setq revert-buffer-function - (lambda (&rest _) - (shell-command command))) + (setq-local revert-buffer-function + (lambda (&rest _) + (shell-command command))) (setq mode-line-process (cond ((null exit-status) " - Error") From ae2e2b6acdf9c052b726c45507945ff0a824db91 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 29 Jan 2021 09:45:13 +0200 Subject: [PATCH 087/107] Improve doc string of 'operating-system-release' * src/editfns.c (syms_of_editfns) : Doc fix. (Bug#39940) --- src/editfns.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/editfns.c b/src/editfns.c index 3b2876f01e8..3c2a858b46e 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4479,7 +4479,9 @@ functions if all the text being accessed has this property. */); doc: /* The user's name, based upon the real uid only. */); DEFVAR_LISP ("operating-system-release", Voperating_system_release, - doc: /* The operating system kernel version Emacs is running on. */); + doc: /* The kernel version of the operating system on which Emacs is running. +The value is a string. It can also be nil if Emacs doesn't +know how to get the kernel version on the underlying OS. */); DEFVAR_BOOL ("binary-as-unsigned", binary_as_unsigned, From 4ce5646d592c8d998d066d56108e6dd92372e22b Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 29 Jan 2021 09:44:31 +0100 Subject: [PATCH 088/107] Fix Bug#45518 in compile.el * lisp/progmodes/compile.el (compilation-get-file-structure): Avoid call of `file-truename' for remote files. (Bug#45518) --- lisp/progmodes/compile.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 94e4f3c6fa7..2c1e6ff52ec 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -3041,7 +3041,12 @@ TRUE-DIRNAME is the `file-truename' of DIRNAME, if given." ;; Get the specified directory from FILE. (spec-directory (if (cdr file) - (file-truename (concat comint-file-name-prefix (cdr file)))))) + ;; This function is active in `compilation-filter'. + ;; There could be problems to call `file-truename' + ;; for remote compilation processes. + (if (file-remote-p default-directory) + (concat comint-file-name-prefix (cdr file)) + (file-truename (concat comint-file-name-prefix (cdr file))))))) ;; Check for a comint-file-name-prefix and prepend it if appropriate. ;; (This is very useful for compilation-minor-mode in an rlogin-mode From 840b1c66b4a686763c9288de8efb7ec48ccf06da Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 29 Jan 2021 10:55:16 +0200 Subject: [PATCH 089/107] Use save-mark-and-excursion in query-replace-read-args (bug#45617) --- lisp/replace.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lisp/replace.el b/lisp/replace.el index cbf24bedef4..f13d27aff89 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -343,14 +343,15 @@ Prompt with PROMPT. REGEXP-FLAG non-nil means the response should a regexp." (defun query-replace-read-args (prompt regexp-flag &optional noerror) (unless noerror (barf-if-buffer-read-only)) - (let* ((from (query-replace-read-from prompt regexp-flag)) - (to (if (consp from) (prog1 (cdr from) (setq from (car from))) - (query-replace-read-to from prompt regexp-flag)))) - (list from to - (or (and current-prefix-arg (not (eq current-prefix-arg '-))) - (and (plist-member (text-properties-at 0 from) 'isearch-regexp-function) - (get-text-property 0 'isearch-regexp-function from))) - (and current-prefix-arg (eq current-prefix-arg '-))))) + (save-mark-and-excursion + (let* ((from (query-replace-read-from prompt regexp-flag)) + (to (if (consp from) (prog1 (cdr from) (setq from (car from))) + (query-replace-read-to from prompt regexp-flag)))) + (list from to + (or (and current-prefix-arg (not (eq current-prefix-arg '-))) + (and (plist-member (text-properties-at 0 from) 'isearch-regexp-function) + (get-text-property 0 'isearch-regexp-function from))) + (and current-prefix-arg (eq current-prefix-arg '-)))))) (defun query-replace (from-string to-string &optional delimited start end backward region-noncontiguous-p) "Replace some occurrences of FROM-STRING with TO-STRING. From 83591e1aec86530e0d293df3078760838f37679a Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 29 Jan 2021 12:25:36 +0100 Subject: [PATCH 090/107] * test/lisp/net/tramp-tests.el (tramp--test-special-characters): Adapt test for docker. --- test/lisp/net/tramp-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 6467c7ee219..19a40fdf06c 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -6037,13 +6037,13 @@ This requires restrictions of file name syntax." (let ((files (list (cond ((or (tramp--test-ange-ftp-p) + (tramp--test-docker-p) (tramp--test-gvfs-p) (tramp--test-rclone-p) (tramp--test-sudoedit-p) (tramp--test-windows-nt-or-smb-p)) "foo bar baz") ((or (tramp--test-adb-p) - (tramp--test-docker-p) (eq system-type 'cygwin)) " foo bar baz ") ((tramp--test-sh-no-ls--dired-p) From 75eb2d0e850352bef1afe052315de63817b2070b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 29 Jan 2021 13:52:31 +0200 Subject: [PATCH 091/107] Support 'operating-system-release' on MS-Windows * src/w32fns.c (w32_version_string) [WINDOWSNT]: New function. * src/w32common.h (w32_version_string) [WINDOWSNT]: Add prototype. * src/editfns.c (init_editfns) [WINDOWSNT]: Produce a non-nil string with the OS version. --- src/editfns.c | 7 ++++++- src/w32common.h | 5 +++++ src/w32fns.c | 12 ++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/editfns.c b/src/editfns.c index 3c2a858b46e..e3285494c14 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -52,6 +52,9 @@ along with GNU Emacs. If not, see . */ #include "window.h" #include "blockinput.h" +#ifdef WINDOWSNT +# include "w32common.h" +#endif static void update_buffer_properties (ptrdiff_t, ptrdiff_t); static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool); @@ -121,12 +124,14 @@ init_editfns (void) else if (NILP (Vuser_full_name)) Vuser_full_name = build_string ("unknown"); -#ifdef HAVE_SYS_UTSNAME_H +#if defined HAVE_SYS_UTSNAME_H { struct utsname uts; uname (&uts); Voperating_system_release = build_string (uts.release); } +#elif defined WINDOWSNT + Voperating_system_release = build_string (w32_version_string ()); #else Voperating_system_release = Qnil; #endif diff --git a/src/w32common.h b/src/w32common.h index 94bb457e59d..714a2386a68 100644 --- a/src/w32common.h +++ b/src/w32common.h @@ -50,6 +50,11 @@ extern int os_subtype; /* Cache system info, e.g., the NT page size. */ extern void cache_system_info (void); +#ifdef WINDOWSNT +/* Return a static buffer with the MS-Windows version string. */ +extern char * w32_version_string (void); +#endif + typedef void (* VOIDFNPTR) (void); /* Load a function address from a DLL. Cast the result via VOIDFNPTR diff --git a/src/w32fns.c b/src/w32fns.c index 7519c752b68..e93a0b85d93 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -9480,6 +9480,18 @@ cache_system_info (void) w32_num_mouse_buttons = GetSystemMetrics (SM_CMOUSEBUTTONS); } +#ifdef WINDOWSNT +char * +w32_version_string (void) +{ + /* NNN.NNN.NNNNNNNNNN */ + static char version_string[3 + 1 + 3 + 1 + 10 + 1]; + _snprintf (version_string, sizeof version_string, "%d.%d.%d", + w32_major_version, w32_minor_version, w32_build_number); + return version_string; +} +#endif + #ifdef EMACSDEBUG void _DebPrint (const char *fmt, ...) From e86b30d6fd04070b86560774ec82392dbe24ca1e Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Fri, 29 Jan 2021 15:53:28 +0200 Subject: [PATCH 092/107] (xref-revert-buffer): Also 'erase-buffer' when handling a user-error * lisp/progmodes/xref.el (xref-revert-buffer): Also 'erase-buffer' when handling a user-error (bug#46042). --- lisp/progmodes/xref.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 07a65d4ed93..18fdd963fb1 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -972,6 +972,7 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." (erase-buffer) (xref--insert-xrefs alist)) (user-error + (erase-buffer) (insert (propertize (error-message-string err) From c7a86cb7ecb79cd07c66ce6a5af5fac32fc2fca4 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 29 Jan 2021 20:11:38 +0100 Subject: [PATCH 093/107] Use lexical-binding in sasl.el and add tests * lisp/net/sasl.el: * lisp/net/sasl-digest.el: * lisp/net/sasl-cram.el: * lisp/net/sasl-ntlm.el: Use lexical-binding. * test/lisp/net/sasl-tests.el: * test/lisp/net/sasl-cram-tests.el: New files. --- lisp/net/sasl-cram.el | 2 +- lisp/net/sasl-digest.el | 2 +- lisp/net/sasl-ntlm.el | 2 +- lisp/net/sasl.el | 2 +- test/lisp/net/sasl-cram-tests.el | 46 +++++++++++++++++++++++++ test/lisp/net/sasl-tests.el | 59 ++++++++++++++++++++++++++++++++ 6 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 test/lisp/net/sasl-cram-tests.el create mode 100644 test/lisp/net/sasl-tests.el diff --git a/lisp/net/sasl-cram.el b/lisp/net/sasl-cram.el index bc2612d9452..4022a35b391 100644 --- a/lisp/net/sasl-cram.el +++ b/lisp/net/sasl-cram.el @@ -1,4 +1,4 @@ -;;; sasl-cram.el --- CRAM-MD5 module for the SASL client framework +;;; sasl-cram.el --- CRAM-MD5 module for the SASL client framework -*- lexical-binding: t -*- ;; Copyright (C) 2000, 2007-2021 Free Software Foundation, Inc. diff --git a/lisp/net/sasl-digest.el b/lisp/net/sasl-digest.el index efc8f82890c..5afc195d4b4 100644 --- a/lisp/net/sasl-digest.el +++ b/lisp/net/sasl-digest.el @@ -1,4 +1,4 @@ -;;; sasl-digest.el --- DIGEST-MD5 module for the SASL client framework +;;; sasl-digest.el --- DIGEST-MD5 module for the SASL client framework -*- lexical-binding: t -*- ;; Copyright (C) 2000, 2007-2021 Free Software Foundation, Inc. diff --git a/lisp/net/sasl-ntlm.el b/lisp/net/sasl-ntlm.el index 66582265615..1ceb6d179ca 100644 --- a/lisp/net/sasl-ntlm.el +++ b/lisp/net/sasl-ntlm.el @@ -1,4 +1,4 @@ -;;; sasl-ntlm.el --- NTLM (NT Lan Manager) module for the SASL client framework +;;; sasl-ntlm.el --- NTLM (NT Lan Manager) module for the SASL client framework -*- lexical-binding: t -*- ;; Copyright (C) 2000, 2007-2021 Free Software Foundation, Inc. diff --git a/lisp/net/sasl.el b/lisp/net/sasl.el index d2e08f7e3ed..aa4681f11c8 100644 --- a/lisp/net/sasl.el +++ b/lisp/net/sasl.el @@ -1,4 +1,4 @@ -;;; sasl.el --- SASL client framework +;;; sasl.el --- SASL client framework -*- lexical-binding: t -*- ;; Copyright (C) 2000, 2007-2021 Free Software Foundation, Inc. diff --git a/test/lisp/net/sasl-cram-tests.el b/test/lisp/net/sasl-cram-tests.el new file mode 100644 index 00000000000..e0230ddee60 --- /dev/null +++ b/test/lisp/net/sasl-cram-tests.el @@ -0,0 +1,46 @@ +;;; sasl-cram-tests.el --- tests for sasl-cram.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Stefan Kangas + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Test case from RFC 2195. + +;;; Code: + +(require 'ert) +(require 'sasl) +(require 'sasl-cram) + +(ert-deftest sasl-cram-md5-response-test () + ;; The following strings are taken from section 2 of RFC 2195. + (let ((client + (sasl-make-client (sasl-find-mechanism '("CRAM-MD5")) + "user" + "imap" + "localhost")) + (data (base64-decode-string "PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2UucmVzdG9uLm1jaS5uZXQ+")) + (sasl-read-passphrase + (lambda (_prompt) (copy-sequence "tanstaaftanstaaf")))) + (should (equal (sasl-cram-md5-response client (vector nil data)) + "user b913a602c7eda7a495b4e6e7334d3890")))) + +(provide 'sasl-cram-tests) +;;; sasl-cram-tests.el ends here diff --git a/test/lisp/net/sasl-tests.el b/test/lisp/net/sasl-tests.el new file mode 100644 index 00000000000..dab40754c00 --- /dev/null +++ b/test/lisp/net/sasl-tests.el @@ -0,0 +1,59 @@ +;;; sasl-tests.el --- tests for sasl.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Stefan Kangas + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'sasl) + +(ert-deftest sasl-test-make-client () + (let ((client (sasl-make-client 'foo 'bar 'baz 'zut))) + (should (eq (sasl-client-mechanism client) 'foo)) + (should (eq (sasl-client-name client) 'bar)) + (should (eq (sasl-client-service client) 'baz)) + (should (eq (sasl-client-server client) 'zut)))) + +(ert-deftest sasl-test-client-set-properties () + (let ((client (sasl-make-client 'foo 'bar 'baz 'zut))) + (sasl-client-set-property client 'foo 'bar) + (should (eq (sasl-client-property client 'foo) 'bar)))) + +(ert-deftest sasl-test-step-data () + (let ((step [nil nil])) + (sasl-step-set-data step "foo") + (should (equal (sasl-step-data step) "foo")))) + +(ert-deftest sasl-test-unique-id () + (should (stringp (sasl-unique-id))) + (should-not (equal (sasl-unique-id) (sasl-unique-id)))) + +(ert-deftest sasl-test-find-mechanism () + (should (sasl-find-mechanism '("ANONYMOUS"))) + (should-not (sasl-find-mechanism '("nonexistent mechanism")))) + +(ert-deftest sasl-test-mechanism-name () + (let ((mechanism (sasl-find-mechanism '("ANONYMOUS")))) + (should (equal (sasl-mechanism-name mechanism) "ANONYMOUS")))) + +(provide 'sasl-tests) +;;; sasl-tests.el ends here From 47147db9b0f40c77657aff625048bbef5d32fb05 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 29 Jan 2021 21:06:02 +0100 Subject: [PATCH 094/107] ; Silence byte-compiler * lisp/net/sasl-ntlm.el (sasl-ntlm-request): * lisp/net/sasl.el (sasl-plain-response, sasl-login-response-1) (sasl-login-response-2, sasl-anonymous-response): Fix warnings introduced by my previous commit. --- lisp/net/sasl-ntlm.el | 2 +- lisp/net/sasl.el | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/net/sasl-ntlm.el b/lisp/net/sasl-ntlm.el index 1ceb6d179ca..dfb7e713302 100644 --- a/lisp/net/sasl-ntlm.el +++ b/lisp/net/sasl-ntlm.el @@ -40,7 +40,7 @@ "A list of functions to be called in sequence for the NTLM authentication steps. They are called by `sasl-next-step'.") -(defun sasl-ntlm-request (client step) +(defun sasl-ntlm-request (client _step) "SASL step function to generate a NTLM authentication request to the server. Called from `sasl-next-step'. CLIENT is a vector [mechanism user service server sasl-client-properties] diff --git a/lisp/net/sasl.el b/lisp/net/sasl.el index aa4681f11c8..b7f814f7237 100644 --- a/lisp/net/sasl.el +++ b/lisp/net/sasl.el @@ -203,7 +203,7 @@ It contain at least 64 bits of entropy." (defconst sasl-plain-steps '(sasl-plain-response)) -(defun sasl-plain-response (client step) +(defun sasl-plain-response (client _step) (let ((passphrase (sasl-read-passphrase (format "PLAIN passphrase for %s: " (sasl-client-name client)))) @@ -229,12 +229,12 @@ It contain at least 64 bits of entropy." sasl-login-response-1 sasl-login-response-2)) -(defun sasl-login-response-1 (client step) +(defun sasl-login-response-1 (client _step) ;;; (unless (string-match "^Username:" (sasl-step-data step)) ;;; (sasl-error (format "Unexpected response: %s" (sasl-step-data step)))) (sasl-client-name client)) -(defun sasl-login-response-2 (client step) +(defun sasl-login-response-2 (client _step) ;;; (unless (string-match "^Password:" (sasl-step-data step)) ;;; (sasl-error (format "Unexpected response: %s" (sasl-step-data step)))) (sasl-read-passphrase @@ -250,7 +250,7 @@ It contain at least 64 bits of entropy." '(ignore ;no initial response sasl-anonymous-response)) -(defun sasl-anonymous-response (client step) +(defun sasl-anonymous-response (client _step) (or (sasl-client-property client 'trace) (sasl-client-name client))) From 7415c66d8b3e2476aeea64c70ef376c12a39f175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Fri, 29 Jan 2021 21:15:33 +0100 Subject: [PATCH 095/107] ; * src/process.c (child_signal_read): Don't report EAGAIN as error --- src/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/process.c b/src/process.c index 1df4ed9ce03..3beb9cf7146 100644 --- a/src/process.c +++ b/src/process.c @@ -7217,7 +7217,7 @@ child_signal_read (int fd, void *data) eassert (0 <= fd); eassert (fd == child_signal_read_fd); char dummy; - if (emacs_read (fd, &dummy, 1) < 0) + if (emacs_read (fd, &dummy, 1) < 0 && errno != EAGAIN) emacs_perror ("reading from child signal FD"); } #endif /* !WINDOWSNT */ From 295de50329a584c588c44a8485f576a33d12044c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 29 Jan 2021 16:49:12 -0500 Subject: [PATCH 096/107] * test/lisp/electric-tests.el: Fix switch to lexical-binding. (define-electric-pair-test): Don't presume that function values are self-evaluating. --- test/lisp/electric-tests.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 05a6989664d..62a42b7fe44 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -135,9 +135,11 @@ The buffer's contents should %s: (length fixture) fixture (if fixture-fn (format "\nNow call this:\n\n%s" - (pp-to-string fixture-fn)) "") + (pp-to-string fixture-fn)) + "") (if bindings (format "\nEnsure the following bindings:\n\n%s" - (pp-to-string bindings)) "") + (pp-to-string bindings)) + "") char (if (string= fixture expected-string) "stay" "become") (replace-regexp-in-string "\n" "\\\\n" expected-string) @@ -163,8 +165,11 @@ The buffer's contents should %s: (test-in-comments t) (test-in-strings t) (test-in-code t) - (fixture-fn #'(lambda () - (electric-pair-mode 1)))) + ;; The semantics of CL's defmacro "default values" is subtle: + ;; contrary to the actual arguments, these are evaluated (and + ;; are expected to return the "default form"). + ;; `fixture-fn' contains a form whose evaluation returns a function. + (fixture-fn '#'electric-pair-mode)) `(progn ,@(cl-loop for mode in (eval modes) ;FIXME: avoid `eval' From 1a4bb1e2f28ec20aff23bab335ba949a0f2b75a1 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 30 Jan 2021 00:10:10 +0100 Subject: [PATCH 097/107] Use lexical-binding in handwrite.el * lisp/play/handwrite.el: Use lexical-binding. Remove redundant :group args. Minor cleanups. (handwrite): Minor cleanups. (handwrite-set-pagenumber-off, handwrite-set-pagenumber-on): Make comments into docstrings. --- lisp/play/handwrite.el | 86 ++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 54 deletions(-) diff --git a/lisp/play/handwrite.el b/lisp/play/handwrite.el index 7ad3de6fb64..98da26c2e6c 100644 --- a/lisp/play/handwrite.el +++ b/lisp/play/handwrite.el @@ -1,8 +1,9 @@ -;;; handwrite.el --- turns your emacs buffer into a handwritten document +;;; handwrite.el --- turns your emacs buffer into a handwritten document -*- lexical-binding: t -*- ;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc. ;; Author: Danny Roozendaal (was: ) +;; Maintainer: emacs-devel@gnu.org ;; Created: October 21 1996 ;; Keywords: wp, print, postscript, cursive writing @@ -22,11 +23,11 @@ ;; along with GNU Emacs. If not, see . ;;; Commentary: + +;; The function `handwrite' creates PostScript output containing a +;; handwritten version of the current buffer. ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; The function handwrite creates PostScript output containing a -;; handwritten version of the current buffer.. -;; Other functions that may be useful are +;; Other functions that may be useful are: ;; ;; handwrite-10pt: sets the font size to 10 and finds corresponding ;; values for the line spacing and the number of lines @@ -54,8 +55,6 @@ ;; unknown characters. ;; ;; Thanks to anyone who emailed me suggestions! -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;;; Code: @@ -64,7 +63,6 @@ (defvar ps-lpr-command) (defvar ps-lpr-switches) - ;; Variables (defgroup handwrite nil @@ -98,44 +96,43 @@ (defcustom handwrite-numlines 60 "The number of lines on a page of the PostScript output from `handwrite'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-fontsize 11 "The size of the font for the PostScript output from `handwrite'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-linespace 12 "The spacing for the PostScript output from `handwrite'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-xstart 30 "X-axis translation in the PostScript output from `handwrite'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-ystart 810 "Y-axis translation in the PostScript output from `handwrite'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-pagenumbering nil "If non-nil, number each page of the PostScript output from `handwrite'." - :type 'boolean - :group 'handwrite) + :type 'boolean) + (defcustom handwrite-10pt-numlines 65 "The number of lines on a page for the function `handwrite-10pt'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-11pt-numlines 60 "The number of lines on a page for the function `handwrite-11pt'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-12pt-numlines 55 "The number of lines on a page for the function `handwrite-12pt'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-13pt-numlines 50 "The number of lines on a page for the function `handwrite-13pt'." - :type 'integer - :group 'handwrite) + :type 'integer) ;; Interactive functions @@ -150,17 +147,17 @@ Variables: `handwrite-linespace' (default 12) `handwrite-numlines' (default 60) `handwrite-pagenumbering' (default nil)" (interactive) + (setq handwrite-psindex (1+ handwrite-psindex)) (let - (;(pmin) ; thanks, Havard - (cur-buf (current-buffer)) + ((cur-buf (current-buffer)) (tpoint (point)) (ps-ypos 63) (lcount 0) (ipage 1) - (nlan next-line-add-newlines) ;remember the old value + (next-line-add-newlines t) (buf-name (buffer-name) ) (textp) - (ps-buf-name) ;name of the PostScript buffer + (ps-buf-name (format "*handwritten%d.ps*" handwrite-psindex)) (trans-table '(("ÿ" . "264") ("á" . "207") ("à" . "210") ("â" . "211") ("ä" . "212") ("ã" . "213") ("å" . "214") ("é" . "216") @@ -175,10 +172,6 @@ Variables: `handwrite-linespace' (default 12) ; on inserted backslashes line) (goto-char (point-min)) ;start at beginning - (setq handwrite-psindex (1+ handwrite-psindex)) - (setq ps-buf-name - (format "*handwritten%d.ps*" handwrite-psindex)) - (setq next-line-add-newlines t) (switch-to-buffer ps-buf-name) (handwrite-insert-header buf-name) (insert "%%Creator: GNU Emacs's handwrite version " emacs-version "\n") @@ -258,9 +251,7 @@ Variables: `handwrite-linespace' (default 12) (message "") (bury-buffer ()) (switch-to-buffer cur-buf) - (goto-char tpoint) - (setq next-line-add-newlines nlan) - )) + (goto-char tpoint))) (defun handwrite-set-pagenumber () @@ -280,7 +271,6 @@ values for `handwrite-linespace' and `handwrite-numlines'." (setq handwrite-numlines handwrite-10pt-numlines) (message "Handwrite output size set to 10 points")) - (defun handwrite-11pt () "Specify 11-point output for `handwrite'. This sets `handwrite-fontsize' to 11 and finds correct @@ -1238,28 +1228,16 @@ end /Joepie Hwfdict definefont %%EndFont Joepie\n\n")) -;;Sets page numbering off (defun handwrite-set-pagenumber-off () + "Set page numbering off." (setq handwrite-pagenumbering nil) (message "page numbering off")) -;;Sets page numbering on (defun handwrite-set-pagenumber-on () + "Set page numbering on." (setq handwrite-pagenumbering t) (message "page numbering on" )) - -;; Key bindings - -;; I'd rather not fill up the menu bar menus with -;; lots of random miscellaneous features. -- rms. -;;;(define-key-after -;;; (lookup-key global-map [menu-bar edit]) -;;; [handwrite] -;;; '("Write by hand" . menu-bar-handwrite-map) -;;; 'spell) - (provide 'handwrite) - ;;; handwrite.el ends here From f3f6e84ca6f16c243cd1242ca51c333972a4bb9a Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 30 Jan 2021 00:32:20 +0100 Subject: [PATCH 098/107] Use lexical-binding in mpuz.el * lisp/play/mpuz.el: Use lexical-binding. Remove redundant :group args. (mpuz-switch-to-window): Minor cleanup. --- lisp/play/mpuz.el | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el index 7fff604aead..838bddfb665 100644 --- a/lisp/play/mpuz.el +++ b/lisp/play/mpuz.el @@ -1,4 +1,4 @@ -;;; mpuz.el --- multiplication puzzle for GNU Emacs +;;; mpuz.el --- multiplication puzzle for GNU Emacs -*- lexical-binding: t -*- ;; Copyright (C) 1990, 2001-2021 Free Software Foundation, Inc. @@ -40,49 +40,41 @@ The value t means never ding, and `error' means only ding on wrong input." :type '(choice (const :tag "No" nil) (const :tag "Yes" t) - (const :tag "If correct" error)) - :group 'mpuz) + (const :tag "If correct" error))) (defcustom mpuz-solve-when-trivial t "Solve any row that can be trivially calculated from what you've found." - :type 'boolean - :group 'mpuz) + :type 'boolean) (defcustom mpuz-allow-double-multiplicator nil "Allow 2nd factors like 33 or 77." - :type 'boolean - :group 'mpuz) + :type 'boolean) (defface mpuz-unsolved '((default :weight bold) (((class color)) :foreground "red1")) - "Face for letters to be solved." - :group 'mpuz) + "Face for letters to be solved.") (defface mpuz-solved '((default :weight bold) (((class color)) :foreground "green1")) - "Face for solved digits." - :group 'mpuz) + "Face for solved digits.") (defface mpuz-trivial '((default :weight bold) (((class color)) :foreground "blue")) - "Face for trivial digits solved for you." - :group 'mpuz) + "Face for trivial digits solved for you.") (defface mpuz-text '((t :inherit variable-pitch)) - "Face for text on right." - :group 'mpuz) + "Face for text on right.") ;; Mpuz mode and keymaps ;;---------------------- (defcustom mpuz-mode-hook nil "Hook to run upon entry to mpuz." - :type 'hook - :group 'mpuz) + :type 'hook) (defvar mpuz-mode-map (let ((map (make-sparse-keymap))) @@ -341,8 +333,8 @@ You may abort a game by typing \\\\[mpuz-offer-abort]." (defun mpuz-switch-to-window () "Find or create the Mult-Puzzle buffer, and display it." - (let ((buf (mpuz-get-buffer))) - (or buf (setq buf (mpuz-create-buffer))) + (let ((buf (or (mpuz-get-buffer) + (mpuz-create-buffer)))) (switch-to-buffer buf) (setq buffer-read-only t) (mpuz-mode))) From bbad7904e20ba0366a3397a45fb89de0275bbf28 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 30 Jan 2021 03:56:27 +0200 Subject: [PATCH 099/107] vc-dir-mode-map: Remove the mouse-2 binding * lisp/vc/vc-dir.el (vc-dir-mode-map): Remove the mouse-2 binding (bug#13692). (vc-dir-mode): Update the docstring accordingly. (vc-dir-status-mouse-map): New variable. (vc-default-dir-printer): Use it on the state buttons. * lisp/vc/vc-git.el (vc-git-dir-printer): Same. --- lisp/vc/vc-dir.el | 11 ++++++++--- lisp/vc/vc-git.el | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index bbb73240be2..9d0808c0435 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -300,7 +300,6 @@ See `run-hooks'." (define-key map "\C-o" 'vc-dir-display-file) (define-key map "\C-c\C-c" 'vc-dir-kill-dir-status-process) (define-key map [down-mouse-3] 'vc-dir-menu) - (define-key map [mouse-2] 'vc-dir-toggle-mark) (define-key map [follow-link] 'mouse-face) (define-key map "x" 'vc-dir-hide-up-to-date) (define-key map [?\C-k] 'vc-dir-kill-line) @@ -1085,7 +1084,6 @@ U - if the cursor is on a file: unmark all the files with the same state as the current file - if the cursor is on a directory: unmark all child files - with a prefix argument: unmark all files -mouse-2 - toggles the mark state VC commands VC commands in the `C-x v' prefix can be used. @@ -1392,6 +1390,12 @@ These are the commands available for use in the file status buffer: (propertize "Please add backend specific headers here. It's easy!" 'face 'font-lock-warning-face))) +(defvar vc-dir-status-mouse-map + (let ((map (make-sparse-keymap))) + (define-key map [mouse-2] 'vc-dir-toggle-mark) + map) + "Local keymap for toggling mark.") + (defvar vc-dir-filename-mouse-map (let ((map (make-sparse-keymap))) (define-key map [mouse-2] 'vc-dir-find-file-other-window) @@ -1418,7 +1422,8 @@ These are the commands available for use in the file status buffer: ((memq state '(missing conflict)) 'font-lock-warning-face) ((eq state 'edited) 'font-lock-constant-face) (t 'font-lock-variable-name-face)) - 'mouse-face 'highlight) + 'mouse-face 'highlight + 'keymap vc-dir-status-mouse-map) " " (propertize (format "%s" filename) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index a9ee28e3aad..94fac3a83b8 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -481,7 +481,8 @@ or an empty string if none." 'face (cond ((eq state 'up-to-date) 'font-lock-builtin-face) ((eq state 'missing) 'font-lock-warning-face) (t 'font-lock-variable-name-face)) - 'mouse-face 'highlight) + 'mouse-face 'highlight + 'keymap vc-dir-status-mouse-map) " " (vc-git-permissions-as-string old-perm new-perm) " " (propertize (vc-git-escape-file-name (vc-dir-fileinfo->name info)) From 90ce2b80342299ef4c6c2f6b08cca55e20ffa06b Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 29 Jan 2021 08:34:43 +0100 Subject: [PATCH 100/107] rmail-summary-mark-deleted optional argument fix * lisp/mail/rmailsum.el (rmail-summary-mark-deleted): Argument N is optional, so don't assume that it's a number (bug#39076). --- lisp/mail/rmailsum.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index d29115a9570..7f99ecdcf2c 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -974,8 +974,9 @@ a negative argument means to delete and move forward." (delete-char 1) (insert "D")) ;; Discard cached new summary line. - (with-current-buffer rmail-buffer - (aset rmail-summary-vector (1- n) nil)))) + (when n + (with-current-buffer rmail-buffer + (aset rmail-summary-vector (1- n) nil))))) (beginning-of-line)) (defun rmail-summary-update-line (n) From 5644ac41c42fde4a4434131e45110aa1e909e0b2 Mon Sep 17 00:00:00 2001 From: Mauro Aranda Date: Sat, 30 Jan 2021 07:47:34 +0100 Subject: [PATCH 101/107] Add source to sgml-empty-tags * lisp/textmodes/sgml-mode.el (html-mode): Add "source" as an empty tag to fix indentation when this element is present (bug#46181). --- lisp/textmodes/sgml-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 8465e82b02a..c50c544cb54 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -2402,9 +2402,9 @@ To work around that, do: (setq-local sgml-empty-tags ;; From HTML-4.01's loose.dtd, parsed with - ;; `sgml-parse-dtd', plus manual addition of "wbr". + ;; `sgml-parse-dtd', plus manual additions of "source" and "wbr". '("area" "base" "basefont" "br" "col" "frame" "hr" "img" "input" - "isindex" "link" "meta" "param" "wbr")) + "isindex" "link" "meta" "source" "param" "wbr")) (setq-local sgml-unclosed-tags ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd'. '("body" "colgroup" "dd" "dt" "head" "html" "li" "option" From 0fa2a715d4c38cdea06737b5b9142db29dc3ebc9 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 30 Jan 2021 07:59:30 +0100 Subject: [PATCH 102/107] Improve :foreground description in the manual * doc/lispref/frames.texi (Font and Color Parameters): Make the description less confusing (bug#38710). --- doc/lispref/frames.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 9b4716b93d5..a15511dc9f5 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -2411,7 +2411,7 @@ attribute of the @code{default} face. @vindex foreground-color@r{, a frame parameter} @item foreground-color -The color to use for the image of a character. It is equivalent to +The color to use for characters. It is equivalent to the @code{:foreground} attribute of the @code{default} face. @vindex background-color@r{, a frame parameter} From cc2d3a62c2a1f5be7907eda55d3c678e1149eb7b Mon Sep 17 00:00:00 2001 From: Jeff Spencer Date: Sat, 30 Jan 2021 08:12:57 +0100 Subject: [PATCH 103/107] Fix interaction between two dired cleanup variables * lisp/dired.el (dired-clean-up-after-deletion): Kill the buffers if you have `dired-clean-up-buffers-too' set and `dired-clean-confirm-killing-deleted-buffers' nil (bug#38037). Copyright-paperwork-exempt: yes --- etc/NEWS | 6 ++++++ lisp/dired.el | 21 ++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 8e233f8f196..a6fd51b8a2a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -504,6 +504,12 @@ time zones will use a form like "+0100" instead of "CET". ** Dired +--- +*** Behaviour change on 'dired-clean-confirm-killing-deleted-buffers'. +Previously, if 'dired-clean-up-buffers-too' was non-nil, and +'dired-clean-confirm-killing-deleted-buffers' was nil, the buffers +wouldn't be killed. This combination will now kill the buffers. + +++ *** New user option 'dired-switches-in-mode-line'. This user option controls how 'ls' switches are displayed in the mode diff --git a/lisp/dired.el b/lisp/dired.el index 3f119363314..fe6ac1e2591 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3532,18 +3532,21 @@ confirmation. To disable the confirmation, see (when (and (featurep 'dired-x) dired-clean-up-buffers-too) (let ((buf (get-file-buffer fn))) (and buf - (and dired-clean-confirm-killing-deleted-buffers - (funcall #'y-or-n-p - (format "Kill buffer of %s, too? " - (file-name-nondirectory fn)))) + (or (and dired-clean-confirm-killing-deleted-buffers + (funcall #'y-or-n-p + (format "Kill buffer of %s, too? " + (file-name-nondirectory fn)))) + (not dired-clean-confirm-killing-deleted-buffers)) (kill-buffer buf))) (let ((buf-list (dired-buffers-for-dir (expand-file-name fn)))) (and buf-list - (and dired-clean-confirm-killing-deleted-buffers - (y-or-n-p (format (ngettext "Kill Dired buffer of %s, too? " - "Kill Dired buffers of %s, too? " - (length buf-list)) - (file-name-nondirectory fn)))) + (or (and dired-clean-confirm-killing-deleted-buffers + (y-or-n-p (format + (ngettext "Kill Dired buffer of %s, too? " + "Kill Dired buffers of %s, too? " + (length buf-list)) + (file-name-nondirectory fn)))) + (not dired-clean-confirm-killing-deleted-buffers)) (dolist (buf buf-list) (kill-buffer buf)))))) From 32dc433dbb83a5c38650769dc064c082bf79ee8c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 30 Jan 2021 08:59:48 +0100 Subject: [PATCH 104/107] Fix vc-hg-rename-file on file names like ~/foo/bar * lisp/vc/vc-hg.el (vc-hg-rename-file): Use absolute file names, because hg doesn't like getting file names like "~/foo/bar" (bug#36932). --- lisp/vc/vc-hg.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index c4b82ab11eb..1d163a64ab2 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -1166,7 +1166,8 @@ hg binary." ;; Modeled after the similar function in vc-bzr.el (defun vc-hg-rename-file (old new) "Rename file from OLD to NEW using `hg mv'." - (vc-hg-command nil 0 new "mv" old)) + (vc-hg-command nil 0 (expand-file-name new) "mv" + (expand-file-name old))) (defun vc-hg-register (files &optional _comment) "Register FILES under hg. COMMENT is ignored." From bb652f68fd4e996d58f731a0dba1be18fd4e03d7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 30 Jan 2021 11:26:07 +0200 Subject: [PATCH 105/107] New Rmail option 'rmail-show-message-set-modified' * lisp/mail/rmail.el (rmail-show-message-set-modified): New option. (rmail-show-message-1): If 'rmail-show-message-set-modified' is non-nil, don't reset the buffer's modified state. (Bug#45941) * etc/NEWS: Announce the new option. --- etc/NEWS | 5 +++++ lisp/mail/rmail.el | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index a6fd51b8a2a..11fca4fecb6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1138,6 +1138,11 @@ bindings, will be aborted, and Emacs will not ask you whether to enlarge 'max-specpdl-size' to complete the rendering. The default is t, which preserves the original behavior. +--- +*** New user option 'rmail-show-message-set-modified'. +If set non-nil, showing an unseen message will set the Rmail buffer's +modified flag. + ** Apropos *** New commands 'apropos-next-symbol' and 'apropos-previous-symbol'. diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 29460cc20f5..9f95b62d870 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -2723,6 +2723,12 @@ See also `unrmail-mbox-format'." :version "24.4" :group 'rmail-files) +(defcustom rmail-show-message-set-modified nil + "If non-nil, displaying an unseen message marks the Rmail buffer as modified." + :type 'boolean + :group 'rmail + :version "28.1") + (defun rmail-show-message-1 (&optional msg) "Show message MSG (default: current message) using `rmail-view-buffer'. Return text to display in the minibuffer if MSG is out of @@ -2750,6 +2756,8 @@ The current mail message becomes the message displayed." ;; Mark the message as seen, but preserve buffer modified flag. (let ((modiff (buffer-modified-p))) (rmail-set-attribute rmail-unseen-attr-index nil) + (and rmail-show-message-set-modified + (setq modiff t)) (unless modiff (restore-buffer-modified-p modiff))) ;; bracket the message in the mail From 0e2e1caa0bc87c5972ca1bbe6893a56d4db1df0a Mon Sep 17 00:00:00 2001 From: Jared Finder Date: Mon, 7 Dec 2020 22:44:32 -0800 Subject: [PATCH 106/107] * lisp/tab-line.el (tab-line-new-tab): Use tty menus when supported. --- lisp/tab-line.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 2726947a4c2..9209f2d46ec 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -651,7 +651,9 @@ corresponding to the switched buffer." (if (functionp tab-line-new-tab-choice) (funcall tab-line-new-tab-choice) (let ((tab-line-tabs-buffer-groups mouse-buffer-menu-mode-groups)) - (if (and (listp mouse-event) window-system) ; (display-popup-menus-p) + (if (and (listp mouse-event) + (display-popup-menus-p) + (not tty-menu-open-use-tmm)) (mouse-buffer-menu mouse-event) ; like (buffer-menu-open) ;; tty menu doesn't support mouse clicks, so use tmm (tmm-prompt (mouse-buffer-menu-keymap)))))) From ed2f2cc5577d5d9b61db7a5b61e93e79d678be41 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 30 Jan 2021 11:10:26 +0100 Subject: [PATCH 107/107] auth-source-search doc string fix * lisp/auth-source.el (auth-source-search): Fix example (bug#36286). --- lisp/auth-source.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/auth-source.el b/lisp/auth-source.el index ad3b690dfa6..2494040457b 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -588,7 +588,7 @@ Here's an example: \(let ((auth-source-creation-defaults \\='((user . \"defaultUser\") (A . \"default A\"))) (auth-source-creation-prompts - \\='((password . \"Enter IMAP password for %h:%p: \")))) + \\='((secret . \"Enter IMAP password for %h:%p: \")))) (auth-source-search :host \\='(\"nonesuch\" \"twosuch\") :type \\='netrc :max 1 :P \"pppp\" :Q \"qqqq\" :create \\='(A B Q)))