commit ccb8bbd581adac2cc1c770c266b5fd52da5c9402 (HEAD, refs/remotes/origin/master) Merge: 952bd2050d 33676820bd Author: Phil Sainty Date: Mon Nov 18 21:27:13 2019 +1300 Merge branch 'scratch/so-long-updates' commit 33676820bdb0fac8ebd43ab098ad13d8098f3586 Author: Phil Sainty Date: Sat Nov 16 15:48:44 2019 +1300 lisp/so-long.el: Refactor menu action commands * lisp/so-long.el (so-long-menu): Call `so-long' with an ACTION argument instead of using `so-long-menu-item-replace-action'. (so-long-menu-item-replace-action): Remove the deprecated function. * test/lisp/so-long-tests/so-long-tests.el (so-long-tests-so-long-menu-item-replace-action): Update the test. diff --git a/lisp/so-long.el b/lisp/so-long.el index e80abc76a5..33b7155d04 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -902,14 +902,19 @@ If RESET is non-nil, remove any existing values before storing the new ones." `(menu-item ,label ,(let ((sym (make-symbol "so-long-menu-item-replace-action"))) - ;; Using a symbol here, so that `describe-key' on the menu item - ;; produces the `so-long-menu-item-replace-action' documentation. - (defalias sym - (apply-partially #'so-long-menu-item-replace-action item) - (documentation #'so-long-menu-item-replace-action)) - (put sym 'interactive-form '(interactive "@")) - ;; We use "@" as commands in the mode-line menu may be - ;; triggered by mouse when some other window is selected. + ;; We make a symbol so that `describe-key' on the menu item + ;; produces something more descriptive than byte code. There is + ;; no interned `so-long-menu-item-replace-action' which might + ;; make this slightly confusing -- but only in the rare situation + ;; when someone uses `describe-key' on one of these menu items, + ;; and then wants to find more information. We mitigate this by + ;; making the following docstring very clear. + (defalias sym (lambda () (interactive "@") (so-long key)) + ;; We use "@" as commands in the mode-line menu may be + ;; triggered by mouse when some other window is selected. + "Revert the current action and invoke the chosen replacement. + +This commmand calls `so-long' with the selected action as an argument.") sym) :enable (not (and so-long--active (eq ',actionfunc so-long-function) @@ -925,20 +930,6 @@ If RESET is non-nil, remove any existing values before storing the new ones." '(menu-item "Customize" so-long-customize)) map)) -(defun so-long-menu-item-replace-action (replacement) - "Revert the current action and invoke the specified replacement. - -REPLACEMENT is a `so-long-action-alist' item." - (interactive) - (when so-long--active - (so-long-revert)) - (cl-destructuring-bind (_key _label actionfunc revertfunc) - replacement - (setq so-long-function actionfunc) - (setq so-long-revert-function revertfunc) - (setq this-command 'so-long) - (so-long))) - ;;;###autoload (defun so-long-commentary () "View the so-long documentation in `outline-mode'." diff --git a/test/lisp/so-long-tests/so-long-tests.el b/test/lisp/so-long-tests/so-long-tests.el index 5c885c4fd0..ae83442166 100644 --- a/test/lisp/so-long-tests/so-long-tests.el +++ b/test/lisp/so-long-tests/so-long-tests.el @@ -259,22 +259,24 @@ (so-long-tests-assert-and-revert (or action 'so-long-mode))))) (ert-deftest so-long-tests-so-long-menu-item-replace-action () - "Test using the `so-long-menu-item-replace-action' menu item." + "Test using the `so-long-menu' action commands." (with-temp-buffer (insert "#!emacs\n") (normal-mode) (so-long-tests-remember) (insert (make-string (1+ so-long-threshold) ?x)) - (let (action) + (let ((menu (so-long-menu)) + action + command) (dolist (item so-long-action-alist) - ;; n.b. Any existing action is first reverted. - (so-long-menu-item-replace-action item) - (setq action (car item)) + (setq action (car item) + command (lookup-key menu (vector action))) + (funcall command) (so-long-tests-assert-active action)) ;; After all actions have been used, revert to normal and assert ;; that the most recent action to have been applied is the one ;; we have just reverted. - (so-long-revert) + (funcall (lookup-key menu [so-long-revert])) (so-long-tests-assert-reverted action)))) (ert-deftest so-long-tests-major-mode () commit 83c50cc6efacf701ba64c2f4175ece7ebff9b338 Author: Phil Sainty Date: Sun Nov 17 02:11:20 2019 +1300 * lisp/so-long.el (so-long): Firstly revert the existing action, if any This makes `so-long' consistent with the action commands in the menu. If multiple actions were to be layered on top of one another, we would lose the ability to revert to the normal state. Custom actions combining multiple other actions can be defined if necessary. diff --git a/lisp/so-long.el b/lisp/so-long.el index 6928c902d1..e80abc76a5 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -1576,8 +1576,12 @@ This command is called automatically when long lines are detected, when The effects of the action can be undone by calling `so-long-revert'. -If ACTION is provided, it is used instead of `so-long-action'. With a prefix -argument, select the action to use interactively." +If ACTION is provided, it is used instead of `so-long-action'. + +With a prefix argument, select the action to use interactively. + +If an action was already active in the buffer, it will be reverted before +invoking the new action." (interactive (list (and current-prefix-arg (intern @@ -1587,6 +1591,10 @@ argument, select the action to use interactively." ;; Ensure that `so-long-deferred' only triggers `so-long' once (at most). (remove-hook 'window-configuration-change-hook #'so-long :local) (unless so-long--calling + ;; Revert the existing action, if any. + (when so-long--active + (so-long-revert)) + ;; Invoke the new action. (let ((so-long--calling t)) (so-long--ensure-enabled) ;; ACTION takes precedence if supplied. commit 6b361d95302c23dc65468ff9f5828577625e0fe2 Author: Stefan Monnier Date: Sat Nov 16 14:39:00 2019 +1300 lisp/so-long.el: Use (interactive "@") for menu commands * lisp/so-long.el (so-long-menu, so-long-menu-item-replace-action) (so-long-revert): Use interactive code "@", replacing all uses of `so-long-menu-click-window'. This approach leaves the window selected afterwards, whereas the old code did not; but that is not a problem. (so-long-menu-click-window, so-long-menu-item-revert): Remove the deprecated functions. * test/lisp/so-long-tests/so-long-tests.el (so-long-tests-so-long-menu-item-replace-action): Update the test. Co-authored-by: Phil Sainty diff --git a/lisp/so-long.el b/lisp/so-long.el index c7931e737c..6928c902d1 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -889,7 +889,7 @@ If RESET is non-nil, remove any existing values before storing the new ones." (help-map (make-sparse-keymap "Help"))) ;; `so-long-revert'. (define-key-after map [so-long-revert] - '(menu-item "Revert to normal" so-long-menu-item-revert + '(menu-item "Revert to normal" so-long-revert :enable (and so-long-revert-function so-long--active))) ;; `so-long-menu-item-replace-action' over `so-long-action-alist'. @@ -907,7 +907,9 @@ If RESET is non-nil, remove any existing values before storing the new ones." (defalias sym (apply-partially #'so-long-menu-item-replace-action item) (documentation #'so-long-menu-item-replace-action)) - (put sym 'interactive-form '(interactive)) + (put sym 'interactive-form '(interactive "@")) + ;; We use "@" as commands in the mode-line menu may be + ;; triggered by mouse when some other window is selected. sym) :enable (not (and so-long--active (eq ',actionfunc so-long-function) @@ -923,38 +925,19 @@ If RESET is non-nil, remove any existing values before storing the new ones." '(menu-item "Customize" so-long-customize)) map)) -(defun so-long-menu-click-window () - "Return the window for a click in the So Long menu. - -Commands in the mode-line menu may be triggered by mouse when some other window -is selected, so we need to make sure we are acting on the correct buffer." - ;; Refer to (info "(elisp) Click Events") regarding the form of the mouse - ;; position list for clicks in the mode line. - (or (and (mouse-event-p last-nonmenu-event) - (windowp (car (cadr last-nonmenu-event))) ; cXXXr only available - (car (cadr last-nonmenu-event))) ; since Emacs 26.1 - (selected-window))) - -(defun so-long-menu-item-revert () - "Invoke `so-long-revert'." - (interactive) - (with-selected-window (so-long-menu-click-window) - (so-long-revert))) - (defun so-long-menu-item-replace-action (replacement) "Revert the current action and invoke the specified replacement. REPLACEMENT is a `so-long-action-alist' item." (interactive) - (with-selected-window (so-long-menu-click-window) - (when so-long--active - (so-long-revert)) - (cl-destructuring-bind (_key _label actionfunc revertfunc) - replacement - (setq so-long-function actionfunc) - (setq so-long-revert-function revertfunc) - (setq this-command 'so-long) - (so-long)))) + (when so-long--active + (so-long-revert)) + (cl-destructuring-bind (_key _label actionfunc revertfunc) + replacement + (setq so-long-function actionfunc) + (setq so-long-revert-function revertfunc) + (setq this-command 'so-long) + (so-long))) ;;;###autoload (defun so-long-commentary () @@ -1644,7 +1627,9 @@ automatically by `global-so-long-mode'). For the default action, reverting will restore the original major mode, and restore the minor modes and settings which were overridden when `so-long' was invoked." - (interactive) + (interactive "@") + ;; We use "@" as commands in the mode-line menu may be triggered by mouse + ;; when some other window is selected. (unless so-long--calling (let ((so-long--calling t)) (when so-long-revert-function @@ -1653,10 +1638,6 @@ invoked." (let ((inhibit-read-only t)) (run-hooks 'so-long-revert-hook))))) -;; Duplicate the `so-long-revert' documentation for the menu item. -(put 'so-long-menu-item-revert 'function-documentation - (documentation 'so-long-revert t)) - ;;;###autoload (defun so-long-enable () "Enable the so-long library's functionality. @@ -1878,10 +1859,10 @@ If it appears in `%s', you should remove it." ; LocalWords: customize customized customizing Customization globalized amongst ; LocalWords: initialized profiler boolean minified pre redisplay config keymap ; LocalWords: noerror selectable mapc sgml nxml hl flydiff defs arg Phil Sainty -; LocalWords: defadvice nadvice whitespace ie bos eos eobp origmode un Un cXXXr +; LocalWords: defadvice nadvice whitespace ie bos eos eobp origmode un Un setq ; LocalWords: docstring auf wiedersehen longlines alist autoload Refactored Inc ; LocalWords: MERCHANTABILITY RET REGEXP VAR ELPA WS mitigations EmacsWiki eval -; LocalWords: setq rx filename filenames +; LocalWords: rx filename filenames ;; So long, farewell, auf wiedersehen, goodbye ;; You have to go, this code is minified diff --git a/test/lisp/so-long-tests/so-long-tests.el b/test/lisp/so-long-tests/so-long-tests.el index 99af5e91ba..5c885c4fd0 100644 --- a/test/lisp/so-long-tests/so-long-tests.el +++ b/test/lisp/so-long-tests/so-long-tests.el @@ -261,10 +261,6 @@ (ert-deftest so-long-tests-so-long-menu-item-replace-action () "Test using the `so-long-menu-item-replace-action' menu item." (with-temp-buffer - ;; Due to (with-selected-window (so-long-menu-click-window) ...) - ;; (used by `so-long-menu-item-replace-action'), our temp buffer - ;; must be in the selected window. - (set-window-buffer nil (current-buffer)) (insert "#!emacs\n") (normal-mode) (so-long-tests-remember) @@ -278,7 +274,7 @@ ;; After all actions have been used, revert to normal and assert ;; that the most recent action to have been applied is the one ;; we have just reverted. - (so-long-menu-item-revert) + (so-long-revert) (so-long-tests-assert-reverted action)))) (ert-deftest so-long-tests-major-mode () commit 206f36b38cfe50e92acc8d48926d1e5e2dec5939 Author: Stefan Monnier Date: Sat Nov 16 14:35:36 2019 +1300 ; * lisp/so-long.el: Use declare-function nearer the code that needs it diff --git a/lisp/so-long.el b/lisp/so-long.el index 208bdf4ce9..c7931e737c 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -415,15 +415,6 @@ (declare-function longlines-mode "longlines") (defvar longlines-mode) - -(declare-function outline-next-visible-heading "outline") -(declare-function outline-previous-visible-heading "outline") -(declare-function outline-toggle-children "outline") -(declare-function outline-toggle-children "outline") - -(declare-function ad-find-advice "advice") -(declare-function ad-remove-advice "advice") - (defvar so-long-enabled nil "Set to nil to prevent `so-long' from being triggered automatically. @@ -985,6 +976,10 @@ REPLACEMENT is a `so-long-action-alist' item." (rename-buffer buf) ;; Enable `outline-mode' and `view-mode' for user convenience. (outline-mode) + (declare-function outline-next-visible-heading "outline") + (declare-function outline-previous-visible-heading "outline") + (declare-function outline-toggle-children "outline") + (declare-function outline-toggle-children "outline") (view-mode 1) ;; Add some custom local bindings. (let ((map (make-sparse-keymap))) @@ -1832,6 +1827,8 @@ If it appears in `%s', you should remove it." (when (version< so-long-version "1.0") (remove-hook 'change-major-mode-hook 'so-long-change-major-mode) (require 'advice) + (declare-function ad-find-advice "advice") + (declare-function ad-remove-advice "advice") (when (ad-find-advice 'hack-local-variables 'after 'so-long--file-local-mode) (ad-remove-advice 'hack-local-variables 'after 'so-long--file-local-mode) (ad-activate 'hack-local-variables)) commit bf7934a63de50c8913d0304371ba404d81d540bd Author: Stefan Monnier Date: Sat Nov 16 14:35:07 2019 +1300 ; * lisp/so-long.el: Use function quoting in example configuration diff --git a/lisp/so-long.el b/lisp/so-long.el index f696e06d61..208bdf4ce9 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -272,13 +272,13 @@ ;; (setq so-long-threshold 1000) ;; (setq so-long-max-lines 100) ;; ;; Additional target major modes to trigger for. -;; (mapc (apply-partially 'add-to-list 'so-long-target-modes) +;; (mapc (apply-partially #'add-to-list 'so-long-target-modes) ;; '(sgml-mode nxml-mode)) ;; ;; Additional buffer-local minor modes to disable. -;; (mapc (apply-partially 'add-to-list 'so-long-minor-modes) +;; (mapc (apply-partially #'add-to-list 'so-long-minor-modes) ;; '(diff-hl-mode diff-hl-amend-mode diff-hl-flydiff-mode)) ;; ;; Additional variables to override. -;; (mapc (apply-partially 'add-to-list 'so-long-variable-overrides) +;; (mapc (apply-partially #'add-to-list 'so-long-variable-overrides) ;; '((show-trailing-whitespace . nil) ;; (truncate-lines . nil)))) commit 62187142b9e71d73ad7d1ddafb4a33bf72bcaa15 Author: Stefan Monnier Date: Sat Nov 16 14:32:09 2019 +1300 ; * lisp/so-long.el: Delete redundant :group declarations Refer to (elisp) Common Keywords: > If this keyword is missing from a customization item, it’ll be > placed in the same group that was last defined (in the current file). diff --git a/lisp/so-long.el b/lisp/so-long.el index 7d54594dd3..f696e06d61 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -463,8 +463,7 @@ Has no effect if `global-so-long-mode' is not enabled.") See `so-long-detected-long-line-p' for details." :type 'integer - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defcustom so-long-max-lines 5 "Number of non-blank, non-comment lines to test for excessive length. @@ -478,8 +477,7 @@ be counted. See `so-long-detected-long-line-p' for details." :type '(choice (integer :tag "Limit") (const :tag "Unlimited" nil)) - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defcustom so-long-skip-leading-comments t "Non-nil to ignore all leading comments and whitespace. @@ -490,8 +488,7 @@ comments following the shebang will be ignored. See `so-long-detected-long-line-p' for details." :type 'boolean - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defcustom so-long-target-modes '(prog-mode css-mode sgml-mode nxml-mode) @@ -507,8 +504,7 @@ files would prevent Emacs from handling them correctly." ;; Use 'symbol', as 'function' may be unknown => mismatch. :type '(choice (repeat :tag "Specified modes" symbol) (const :tag "All modes" t)) - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defcustom so-long-invisible-buffer-function #'so-long-deferred "Function called in place of `so-long' when the buffer is not displayed. @@ -538,8 +534,7 @@ the mentioned options might interfere with some intended processing." :type '(radio (const so-long-deferred) (const :tag "nil: Call so-long as normal" nil) (function :tag "Custom function")) - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defcustom so-long-predicate 'so-long-detected-long-line-p "Function, called after `set-auto-mode' to decide whether action is needed. @@ -552,8 +547,7 @@ then `so-long' will be invoked. Defaults to `so-long-detected-long-line-p'." :type '(radio (const so-long-detected-long-line-p) (function :tag "Custom function")) - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) ;; Silence byte-compiler warning. `so-long-action-alist' is defined below ;; as a user option; but the definition sequence required for its setter @@ -605,8 +599,7 @@ subsequently called." (function :tag "Action") (function :tag "Revert"))) :set #'so-long--action-alist-setter - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (put 'so-long-action-alist 'risky-local-variable t) (defcustom so-long-action 'so-long-mode @@ -630,8 +623,7 @@ Each action likewise determines the behaviour of `so-long-revert'. If the value is nil, or not defined in `so-long-action-alist', then no action will be taken." :type (so-long--action-type) - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defvar-local so-long-function nil "The function called by `so-long'. @@ -701,8 +693,7 @@ an example." (const so-long-inhibit) (const :tag "nil: Use so-long-function as normal" nil) (function :tag "Custom function")) - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (make-variable-buffer-local 'so-long-file-local-mode-function) ;; `provided-mode-derived-p' was added in 26.1 @@ -779,8 +770,7 @@ disabled modes are re-enabled by calling them with the numeric argument 1. Please submit bug reports to recommend additional modes for this list, whether they are in Emacs core, GNU ELPA, or elsewhere." :type '(repeat symbol) ;; not function, as may be unknown => mismatch. - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defcustom so-long-variable-overrides '((bidi-paragraph-direction . left-to-right) @@ -813,24 +803,21 @@ scanned to find the next position." (show-paren-mode boolean) (truncate-lines boolean) (which-func-mode boolean)) - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defcustom so-long-hook nil "List of functions to call after `so-long' is called. See also `so-long-revert-hook'." :type 'hook - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defcustom so-long-revert-hook nil "List of functions to call after `so-long-revert' is called. See also `so-long-hook'." :type 'hook - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defcustom so-long-mode-line-label "So Long" "Text label of `so-long-mode-line-info' when long lines are detected. @@ -838,20 +825,17 @@ See also `so-long-hook'." If nil, no mode line indicator will be displayed." :type '(choice (string :tag "String") (const :tag "None" nil)) - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defface so-long-mode-line-active '((t :inherit mode-line-emphasis)) "Face for `so-long-mode-line-info' when mitigations are active." - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) (defface so-long-mode-line-inactive '((t :inherit mode-line-inactive)) "Face for `so-long-mode-line-info' when mitigations have been reverted." - :package-version '(so-long . "1.0") - :group 'so-long) + :package-version '(so-long . "1.0")) ;; Modes that go slowly and line lengths excessive ;; Font-lock performance becoming oppressive commit 952bd2050d7a9b48ed4d7413248ef467d7992077 Author: Lars Ingebrigtsen Date: Mon Nov 18 08:24:52 2019 +0100 Remove the error-out test for with_harfbuzz * configure.ac (HAVE_HARFBUZZ): Remove the check for explicit harfbuzz -- have_harfbuzz defaults to "yes", so we have no way of checking whether the user really asked for it, apparently. diff --git a/configure.ac b/configure.ac index 0976b665e6..3b6a2a6d16 100644 --- a/configure.ac +++ b/configure.ac @@ -3469,11 +3469,6 @@ if test "${HAVE_X11}" = "yes" && test "${HAVE_FREETYPE}" = "yes" \ fi fi -# The user explicitly asked for HarfBuzz, but it won't be used. -if test "${with_harfbuzz}" == "yes" && test "$HAVE_HARFBUZZ" != "yes"; then - AC_MSG_ERROR([HarfBuzz wanted, but won't be used. Maybe some library files are missing?]); -fi - ### End of font-backend section. AC_SUBST(FREETYPE_CFLAGS) commit 0b47d731c08d0d5d4ba4a0c31f9be1152fd8c2c8 Author: Paul Eggert Date: Sun Nov 17 15:26:55 2019 -0800 * lisp/simple.el (process-file): Clarify doc string. diff --git a/lisp/simple.el b/lisp/simple.el index 8229899f9a..c61ccd511c 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4007,14 +4007,13 @@ subprocess is `default-directory'. If PROGRAM is a remote file name, it should be processed by `file-local-name' before passing it to this function. -File names in INFILE and BUFFER are handled normally, but file -names in ARGS should be relative to `default-directory', as they -are passed to the process verbatim. (This is a difference from -`call-process', which does not support file name handlers for INFILE -and BUFFER.) - -Some file name handlers might not support all variants, for example -they might behave as if DISPLAY was nil, regardless of the actual +Handle file names in INFILE and BUFFER normally; this differs +from `call-process', which does not support file name handlers +for INFILE and BUFFER. However, pass ARGS to the process +verbatim without file name handling, as `call-process' does. + +Some file name handlers might not support all variants. For +example, they might treat DISPLAY as nil regardless of the actual value passed." (let ((fh (find-file-name-handler default-directory 'process-file)) lc stderr-file) commit 0415ad210c8c99e771b6273b6f683fe3f3614c6f Author: Stefan Monnier Date: Sun Nov 17 17:34:50 2019 -0500 * lisp/tmm.el (tmm-add-one-shortcut): Use dolist diff --git a/lisp/tmm.el b/lisp/tmm.el index c1c863876b..a5eefaaa66 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -112,8 +112,7 @@ See the documentation for `tmm-prompt'." "String to insert between shortcut and menu item. If nil, there will be no shortcuts. It should not consist only of spaces, or else the correct item might not be found in the `*Completions*' buffer." - :type 'string - :group 'tmm) + :type 'string) (defvar tmm-mb-map nil "A place to store minibuffer map.") @@ -127,8 +126,7 @@ marked letters to pick up your choice. Type C-g or ESC ESC ESC to cancel. "Help text to insert on the top of the completion buffer. To save space, you can set this to nil, in which case the standard introduction text is deleted too." - :type '(choice string (const nil)) - :group 'tmm) + :type '(choice string (const nil))) (defcustom tmm-shortcut-style '(downcase upcase) "What letters to use as menu shortcuts. @@ -136,20 +134,17 @@ Must be either one of the symbols `downcase' or `upcase', or else a list of the two in the order you prefer." :type '(choice (const downcase) (const upcase) - (repeat (choice (const downcase) (const upcase)))) - :group 'tmm) + (repeat (choice (const downcase) (const upcase))))) (defcustom tmm-shortcut-words 2 "How many successive words to try for shortcuts, nil means all. If you use only one of `downcase' or `upcase' for `tmm-shortcut-style', specify nil for this variable." - :type '(choice integer (const nil)) - :group 'tmm) + :type '(choice integer (const nil))) (defface tmm-inactive '((t :inherit shadow)) - "Face used for inactive menu items." - :group 'tmm) + "Face used for inactive menu items.") (defun tmm--completion-table (items) (lambda (string pred action) @@ -296,10 +291,10 @@ Takes a list of lists with a string as car, returns list with shortcuts added to these cars. Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." (let ((tmm-next-shortcut-digit ?0)) - (mapcar 'tmm-add-one-shortcut (reverse list)))) + (mapcar #'tmm-add-one-shortcut (reverse list)))) (defsubst tmm-add-one-shortcut (elt) -;; uses the free vars tmm-next-shortcut-digit and tmm-short-cuts + ;; uses the free vars tmm-next-shortcut-digit and tmm-short-cuts (cond ((eq (cddr elt) 'ignore) (cons (concat " " (make-string (length tmm-mid-prompt) ?\-) @@ -316,14 +311,12 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." (not (and paren (> pos paren)))) ; don't go past "(binding.." (if (or (= pos 0) (/= (aref str (1- pos)) ?.)) ; avoid file extensions - (let ((shortcut-style - (if (listp tmm-shortcut-style) ; convert to list - tmm-shortcut-style - (list tmm-shortcut-style)))) - (while shortcut-style ; try upcase and downcase variants - (setq char (funcall (car shortcut-style) (aref str pos))) - (if (not (memq char tmm-short-cuts)) (throw 'done char)) - (setq shortcut-style (cdr shortcut-style))))) + (dolist (shortcut-style ; try upcase and downcase variants + (if (listp tmm-shortcut-style) ; convert to list + tmm-shortcut-style + (list tmm-shortcut-style))) + (setq char (funcall shortcut-style (aref str pos))) + (if (not (memq char tmm-short-cuts)) (throw 'done char)))) (setq word (1+ word)) (setq pos (match-end 0))) (while (<= tmm-next-shortcut-digit ?9) ; no letter shortcut, pick a digit @@ -386,10 +379,10 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." (setq tmm-old-mb-map (tmm-define-keys t)) (or tmm-completion-prompt (add-hook 'completion-setup-hook - 'tmm-completion-delete-prompt 'append)) + #'tmm-completion-delete-prompt 'append)) (unwind-protect (minibuffer-completion-help) - (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt)) + (remove-hook 'completion-setup-hook #'tmm-completion-delete-prompt)) (with-current-buffer "*Completions*" (tmm-remove-inactive-mouse-face) (when tmm-completion-prompt commit 4e4e5508582b1b5a2e738f4490400f2d78a5f343 Author: Juri Linkov Date: Sun Nov 17 23:51:55 2019 +0200 * lisp/subr.el (read-char-from-minibuffer, y-or-n-p): Remove discard-input. (do-after-load-evaluation): Replace run-with-timer with run-with-idle-timer to give a chance for the minibuffer to handle initial events before sit-for. https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00581.html diff --git a/lisp/subr.el b/lisp/subr.el index eaec223585..20daed623f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2707,7 +2707,6 @@ When CHARS is non-nil, any input that is not one of CHARS is ignored. When HISTORY is a symbol, then allows navigating in a history. The navigation commands are `M-p' and `M-n', with `RET' to select a character from history." - (discard-input) (let* ((empty-history '()) (map (if (consp chars) (or (gethash chars read-char-from-minibuffer-map-hash) @@ -2847,7 +2846,6 @@ is nil and `use-dialog-box' is non-nil." answer (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip))))) (t (setq prompt (funcall padded prompt)) - (discard-input) (let* ((empty-history '()) (str (read-from-minibuffer prompt nil @@ -4622,7 +4620,7 @@ This function is called directly from the C code." byte-compile-current-file byte-compile-root-dir))) (byte-compile-warn "%s" msg)) - (run-with-timer 0 nil + (run-with-idle-timer 0 nil (lambda (msg) (minibuffer-message "%s" msg)) msg))))) commit a8f2ee424ce895caff15f1ff973e241b8a946aba Author: Juri Linkov Date: Sun Nov 17 23:43:28 2019 +0200 Auto-scrolling in tab-line (bug#37667) * lisp/tab-line.el (tab-line-auto-hscroll): New function. (tab-line-format): Use tab-line-auto-hscroll. diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 7701498ae2..b99e726329 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -357,8 +357,6 @@ If the major mode's name string matches REGEXP, use GROUPNAME instead.") (set-window-parameter nil 'tab-line-group nil)))) (group-tab `(tab (name . ,group) - ;; Just to highlight the current group name - (selected . t) (select . ,(lambda () (set-window-parameter nil 'tab-line-groups t) (set-window-parameter nil 'tab-line-group group) @@ -445,26 +443,76 @@ variable `tab-line-tabs-function'." tab-line-close-button) "")) `( tab ,tab + ,@(if selected-p '(selected t)) face ,(if selected-p (if (eq (selected-window) (old-selected-window)) 'tab-line-tab-current 'tab-line-tab) 'tab-line-tab-inactive) mouse-face tab-line-highlight))))) - tabs))) + tabs)) + (hscroll-data (tab-line-auto-hscroll strings hscroll))) + (setq hscroll (nth 1 hscroll-data)) (append - (list separator - (when (and (natnump hscroll) (> hscroll 0)) - tab-line-left-button) - (when (if (natnump hscroll) - (< hscroll (1- (length strings))) - (> (length strings) 1)) - tab-line-right-button)) - (if hscroll (nthcdr hscroll strings) strings) + (if (null (nth 0 hscroll-data)) + (when hscroll + (setq hscroll nil) + (set-window-parameter nil 'tab-line-hscroll hscroll)) + (list separator + (when (and (integerp hscroll) (not (zerop hscroll))) + tab-line-left-button) + (when (if (integerp hscroll) + (< (abs hscroll) (1- (length strings))) + (> (length strings) 1)) + tab-line-right-button))) + (if hscroll (nthcdr (abs hscroll) strings) strings) (when (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) (list (concat separator (when tab-line-new-tab-choice tab-line-new-button))))))) + +(defun tab-line-auto-hscroll (strings hscroll) + (with-temp-buffer + (let ((truncate-partial-width-windows nil) + (inhibit-modification-hooks t) + show-arrows) + (setq truncate-lines nil + buffer-undo-list t) + (apply 'insert strings) + (goto-char (point-min)) + (add-face-text-property (point-min) (point-max) 'tab-line) + ;; Continuation means tab-line doesn't fit completely, + ;; thus scroll arrows are needed for scrolling. + (setq show-arrows (> (vertical-motion 1) 0)) + ;; Try to auto-scroll only when scrolling is needed, + ;; but no manual scrolling was performed before. + (when (and show-arrows (not (and (integerp hscroll) (>= hscroll 0)))) + (let ((pos (seq-position strings 'selected + (lambda (str prop) + (get-pos-property 1 prop str))))) + ;; Do nothing if no tab is selected. + (when pos + ;; Check if the selected tab is already visible. + (erase-buffer) + (apply 'insert (reverse + (if (and (integerp hscroll) (>= pos (abs hscroll))) + (nthcdr (abs hscroll) strings) + strings))) + (goto-char (point-min)) + (add-face-text-property (point-min) (point-max) 'tab-line) + (when (> (vertical-motion 1) 0) + (let* ((point (previous-single-property-change (point) 'tab)) + (tab-prop (or (get-pos-property point 'tab) + (get-pos-property + (previous-single-property-change point 'tab) 'tab))) + (new (seq-position strings tab-prop + (lambda (str tab) + (eq (get-pos-property 1 'tab str) tab))))) + (when new + (setq hscroll (- new)) + (set-window-parameter nil 'tab-line-hscroll hscroll))))))) + (list show-arrows hscroll)))) + (defun tab-line-hscroll (&optional arg window) (let* ((hscroll (window-parameter window 'tab-line-hscroll)) @@ -473,7 +521,7 @@ variable `tab-line-tabs-function'." (funcall tab-line-tabs-function)))) (set-window-parameter window 'tab-line-hscroll - (max 0 (min (+ (or hscroll 0) (or arg 1)) + (max 0 (min (+ (if (integerp hscroll) (abs hscroll) 0) (or arg 1)) (1- (length tabs))))) (when window (force-mode-line-update t)))) commit 3fdc36eecb3ab468eb0a55cc09a176ab503d31c3 Author: Lars Ingebrigtsen Date: Sun Nov 17 19:02:54 2019 +0100 Error out on --with-harfbuzz without HarfBuzz support * configure.ac: Error out if the user says --with-harfbuzz, but HarfBuzz isn't available. diff --git a/configure.ac b/configure.ac index 3b6a2a6d16..0976b665e6 100644 --- a/configure.ac +++ b/configure.ac @@ -3469,6 +3469,11 @@ if test "${HAVE_X11}" = "yes" && test "${HAVE_FREETYPE}" = "yes" \ fi fi +# The user explicitly asked for HarfBuzz, but it won't be used. +if test "${with_harfbuzz}" == "yes" && test "$HAVE_HARFBUZZ" != "yes"; then + AC_MSG_ERROR([HarfBuzz wanted, but won't be used. Maybe some library files are missing?]); +fi + ### End of font-backend section. AC_SUBST(FREETYPE_CFLAGS) commit 1c29ba034092660e73bce8c6ff459c75ff2c2d72 Author: Lars Ingebrigtsen Date: Sun Nov 17 17:32:37 2019 +0100 Handle FC_CHARCELL in xftfont_open * src/xftfont.c (xftfont_open): FC_CHARCELL is apparently an alias for FC_DUAL used in some east Asian fonts (bug#35079). Modelled after a patch suggested by Kenichi Handa. diff --git a/src/xftfont.c b/src/xftfont.c index e003580817..fa06d96736 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -211,6 +211,9 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size) #ifdef FC_DUAL && spacing != FC_DUAL #endif /* FC_DUAL */ +#ifdef FC_CHARCELL + && spacing != FC_CHARCELL +#endif /* FC_CHARCELL */ ) { font->min_width = font->max_width = font->average_width commit b31f1987eb27a69d7c0eab9cce6eab8ba0857ec1 Author: Eli Zaretskii Date: Sun Nov 17 18:19:18 2019 +0200 Support more font weight values on MS-Windows * src/w32font.c (w32_to_fc_weight): Support a few more weight values, for compatibility with the GTK font selection widget (see gtkutil.c:XG_WEIGHT_TO_SYMBOL). (Bug#24226) diff --git a/src/w32font.c b/src/w32font.c index 9a334717c1..60020eab4a 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -2000,11 +2000,14 @@ w32_encode_weight (int n) static Lisp_Object w32_to_fc_weight (int n) { - if (n >= FW_EXTRABOLD) return intern ("black"); + if (n >= FW_HEAVY) return intern ("black"); + if (n >= FW_EXTRABOLD) return Qextra_bold; if (n >= FW_BOLD) return Qbold; if (n >= FW_SEMIBOLD) return intern ("demibold"); if (n >= FW_NORMAL) return intern ("medium"); - return Qlight; + if (n >= FW_LIGHT) return Qlight; + if (n >= FW_EXTRALIGHT) return Qextra_light; + return intern ("thin"); } /* Fill in all the available details of LOGFONT from FONT_SPEC. */ commit 7c6335de5e0ac4176911a39bad5344028f39b8ff Author: Alan Mackenzie Date: Sun Nov 17 14:59:42 2019 +0000 Compilation Mode: Fix arrow handling when compilation-context-lines is t In particular, fix some exception occurrences, fix handling of a Compilation Mode buffer being displayed in several windows, and fix the margin when temporarily displaying a different buffer in a window, then returning to the compilation mode buffer. The fix is relevant for frames without fringes, e.g. tty frames. * lisp/progmodes/compile.el: (compilation-set-window): Always set point to (parameter) MK. (compilation--set-up-margin, compilation--tear-down-margin): New functions. (compilation--set-up-arrow-spec-in-margins) (compilation--tear-down-arrow-spec-in-margins): Renamed by introducing -- and pluralising margin to margins. Handle the margins in _all_ windows displaying the pertinent buffer by using get-buffer-window-list. In ...--set-up-... add compilation--set-up-margin to window-buffer-change-functions. In ...--tear-down-... remove the hook functions added in ...--set-up-.... diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 5a3386f227..3fbd6eb2c7 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -2646,15 +2646,14 @@ column zero points to the current message." (compilation-beginning-of-line (- 1 compilation-context-lines)) (point)))) - ((eq compilation-context-lines t)) - ;; If there is no left fringe. - ((equal (car (window-fringes w)) 0) + ((and (null compilation-context-lines) + ;; If there is no left fringe. + (equal (car (window-fringes w)) 0)) (set-window-start w (save-excursion (goto-char mk) (beginning-of-line 1) - (point))) - (set-window-point w mk)) - (t (set-window-point w mk)))) + (point))))) + (set-window-point w mk)) (defvar-local compilation-arrow-overlay nil "Overlay with the before-string property of `overlay-arrow-string'. @@ -2671,25 +2670,39 @@ at the overlay's start position.") "A string which is only a placeholder for `compilation--margin-string'. Actual value is never used, only the text property.") -(defun compilation-set-up-arrow-spec-in-margin () - "Set up compilation-arrow-overlay to display as an arrow in a margin." +(defun compilation--set-up-margin (w) + "Setup the margin for \"=>\" in window W if it isn't already set up." + (set-window-margins w (+ (or (car (window-margins w)) 0) 2))) + +(defun compilation--tear-down-margin (w) + "Remove the margin for \"=>\" if it is setup in window W." + (when (window-margins w) + (set-window-margins w (- (car (window-margins w)) 2)))) + +(defun compilation--set-up-arrow-spec-in-margins () + "Set up compilation-arrow-overlay to display as an arrow in margins." (setq overlay-arrow-string "") (setq compilation-arrow-overlay (make-overlay overlay-arrow-position overlay-arrow-position)) (overlay-put compilation-arrow-overlay 'before-string compilation--dummy-string) - (set-window-margins (selected-window) (+ (or (car (window-margins)) 0) 2)) + (mapc #'compilation--set-up-margin (get-buffer-window-list nil nil t)) + (add-hook 'window-buffer-change-functions #'compilation--set-up-margin nil t) ;; Take precautions against `compilation-mode' getting reinitialized. (add-hook 'change-major-mode-hook - 'compilation-tear-down-arrow-spec-in-margin nil t)) + #'compilation--tear-down-arrow-spec-in-margins nil t)) -(defun compilation-tear-down-arrow-spec-in-margin () - "Restore compilation-arrow-overlay to not using the margin, which is removed." +(defun compilation--tear-down-arrow-spec-in-margins () + "Restore compilation-arrow-overlay to not using the margins, which are removed." (when (overlayp compilation-arrow-overlay) (overlay-put compilation-arrow-overlay 'before-string nil) (delete-overlay compilation-arrow-overlay) (setq compilation-arrow-overlay nil) - (set-window-margins (selected-window) (- (car (window-margins)) 2)))) + (mapc #'compilation--tear-down-margin (get-buffer-window-list nil nil t)) + (remove-hook 'change-major-mode-hook + #'compilation--tear-down-arrow-spec-in-margins t) + (remove-hook 'window-buffer-change-functions + #'compilation--set-up-margin t))) (defun compilation-set-overlay-arrow (w) "Set up, or switch off, the overlay-arrow for window W." @@ -2707,10 +2720,10 @@ Actual value is never used, only the text property.") (if overlay-arrow-position (move-overlay compilation-arrow-overlay overlay-arrow-position overlay-arrow-position) - (compilation-tear-down-arrow-spec-in-margin)))) + (compilation--tear-down-arrow-spec-in-margins)))) (overlay-arrow-position - (compilation-set-up-arrow-spec-in-margin))) + (compilation--set-up-arrow-spec-in-margins))) ;; Ensure that the "=>" remains in the window by causing ;; the window to be scrolled, if needed. (goto-char (overlay-start compilation-arrow-overlay))) @@ -2718,7 +2731,7 @@ Actual value is never used, only the text property.") ;; `compilation-context-lines' isn't t, or we've got a left ;; fringe, so remove any overlay arrow. (when (overlayp compilation-arrow-overlay) - (compilation-tear-down-arrow-spec-in-margin))))) + (compilation--tear-down-arrow-spec-in-margins))))) (defvar next-error-highlight-timer) commit 58ceb8bac0bcd9907ca8ff8fd37d5a6c2ce282ca Author: Lars Ingebrigtsen Date: Sun Nov 17 10:40:11 2019 +0100 Make ido-read-file-name respect ido-read-file-name-non-ido more * lisp/ido.el (ido-read-file-name): Respect ido-read-file-name-non-ido in the file-directory-p case, too (bug#38231). diff --git a/lisp/ido.el b/lisp/ido.el index 2a660e6b0c..79f259b819 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -4906,10 +4906,12 @@ Read file name, prompting with PROMPT and completing in directory DIR. See `read-file-name' for additional parameters." (let (filename) (cond - ((or (eq predicate 'file-directory-p) - (eq (and (symbolp this-command) - (get this-command 'ido)) 'dir) - (memq this-command ido-read-file-name-as-directory-commands)) + ((and (not (memq this-command ido-read-file-name-non-ido)) + (or (eq predicate 'file-directory-p) + (eq (and (symbolp this-command) + (get this-command 'ido)) + 'dir) + (memq this-command ido-read-file-name-as-directory-commands))) (setq filename (ido-read-directory-name prompt dir default-filename mustmatch initial))) ((and (not (eq (and (symbolp this-command)