commit 505550ba7b230d90d0b1e622121b3e34a19f7271 (HEAD, refs/remotes/origin/master) Merge: 64b80b42c6 85b3d56276 Author: Martin Rudalics Date: Fri Oct 11 09:27:55 2019 +0200 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit 64b80b42c6ac0779f4ce1152ab3e2546826eb017 Author: Martin Rudalics Date: Fri Oct 11 09:26:41 2019 +0200 Minor fixes for switching to previous and next buffers (Bug#37514) * lisp/window.el (switch-to-prev-buffer) (switch-to-next-buffer): In doc-strings add links to 'prev-buffer' and 'next-buffer'. (next-buffer, previous-buffer): Signal 'user-error' instead of 'error'. In doc-strings link to 'switch-to-prev-buffer' and 'switch-to-next-buffer'. diff --git a/lisp/window.el b/lisp/window.el index fafb6f90ed..d7955209cd 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4422,7 +4422,9 @@ shall not be switched to in future invocations of this command. As a special case, if BURY-OR-KILL equals `append', this means to move the buffer to the end of WINDOW's previous buffers list so a future invocation of `switch-to-prev-buffer' less likely switches -to it." +to it. + +This function is called by `prev-buffer'." (interactive) (let* ((window (window-normalize-window window t)) (frame (window-frame window)) @@ -4545,7 +4547,7 @@ to it." "In WINDOW switch to next buffer. WINDOW must be a live window and defaults to the selected one. Return the buffer switched to, nil if no suitable buffer could be -found." +found. This function is called by `next-buffer'." (interactive) (let* ((window (window-normalize-window window t)) (frame (window-frame window)) @@ -4746,24 +4748,28 @@ displayed there." (switch-to-buffer (last-buffer))) (defun next-buffer () - "In selected window switch to next buffer." + "In selected window switch to next buffer. +Call `switch-to-next-buffer' unless the selected window is the +minibuffer window or is dedicated to its buffer." (interactive) (cond ((window-minibuffer-p) - (error "Cannot switch buffers in minibuffer window")) + (user-error "Cannot switch buffers in minibuffer window")) ((eq (window-dedicated-p) t) - (error "Window is strongly dedicated to its buffer")) + (user-error "Window is strongly dedicated to its buffer")) (t (switch-to-next-buffer)))) (defun previous-buffer () - "In selected window switch to previous buffer." + "In selected window switch to previous buffer. +Call `switch-to-prev-buffer' unless the selected window is the +minibuffer window or is dedicated to its buffer." (interactive) (cond ((window-minibuffer-p) - (error "Cannot switch buffers in minibuffer window")) + (user-error "Cannot switch buffers in minibuffer window")) ((eq (window-dedicated-p) t) - (error "Window is strongly dedicated to its buffer")) + (user-error "Window is strongly dedicated to its buffer")) (t (switch-to-prev-buffer)))) commit 85b3d56276430d58c0a2444bb8dcff3155300278 Author: Lars Ingebrigtsen Date: Fri Oct 11 09:24:26 2019 +0200 New variable amalgamating-undo-limit * doc/lispref/text.texi (Undo): Document it. * lisp/simple.el (amalgamating-undo-limit): New variable (bug#31658). diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index ef11ac2669..bf88477adb 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -1399,6 +1399,7 @@ appropriate time. @defun undo-auto-amalgamate @cindex amalgamating commands, and undo +@vindex amalgamating-undo-limit The editor command loop automatically calls @code{undo-boundary} just before executing each key sequence, so that each undo normally undoes the effects of one command. A few exceptional commands are @@ -1416,6 +1417,10 @@ will be called in each of the affected buffers. This function can be called before an amalgamating command. It removes the previous @code{undo-boundary} if a series of such calls have been made. + +The maximum number of changes that can be amalgamated is controlled by +the @code{amalgamating-undo-limit} variable. If this variable is 1, +no changes are amalgamated. @end defun @defvar undo-auto-current-boundary-timer diff --git a/etc/NEWS b/etc/NEWS index 4135d47ee1..a3a7ff28e8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -453,6 +453,10 @@ Note that this key binding will not work on MS-Windows systems if * Editing Changes in Emacs 27.1 ++++ +** The new 'amalgamating-undo-limit' variable can be used to control +how many changes should be amalgamated when using the 'undo' command. + --- ** The 'newline-and-indent' command (commonly bound to 'RET' in many modes) now takes an optional numeric argument to specify how many diff --git a/lisp/simple.el b/lisp/simple.el index b5205dd764..597278ae2b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -45,6 +45,14 @@ wait this many seconds after Emacs becomes idle before doing an update." :group 'display :version "22.1") +(defvar amalgamating-undo-limit 20 + "The maximum number of changes to possibly amalgamate when undoing changes. +The `undo' command will normally consider \"similar\" changes +(like inserting characters) to be part of the same change. This +is called \"amalgamating\" the changes. This variable says what +the maximum number of changes condidered is when amalgamating. A +value of 1 means that nothing is amalgamated.") + (defgroup killing nil "Killing and yanking commands." :group 'editing) @@ -3124,7 +3132,7 @@ behavior." (undo-auto--last-boundary-amalgamating-number))) (setq undo-auto--this-command-amalgamating t) (when last-amalgamating-count - (if (and (< last-amalgamating-count 20) + (if (and (< last-amalgamating-count amalgamating-undo-limit) (eq this-command last-command)) ;; Amalgamate all buffers that have changed. ;; This may be needed for example if some *-change-functions commit 49614ec8002c7b424a4d794b5e7491f0959280fd Author: Robert Pluim Date: Thu Oct 10 08:24:48 2019 +0200 Correct .dir-locals-2.el description * doc/lispref/variables.texi (Directory Local Variables): Correct description of .dir-locals-2.el functioning. (Bug#37640) diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 76bda7874e..f92540dbd3 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -2003,7 +2003,7 @@ files, Emacs uses the settings from the deepest file it finds starting from the file's directory and moving up the directory tree. This constant is also used to derive the name of a second dir-locals file @file{.dir-locals-2.el}. If this second dir-locals file is present, -then that is loaded instead of @file{.dir-locals.el}. This is useful +then that is loaded in addition to @file{.dir-locals.el}. This is useful when @file{.dir-locals.el} is under version control in a shared repository and cannot be used for personal customizations. The file specifies local variables as a specially formatted list; see commit 17fea5ba38c58324ac4029a348456484d3ea0c35 Author: Lars Ingebrigtsen Date: Fri Oct 11 09:05:20 2019 +0200 Expand the documentation of --no-build-details * doc/emacs/cmdargs.texi (Initial Options): Mention that --no-build-details shouldn't be used in regular usage (bug#34448). diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi index 34a5ff5f2c..3f008ecc8e 100644 --- a/doc/emacs/cmdargs.texi +++ b/doc/emacs/cmdargs.texi @@ -288,8 +288,10 @@ on this first line as a comment delimiter. @opindex --no-build-details @cindex build details @cindex deterministic build -Omit details like system name and build time from the Emacs executable, -so that builds are more deterministic. +Omit details like system name and build time from the Emacs +executable, so that builds are more deterministic. This switch is not +meant for regular (or interactive) use, since it makes commands like +@code{system-name} return @code{nil}. @item -q @opindex -q commit e3f97d73653df725322d7f2392d36f858cce5a73 Author: Martin Rudalics Date: Fri Oct 11 08:46:52 2019 +0200 Fixes for fitting windows and frames to their buffers (Bug#37563) * lisp/window.el (window-default-font-height) (window-default-line-height): New functions. (fit-frame-to-buffer): Interpret values of MAX-HEIGHT and MIN-HEIGHT arguments in terms of WINDOW's default line height (Bug#37563). (fit-window-to-buffer): Obey size restricting arguments even when size of WINDOW's text does not change. Do not temporarily select WINDOW and perform height/width related calculations if and only if WINDOW is accordingly combined. Interpret values of MAX-HEIGHT and MIN-HEIGHT arguments in terms of WINDOW's default line height. diff --git a/lisp/window.el b/lisp/window.el index d93ec0add6..fafb6f90ed 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -8501,6 +8501,41 @@ WINDOW must be a live window and defaults to the selected one." (eobp) window)))) +(defun window-default-font-height (&optional window) + "Return height in pixels of WINDOW's default face font. +WINDOW must be a live window and defaults to the selected one. + +The return value accounts for any remapping of the default face +font on WINDOW's frame." + (let* ((window (window-normalize-window window t)) + (frame (window-frame window)) + (default-font (face-font 'default frame))) + (if (and (display-multi-font-p (frame-parameter frame 'display)) + (not (string-equal (frame-parameter frame 'font) default-font))) + (aref (font-info default-font frame) 3) + (frame-char-height frame)))) + +(defun window-default-line-height (&optional window) + "Return height in pixels of a text line in WINDOW. +WINDOW must be a live window and defaults to the selected one. + +The return value includes any line spacing defined for WINDOW's +buffer or frame and accounts for any remapping of the default +face on WINDOW's frame." + (let* ((window (window-normalize-window window t)) + (font-height (window-default-font-height window)) + (frame (window-frame window)) + (buffer (window-buffer window)) + (space-height + (or (and (display-graphic-p frame) + (or (buffer-local-value 'line-spacing buffer) + (frame-parameter frame 'line-spacing))) + 0))) + (+ font-height + (if (floatp space-height) + (truncate (* (frame-char-height frame) space-height)) + space-height)))) + ;;; Resizing windows and frames to fit their contents exactly. (defcustom fit-window-to-buffer-horizontally nil "Non-nil means `fit-window-to-buffer' can resize windows horizontally. @@ -8643,6 +8678,7 @@ parameters of FRAME." (char-height (frame-char-height frame)) ;; WINDOW is FRAME's root window. (window (frame-root-window frame)) + (line-height (window-default-line-height window)) (parent (frame-parent frame)) (monitor-attributes (unless parent @@ -8739,16 +8775,16 @@ parameters of FRAME." (max-height (min (cond - ((numberp max-height) (* max-height char-height)) - ((numberp (nth 0 sizes)) (* (nth 0 sizes) char-height)) + ((numberp max-height) (* max-height line-height)) + ((numberp (nth 0 sizes)) (* (nth 0 sizes) line-height)) (t parent-or-display-height)) ;; The following is the maximum height that fits into the ;; top and bottom margins. (max (- bottom-margin top-margin outer-minus-body-height)))) (min-height (cond - ((numberp min-height) (* min-height char-height)) - ((numberp (nth 1 sizes)) (* (nth 1 sizes) char-height)) + ((numberp min-height) (* min-height line-height)) + ((numberp (nth 1 sizes)) (* (nth 1 sizes) line-height)) (t (window-min-size window nil nil t)))) (max-width (min @@ -8871,124 +8907,118 @@ accessible position." max-height min-height max-width min-width (and (memq fit-frame-to-buffer '(vertically horizontally)) fit-frame-to-buffer))) - (with-selected-window window - (let* ((pixelwise window-resize-pixelwise) - (char-height (frame-char-height)) - (char-width (frame-char-width)) - (total-height (window-size window nil pixelwise)) - (body-height (window-body-height window pixelwise)) - (body-width (window-body-width window pixelwise)) - (min-height - ;; Sanitize MIN-HEIGHT. - (if (numberp min-height) - ;; Can't get smaller than `window-safe-min-height'. - (max (if pixelwise - (* char-height min-height) - min-height) - (if pixelwise - (window-safe-min-pixel-height window) - window-safe-min-height)) - ;; Preserve header and mode line if present. - (max (if pixelwise - (* char-height window-min-height) - window-min-height) - (window-min-size window nil window pixelwise)))) - (max-height - ;; Sanitize MAX-HEIGHT. - (if (numberp max-height) - (min - (+ total-height - (window-max-delta - window nil window nil t nil pixelwise)) - (if pixelwise - (* char-height max-height) - max-height)) - (+ total-height (window-max-delta - window nil window nil t nil pixelwise)))) - height) - (cond - ;; If WINDOW is vertically combined, try to resize it - ;; vertically. - ((and (not (eq fit-window-to-buffer-horizontally 'only)) - (not (window-size-fixed-p window 'preserved)) - (window-combined-p)) + (let* ((pixelwise window-resize-pixelwise) + (frame (window-frame window)) + (char-height (frame-char-height frame))) + (cond + ;; If WINDOW is vertically combined, try to resize it + ;; vertically. + ((and (not (eq fit-window-to-buffer-horizontally 'only)) + (not (window-size-fixed-p window 'preserved)) + (window-combined-p)) + (let* ((line-height (window-default-line-height window)) + (total-height (window-size window nil pixelwise)) + (min-height + ;; Sanitize MIN-HEIGHT. + (if (numberp min-height) + ;; Can't get smaller than `window-safe-min-height'. + (max (if pixelwise + (* line-height min-height) + min-height) + (if pixelwise + (window-safe-min-pixel-height window) + window-safe-min-height)) + ;; Preserve header and mode line if present. + (max (if pixelwise + (* line-height window-min-height) + window-min-height) + (window-min-size window nil window pixelwise)))) + (max-height + ;; Sanitize MAX-HEIGHT. + (if (numberp max-height) + (min + (+ total-height + (window-max-delta + window nil window nil t nil pixelwise)) + (if pixelwise + (* line-height max-height) + (/ (* line-height max-height) line-height))) + (+ total-height (window-max-delta + window nil window nil t nil pixelwise)))) + (height (+ (cdr (window-text-pixel-size + window nil t nil (frame-pixel-height frame) t)) + (window-scroll-bar-height window) + (window-bottom-divider-width window)))) ;; Vertically we always want to fit the entire buffer. ;; WINDOW'S height can't get larger than its frame's pixel ;; height. Its width remains fixed. - (setq height (+ (cdr (window-text-pixel-size - nil nil t nil (frame-pixel-height) t)) - (window-scroll-bar-height window) - (window-bottom-divider-width))) ;; Round height. (unless pixelwise (setq height (/ (+ height char-height -1) char-height))) + (setq height (max min-height (min max-height height))) (unless (= height total-height) (window-preserve-size window) (window-resize-no-error - window - (- (max min-height (min max-height height)) total-height) - nil window pixelwise) + window (- height total-height) nil window pixelwise) (when preserve-size - (window-preserve-size window nil t)))) - ;; If WINDOW is horizontally combined, try to resize it - ;; horizontally. - ((and fit-window-to-buffer-horizontally - (not (window-size-fixed-p window t 'preserved)) - (window-combined-p nil t)) - (let* ((total-width (window-size window t pixelwise)) - (min-width - ;; Sanitize MIN-WIDTH. - (if (numberp min-width) - ;; Can't get smaller than `window-safe-min-width'. - (max (if pixelwise - (* char-width min-width) - min-width) - (if pixelwise - (window-safe-min-pixel-width) - window-safe-min-width)) - ;; Preserve fringes, margins, scrollbars if present. + (window-preserve-size window nil t))))) + ;; If WINDOW is horizontally combined, try to resize it + ;; horizontally. + ((and fit-window-to-buffer-horizontally + (not (window-size-fixed-p window t 'preserved)) + (window-combined-p window t)) + (let* ((char-width (frame-char-width frame)) + (total-width (window-size window t pixelwise)) + (min-width + ;; Sanitize MIN-WIDTH. + (if (numberp min-width) + ;; Can't get smaller than `window-safe-min-width'. (max (if pixelwise - (* char-width window-min-width) - window-min-width) - (window-min-size nil nil window pixelwise)))) - (max-width - ;; Sanitize MAX-WIDTH. - (if (numberp max-width) - (min (+ total-width - (window-max-delta - window t window nil t nil pixelwise)) - (if pixelwise - (* char-width max-width) - max-width)) - (+ total-width (window-max-delta - window t window nil t nil pixelwise)))) - ;; When fitting horizontally, assume that WINDOW's - ;; start position remains unaltered. WINDOW can't get - ;; wider than its frame's pixel width, its height - ;; remains unaltered. - (width (+ (car (window-text-pixel-size - nil (window-start) (point-max) - (frame-pixel-width) - ;; Add one char-height to assure that - ;; we're on the safe side. This - ;; overshoots when the first line below - ;; the bottom is wider than the window. - (* body-height - (if pixelwise 1 char-height)))) - (window-right-divider-width)))) - (unless pixelwise - (setq width (/ (+ width char-width -1) char-width))) - (unless (= width body-width) - (window-preserve-size window t) - (window-resize-no-error - window - (- (max min-width - (min max-width - (+ total-width (- width body-width)))) - total-width) - t window pixelwise) - (when preserve-size - (window-preserve-size window t t)))))))))) + (* char-width min-width) + min-width) + (if pixelwise + (window-safe-min-pixel-width window) + window-safe-min-width)) + ;; Preserve fringes, margins, scrollbars if present. + (max (if pixelwise + (* char-width window-min-width) + window-min-width) + (window-min-size window nil window pixelwise)))) + (max-width + ;; Sanitize MAX-WIDTH. + (if (numberp max-width) + (min (+ total-width + (window-max-delta + window t window nil t nil pixelwise)) + (if pixelwise + (* char-width max-width) + max-width)) + (+ total-width (window-max-delta + window t window nil t nil pixelwise)))) + ;; When fitting horizontally, assume that WINDOW's + ;; start position remains unaltered. WINDOW can't get + ;; wider than its frame's pixel width, its height + ;; remains unaltered. + (width (+ (car (window-text-pixel-size + window (window-start) (point-max) + (frame-pixel-width) + ;; Add one line-height to assure that + ;; we're on the safe side. This + ;; overshoots when the first line below + ;; the bottom is wider than the window. + (* (window-body-height window pixelwise) + (if pixelwise 1 char-height)))) + (- total-width + (window-body-width window pixelwise))))) + (unless pixelwise + (setq width (/ (+ width char-width -1) char-width))) + (setq width (max min-width (min max-width width))) + (unless (= width total-width) + (window-preserve-size window t) + (window-resize-no-error + window (- width total-width) t window pixelwise) + (when preserve-size + (window-preserve-size window t t))))))))) (defun window-safely-shrinkable-p (&optional window) "Return t if WINDOW can be shrunk without shrinking other windows. commit fcfe6e279774b2e5100b0a660aaa3f3f75ed0a7a Author: Lars Ingebrigtsen Date: Fri Oct 11 08:28:20 2019 +0200 Make nntp.el use new setq-local syntax * lisp/gnus/nntp.el (nntp-make-process-buffer): Convert to new setq-local syntax (as a test case). diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el index 24084a3fe0..3ddd53e46c 100644 --- a/lisp/gnus/nntp.el +++ b/lisp/gnus/nntp.el @@ -1230,13 +1230,13 @@ If SEND-IF-FORCE, only send authinfo to the server if the (format " *server %s %s %s*" nntp-address nntp-port-number buffer)) (mm-disable-multibyte) - (setq-local after-change-functions nil) - (setq-local nntp-process-wait-for nil) - (setq-local nntp-process-callback nil) - (setq-local nntp-process-to-buffer nil) - (setq-local nntp-process-start-point nil) - (setq-local nntp-process-decode nil) - (setq-local nntp-retrieval-in-progress nil) + (setq-local after-change-functions nil + nntp-process-wait-for nil + nntp-process-callback nil + nntp-process-to-buffer nil + nntp-process-start-point nil + nntp-process-decode nil + nntp-retrieval-in-progress nil) (current-buffer))) (defun nntp-open-connection (buffer) commit df713b9344e978eff4f0a6aff506932fcdb1a39c Author: Lars Ingebrigtsen Date: Fri Oct 11 08:27:50 2019 +0200 Ensure that setq-local take an even number of symbol/value pairs * doc/lispref/variables.texi (Creating Buffer-Local): Document the new syntax for setq-local. * lisp/subr.el (setq-local): Ensure that there's an even number of variable/value pairs, and expand the doc string by taking some text from `setq'. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 89dac4f7a4..76bda7874e 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -1430,11 +1430,17 @@ needed if you use the @var{local} argument to @code{add-hook} or @code{remove-hook}. @end deffn -@defmac setq-local variable value -This macro creates a buffer-local binding in the current buffer for -@var{variable}, and gives it the buffer-local value @var{value}. It -is equivalent to calling @code{make-local-variable} followed by -@code{setq}. @var{variable} should be an unquoted symbol. +@defmac setq-local &rest pairs +@var{pairs} is a list of variable and value pairs. This macro creates +a buffer-local binding in the current buffer for each of the +variables, and gives them a buffer-local value. It is equivalent to +calling @code{make-local-variable} followed by @code{setq} for each of +the variables. The variables should be unquoted symbols. + +@lisp +(setq-local var1 "value1" + var2 "value2") +@end lisp @end defmac @deffn Command make-variable-buffer-local variable diff --git a/etc/NEWS b/etc/NEWS index b680e18004..4135d47ee1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2351,6 +2351,9 @@ scrolling. * Lisp Changes in Emacs 27.1 +** 'setq-local' can now set an arbitrary number of variables, which +makes the syntax more like 'setq'. + ** 'reveal-mode' can now also be used for more than to toggle between invisible and visible: It can also toggle 'display' properties in overlays. This is only done on 'display' properties that have the diff --git a/lisp/subr.el b/lisp/subr.el index 2acac3a051..e50a52e2f5 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -143,22 +143,35 @@ of previous VARs. (push `(set-default ',(pop args) ,(pop args)) exps)) `(progn . ,(nreverse exps)))) -(defmacro setq-local (&rest args) - "Set each SYM to the value of its VAL in the current buffer. +(defmacro setq-local (&rest pairs) + "Make variables in PAIRS buffer-local and assign them the corresponding values. -\(fn [SYM VAL]...)" - ;; Can't use backquote here, it's too early in the bootstrap. - (declare (debug (symbolp form))) - (let ((expr)) - (while args +PAIRS is a list of variable/value pairs. For each variable, make +it buffer-local and assign it the corresponding value. The +variables are literal symbols and should not be quoted. + +The second VALUE is not computed until after the first VARIABLE +is set, and so on; each VALUE can use the new value of variables +set earlier in the ‘setq-local’. The return value of the +‘setq-local’ form is the value of the last VALUE. + +\(fn [VARIABLE VALUE]...)" + (declare (debug setq)) + (unless (zerop (mod (length pairs) 2)) + (error "PAIRS must have an even number of variable/value members")) + (let ((expr nil)) + (while pairs + (unless (symbolp (car pairs)) + (error "Attempting to set a non-symbol: %s" (car pairs))) + ;; Can't use backquote here, it's too early in the bootstrap. (setq expr (cons (list 'set - (list 'make-local-variable (list 'quote (car args))) - (car (cdr args))) + (list 'make-local-variable (list 'quote (car pairs))) + (car (cdr pairs))) expr)) - (setq args (cdr (cdr args)))) - (cons 'progn (nreverse expr)))) + (setq pairs (cdr (cdr pairs)))) + (macroexp-progn (nreverse expr)))) (defmacro defvar-local (var val &optional docstring) "Define VAR as a buffer-local variable with default value VAL. commit 88f0c5662d7ace5e1dd770f8f0cc489d02a5876b Author: Jordon Biondo Date: Fri Oct 11 07:58:42 2019 +0200 Allow setq-local to set more than one variable * lisp/subr.el (setq-local): Allow taking pairs of values (bug#26923). diff --git a/lisp/subr.el b/lisp/subr.el index cb59802f8b..2acac3a051 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -143,11 +143,22 @@ of previous VARs. (push `(set-default ',(pop args) ,(pop args)) exps)) `(progn . ,(nreverse exps)))) -(defmacro setq-local (var val) - "Set variable VAR to value VAL in current buffer." +(defmacro setq-local (&rest args) + "Set each SYM to the value of its VAL in the current buffer. + +\(fn [SYM VAL]...)" ;; Can't use backquote here, it's too early in the bootstrap. (declare (debug (symbolp form))) - (list 'set (list 'make-local-variable (list 'quote var)) val)) + (let ((expr)) + (while args + (setq expr + (cons + (list 'set + (list 'make-local-variable (list 'quote (car args))) + (car (cdr args))) + expr)) + (setq args (cdr (cdr args)))) + (cons 'progn (nreverse expr)))) (defmacro defvar-local (var val &optional docstring) "Define VAR as a buffer-local variable with default value VAL. commit b5d2c6ee018df3cab96d44bb50eaa933aa1d865e Author: Lars Ingebrigtsen Date: Fri Oct 11 07:46:41 2019 +0200 Remove two checkdoc tests checked in by mistake * test/lisp/emacs-lisp/checkdoc-tests.el: Remove &aux and &context checks mistakenly checked in (as these aren't implemented) (bug#37697). diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el index de75c42c52..3fbf25d708 100644 --- a/test/lisp/emacs-lisp/checkdoc-tests.el +++ b/test/lisp/emacs-lisp/checkdoc-tests.el @@ -111,13 +111,6 @@ (insert "(cl-defun foo (&key a &allow-other-keys) \"Return :A.\")") (checkdoc-defun))) -(ert-deftest checkdoc-cl-defun-with-aux-ok () - "Checkdoc should be happy with a cl-defun using &aux." - (with-temp-buffer - (emacs-lisp-mode) - (insert "(cl-defun foo (a b &aux (c (+ a b))) \"Return A and B.\")") - (checkdoc-defun))) - (ert-deftest checkdoc-cl-defun-with-default-optional-value-ok () "Checkdoc should be happy with a cl-defun using default values for optional args." (with-temp-buffer @@ -134,15 +127,6 @@ (insert "(cl-defun foo ((a b &optional c) d) \"Return A+B+C+D.\")") (checkdoc-defun))) -(ert-deftest checkdoc-cl-defmethod-with-context-ok () - "Checkdoc should ignore context specializers in a cl-defmethod." - (with-temp-buffer - (emacs-lisp-mode) - ;; A context specializer is used to select the correct method but - ;; doesn't have to appear in the docstring: - (insert "(cl-defmethod foo (a &context (global-var (eql foo))) \"Return A.\")") - (checkdoc-defun))) - (ert-deftest checkdoc-tests--next-docstring () "Checks that the one-argument form of `defvar' works. See the comments in Bug#24998." commit ffb7100750c211f55dd95811675d12a783f15d66 Author: Stefan Kangas Date: Fri Oct 11 02:15:24 2019 +0200 Change font size in correct window using mouse wheel * lisp/mwheel.el (mouse-wheel-follow-mouse): Doc fix. (mouse-wheel--get-scroll-window): New function extracted from... (mwheel-scroll): ...here. (mouse-wheel-text-scale): New function to change face height in the correct window, depending on the value of 'mouse-wheel-follows-mouse'. (Bug#28182) (mouse-wheel-mode): Bind 'mouse-wheel-text-scale' instead of 'text-scale-increase' and 'text-scale-decrease'. diff --git a/etc/NEWS b/etc/NEWS index 3b98ef7d2f..b680e18004 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2343,6 +2343,11 @@ To get the old behaviour back, customize the variable (customize-set-variable 'mouse-wheel-scroll-amount '(5 ((shift) . 1) ((control) . nil))) +By default, the font size will be changed in the window that the mouse +pointer is over. To change this behaviour, you can customize the +option 'mouse-wheel-follow-mouse'. Note that this will also affect +scrolling. + * Lisp Changes in Emacs 27.1 diff --git a/lisp/mwheel.el b/lisp/mwheel.el index 9b67e71886..e3648d9882 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el @@ -137,7 +137,8 @@ of button events." (defcustom mouse-wheel-follow-mouse t "Whether the mouse wheel should scroll the window that the mouse is over. -This can be slightly disconcerting, but some people prefer it." +This affects both the commands for scrolling and changing the +face height." :group 'mouse :type 'boolean) @@ -210,34 +211,40 @@ This can be slightly disconcerting, but some people prefer it." (intern "mouse-7")) "Event used for scrolling right.") +(defun mouse-wheel--get-scroll-window (event) + "Return window for mouse wheel event EVENT. +If `mouse-wheel-follow-mouse' is non-nil, return the window that +the mouse pointer is over. Otherwise, return the currently +active window." + (or (catch 'found + (let* ((window (if mouse-wheel-follow-mouse + (mwheel-event-window event) + (selected-window))) + (frame (when (window-live-p window) + (frame-parameter + (window-frame window) 'mouse-wheel-frame)))) + (when (frame-live-p frame) + (let* ((pos (mouse-absolute-pixel-position)) + (pos-x (car pos)) + (pos-y (cdr pos))) + (walk-window-tree + (lambda (window-1) + (let ((edges (window-edges window-1 nil t t))) + (when (and (<= (nth 0 edges) pos-x) + (<= pos-x (nth 2 edges)) + (<= (nth 1 edges) pos-y) + (<= pos-y (nth 3 edges))) + (throw 'found window-1)))) + frame nil t))))) + (mwheel-event-window event))) + (defun mwheel-scroll (event) "Scroll up or down according to the EVENT. This should be bound only to mouse buttons 4, 5, 6, and 7 on non-Windows systems." (interactive (list last-input-event)) (let* ((selected-window (selected-window)) - (scroll-window - (or (catch 'found - (let* ((window (if mouse-wheel-follow-mouse - (mwheel-event-window event) - (selected-window))) - (frame (when (window-live-p window) - (frame-parameter - (window-frame window) 'mouse-wheel-frame)))) - (when (frame-live-p frame) - (let* ((pos (mouse-absolute-pixel-position)) - (pos-x (car pos)) - (pos-y (cdr pos))) - (walk-window-tree - (lambda (window-1) - (let ((edges (window-edges window-1 nil t t))) - (when (and (<= (nth 0 edges) pos-x) - (<= pos-x (nth 2 edges)) - (<= (nth 1 edges) pos-y) - (<= pos-y (nth 3 edges))) - (throw 'found window-1)))) - frame nil t))))) - (mwheel-event-window event))) + (scroll-window (mouse-wheel--get-scroll-window event)) (old-point (and (eq scroll-window selected-window) (eq (car-safe transient-mark-mode) 'only) @@ -322,6 +329,20 @@ non-Windows systems." (put 'mwheel-scroll 'scroll-command t) +(defun mouse-wheel-text-scale (event) + "Increase or decrease the height of the default face according to the EVENT." + (interactive (list last-input-event)) + (let ((selected-window (selected-window)) + (scroll-window (mouse-wheel--get-scroll-window event)) + (button (mwheel-event-button event))) + (select-window scroll-window 'mark-for-redisplay) + (unwind-protect + (cond ((eq button mouse-wheel-down-event) + (text-scale-increase 1)) + ((eq button mouse-wheel-up-event) + (text-scale-decrease 1))) + (select-window selected-window)))) + (defvar mwheel-installed-bindings nil) (defvar mwheel-installed-text-scale-bindings nil) @@ -347,8 +368,7 @@ This is a helper function for `mouse-wheel-mode'." (mouse-wheel--remove-bindings mwheel-installed-bindings '(mwheel-scroll)) (mouse-wheel--remove-bindings mwheel-installed-text-scale-bindings - '(text-scale-increase - text-scale-decrease)) + '(mouse-wheel-text-scale)) (setq mwheel-installed-bindings nil) (setq mwheel-installed-text-scale-bindings nil) ;; Setup bindings as needed. @@ -357,12 +377,10 @@ This is a helper function for `mouse-wheel-mode'." (cond ;; Bindings for changing font size. ((and (consp binding) (eq (cdr binding) 'text-scale)) - (let ((increase-key `[,(list (caar binding) mouse-wheel-down-event)]) - (decrease-key `[,(list (caar binding) mouse-wheel-up-event)])) - (global-set-key increase-key 'text-scale-increase) - (global-set-key decrease-key 'text-scale-decrease) - (push increase-key mwheel-installed-text-scale-bindings) - (push decrease-key mwheel-installed-text-scale-bindings))) + (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event)) + (let ((key `[,(list (caar binding) event)])) + (global-set-key key 'mouse-wheel-text-scale) + (push key mwheel-installed-text-scale-bindings)))) ;; Bindings for scrolling. (t (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event commit bb392a9c8dab154cb9c80decf2ce4cf2da80e635 Author: Juri Linkov Date: Fri Oct 11 01:45:54 2019 +0300 * lisp/subr.el (ctl-x-t-prefix): Bind new alias or ctl-x-6-map to 'C-x t'. diff --git a/lisp/subr.el b/lisp/subr.el index 010443a56b..cb59802f8b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1242,6 +1242,8 @@ The normal global definition of the character C-x indirects to this keymap.") "Keymap for tab commands.") (defalias 'ctl-x-6-prefix ctl-x-6-map) (define-key ctl-x-map "6" 'ctl-x-6-prefix) +(defalias 'ctl-x-t-prefix ctl-x-6-map) +(define-key ctl-x-map "t" 'ctl-x-t-prefix) ;;;; Event manipulation functions. commit e776ba66a308d9760cfb8d05fa59bdbd2af1c2ca Author: Stefan Monnier Date: Thu Oct 10 17:44:45 2019 -0400 * lisp/tree-widget.el: Use lexical-binding Remove redundant `:group`s. (tree-widget--locate-sub-directory): Rewrite. diff --git a/lisp/tree-widget.el b/lisp/tree-widget.el index e4f73d4e94..274a1b8b81 100644 --- a/lisp/tree-widget.el +++ b/lisp/tree-widget.el @@ -1,4 +1,4 @@ -;;; tree-widget.el --- Tree widget +;;; tree-widget.el --- Tree widget -*- lexical-binding:t -*- ;; Copyright (C) 2004-2019 Free Software Foundation, Inc. @@ -126,7 +126,6 @@ (defcustom tree-widget-image-enable t "Non-nil means that tree-widget will try to use images." :type 'boolean - :group 'tree-widget :version "27.1") (defvar tree-widget-themes-load-path @@ -134,8 +133,8 @@ (let ((dir data-directory)) (and dir (list dir (expand-file-name "images" dir))))) "List of locations in which to search for the themes sub-directory. -Each element is an expression that will be recursively evaluated until -it returns a single directory or a list of directories. +Each element is an expression that returns a single directory or a list +of directories. The default is to search in the `load-path' first, then in the \"images\" sub directory in the data directory, then in the data directory. @@ -149,8 +148,7 @@ directory in the path specified by `tree-widget-themes-load-path'. The default is to use the \"tree-widget\" relative name." :type '(choice (const :tag "Default" "tree-widget") (const :tag "Where is this library" nil) - (directory :format "%{%t%}:\n%v")) - :group 'tree-widget) + (directory :format "%{%t%}:\n%v"))) (defcustom tree-widget-theme nil "Name of the theme in which to look for images. @@ -185,26 +183,22 @@ icon widgets used to draw the tree. By default these images are used: \"leaf\" Icon associated to a leaf node." :type '(choice (const :tag "Default" nil) - (string :tag "Name")) - :group 'tree-widget) + (string :tag "Name"))) (defcustom tree-widget-image-properties-emacs '(:ascent center :mask (heuristic t)) "Default properties of Emacs images." - :type 'plist - :group 'tree-widget) + :type 'plist) (defcustom tree-widget-image-properties-xemacs nil "Default properties of XEmacs images." - :type 'plist - :group 'tree-widget) + :type 'plist) (defcustom tree-widget-space-width 0.5 "Amount of space between an icon image and a node widget. Must be a valid space :width display property. See Info node `(elisp)Specified Space'." - :group 'tree-widget :type '(choice (number :tag "Multiple of normal character width") sexp)) @@ -220,7 +214,7 @@ See Info node `(elisp)Specified Space'." "Create an image of type TYPE from FILE, and return it. Give the image the specified properties PROPS." (declare (obsolete create-image "27.1")) - (apply 'create-image `(,file ,type nil ,@props))) + (apply #'create-image `(,file ,type nil ,@props))) (defsubst tree-widget-image-formats () "Return the alist of image formats/file name extensions. @@ -252,7 +246,8 @@ The default parent theme is the \"default\" theme." (when (file-accessible-directory-p dir) (throw 'found (load (expand-file-name - "tree-widget-theme-setup" dir) t))))))) + "tree-widget-theme-setup" dir) + t))))))) (defun tree-widget-set-theme (&optional name) "In the current buffer, set the theme to use for images. @@ -278,25 +273,19 @@ Typically it should contain something like this: (tree-widget-set-parent-theme name) (tree-widget-set-parent-theme "default"))) -(defun tree-widget--locate-sub-directory (name path &optional found) +(defun tree-widget--locate-sub-directory (name path) "Locate all occurrences of the sub-directory NAME in PATH. Return a list of absolute directory names in reverse order, or nil if not found." - (condition-case err - (dolist (elt path) - (setq elt (eval elt)) - (cond - ((stringp elt) - (and (file-accessible-directory-p - (setq elt (expand-file-name name elt))) - (push elt found))) - (elt - (setq found (tree-widget--locate-sub-directory - name (if (atom elt) (list elt) elt) found))))) - (error - (message "In tree-widget--locate-sub-directory: %s" - (error-message-string err)))) - found) + (let ((found '())) + (dolist (elt path) + (with-demoted-errors "In tree-widget--locate-sub-directory: %S" + (let ((dirs (eval elt t))) + (dolist (dir (if (listp dirs) dirs (list dirs))) + (and (file-accessible-directory-p + (setq dir (expand-file-name name dir))) + (push dir found)))))) + found)) (defun tree-widget-themes-path () "Return the path where to search for a theme. @@ -658,7 +647,7 @@ This hook should be local in the buffer setup to display widgets.") ;; Request children at run time, when requested. (when (and (widget-get tree :expander) (widget-apply tree :expander-p)) - (setq args (mapcar 'widget-convert + (setq args (mapcar #'widget-convert (widget-apply tree :expander))) (widget-put tree :args args)) ;; Defer the node widget creation after icon creation. commit 19e0a28c4e4a95439f28d21bf8258b47078af62e Author: Andreas Schwab Date: Thu Oct 10 18:29:03 2019 +0200 * lisp/progmodes/compile.el (compilation-transform-file-match-alist): Remove bogus Makefile match. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index b8d1acd1cc..e312def18d 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -59,8 +59,7 @@ If nil, use Emacs default." integer)) (defcustom compilation-transform-file-match-alist - '(("/bin/[a-z]*sh\\'" nil) - ("\\*+ \\[\\(Makefile\\)" "\\1")) + '(("/bin/[a-z]*sh\\'" nil)) "Alist of regexp/replacements to alter file names in compilation errors. If the replacement is nil, the file will not be considered an error after all. If not nil, it should be a regexp replacement commit fc7b20056a99221498cdf3c87beee6f437efba4d Author: Stephen Gildea Date: Thu Oct 10 09:21:38 2019 -0700 Remove tabs from time-stamp-format documentation * time-stamp.el (time-stamp-format): Untabify the doc string, so the two-column layout displays consistently in several contexts, in particular when displayed by customize-variable. diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 284dd48d4f..6da576f377 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -49,26 +49,26 @@ on the locale setting recorded in `system-time-locale' and `locale-coding-system'. The examples here are for the default \(`C') locale. -%:A weekday name: `Monday' %#A gives uppercase: `MONDAY' -%3a abbreviated weekday: `Mon' %#a gives uppercase: `MON' -%:B month name: `January' %#B gives uppercase: `JANUARY' -%3b abbreviated month: `Jan' %#b gives uppercase: `JAN' +%:A weekday name: `Monday' %#A gives uppercase: `MONDAY' +%3a abbreviated weekday: `Mon' %#a gives uppercase: `MON' +%:B month name: `January' %#B gives uppercase: `JANUARY' +%3b abbreviated month: `Jan' %#b gives uppercase: `JAN' %02d day of month %02H 24-hour clock hour %02I 12-hour clock hour %02m month number %02M minute -%#p `am' or `pm' %P gives uppercase: `AM' or `PM' +%#p `am' or `pm' %P gives uppercase: `AM' or `PM' %02S seconds %w day number of week, Sunday is 0 -%02y 2-digit year: `03' %Y 4-digit year: `2003' -%#Z lowercase time zone name: `est' %Z gives uppercase: `EST' +%02y 2-digit year: `03' %Y 4-digit year: `2003' +%#Z lowercase time zone name: `est' %Z gives uppercase: `EST' Non-date items: %% a literal percent character: `%' -%f file name without directory %F gives absolute pathname -%l login name %L full name of logged-in user -%q unqualified host name %Q fully-qualified host name +%f file name without directory %F gives absolute pathname +%l login name %L full name of logged-in user +%q unqualified host name %Q fully-qualified host name %h mail host name Decimal digits between the % and the type character specify the commit d129c10302a89ef54e871163e98579018df9e53b Author: Eli Zaretskii Date: Thu Oct 10 14:50:11 2019 +0300 Fix initial value of frame-inhibit-implied-resize * src/frame.c (syms_of_frame): Update doc string and default value of frame-inhibit-implied-resize in GTK builds to include 'tab-bar-lines. diff --git a/src/frame.c b/src/frame.c index d72dfec0cf..099db29598 100644 --- a/src/frame.c +++ b/src/frame.c @@ -6290,18 +6290,22 @@ width by the width of one scroll bar provided this option is nil and keep it unchanged if this option is either t or a list containing `vertical-scroll-bars'. -The default value is \\='(tool-bar-lines) on Lucid, Motif and Windows -\(which means that adding/removing a tool bar does not change the frame -height), nil on all other window systems including GTK+ (which means -that changing any of the parameters listed above may change the size of -the frame), and t otherwise (which means the frame size never changes -implicitly when there's no window system support). +The default value is \\='(tab-bar-lines) in GTK+, (which means that +adding/removing a tab bar does not change the frame height), +\\='(tab-bar-lines tool-bar-lines) on Lucid, Motif and Windows +\(which means that adding/removing a tool bar or tab bar does not +change the frame height), nil on all other window systems (which +means that changing any of the parameters listed above may change +the size of the frame), and t otherwise (which means the frame size +never changes implicitly when there's no window system support). Note that when a frame is not large enough to accommodate a change of any of the parameters listed above, Emacs may try to enlarge the frame even if this option is non-nil. */); #if defined (HAVE_WINDOW_SYSTEM) -#if defined (USE_LUCID) || defined (USE_MOTIF) || defined (HAVE_NTGUI) +#if defined USE_GTK + frame_inhibit_implied_resize = list1 (Qtab_bar_lines); +#elif defined (USE_LUCID) || defined (USE_MOTIF) || defined (HAVE_NTGUI) frame_inhibit_implied_resize = list2 (Qtab_bar_lines, Qtool_bar_lines); #else frame_inhibit_implied_resize = Qnil;