commit 2053c6aca170f6ced8928b38328a22604171d8b7 (HEAD, refs/remotes/origin/master) Merge: f39d25d5fe d91ffdbec2 Author: Stefan Kangas Date: Tue Aug 9 06:30:25 2022 +0200 Merge from origin/emacs-28 d91ffdbec2 Don't mention XEmacs toolbar in ediff manual commit f39d25d5fe2577493ec5718d11b57d1511de4f7f Author: Po Lu Date: Tue Aug 9 11:06:06 2022 +0800 Fix handling of XI_DeviceChanged events * src/xterm.c (xi_get_scroll_valuator): New function. (xi_handle_device_changed): New function. (handle_one_xevent): Factor out most of the device changed code to that function, and make it specifically query for the device information. (bug#57020) diff --git a/src/xterm.c b/src/xterm.c index 36797bc0ab..7b90f8b481 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -12705,6 +12705,151 @@ xi_handle_interaction (struct x_display_info *dpyinfo, xi_handle_focus_change (dpyinfo); } +#ifdef HAVE_XINPUT2_1 + +/* Look up a scroll valuator in DEVICE by NUMBER. */ + +static struct xi_scroll_valuator_t * +xi_get_scroll_valuator (struct xi_device_t *device, int number) +{ + int i; + + for (i = 0; i < device->scroll_valuator_count; ++i) + { + if (device->valuators[i].number == number) + return &device->valuators[i]; + } + + return NULL; +} + +#endif + +/* Handle EVENT, a DeviceChanged event. Look up the device that + changed, and update its information with the data in EVENT. */ + +static void +xi_handle_device_changed (struct x_display_info *dpyinfo, + struct xi_device_t *device, + XIDeviceChangedEvent *event) +{ +#ifdef HAVE_XINPUT2_1 + XIDeviceInfo *info; + XIScrollClassInfo *scroll; + int i, ndevices; + struct xi_scroll_valuator_t *valuator; + XIValuatorClassInfo *valuator_info; +#endif +#ifdef HAVE_XINPUT2_2 + struct xi_touch_point_t *tem, *last; + XITouchClassInfo *touch; +#endif + +#ifdef HAVE_XINPUT2_1 + /* When a DeviceChange event is received for a master device, we + don't get any scroll valuators along with it. This is possibly + an X server bug but I really don't want to dig any further, so + fetch the scroll valuators manually. (bug#57020) */ + + x_catch_errors (dpyinfo->display); + info = XIQueryDevice (dpyinfo->display, event->deviceid, + /* ndevices is always 1 if a deviceid is + specified. If the request fails, NULL will + be returned. */ + &ndevices); + x_uncatch_errors (); + + if (info) + { + device->valuators = xrealloc (device->valuators, + (info->num_classes + * sizeof *device->valuators)); + device->scroll_valuator_count = 0; +#ifdef HAVE_XINPUT2_2 + device->direct_p = false; +#endif + + for (i = 0; i < info->num_classes; ++i) + { + switch (info->classes[i]->type) + { + case XIScrollClass: + scroll = (XIScrollClassInfo *) info->classes[i]; + + valuator = &device->valuators[device->scroll_valuator_count++]; + valuator->horizontal = (scroll->scroll_type + == XIScrollTypeHorizontal); + valuator->invalid_p = true; + valuator->emacs_value = DBL_MIN; + valuator->increment = scroll->increment; + valuator->number = scroll->number; + break; + +#ifdef HAVE_XINPUT2_2 + case XITouchClass: + touch = (XITouchClassInfo *) info->classes[i]; + + if (touch->mode == XIDirectTouch) + device->direct_p = true; + break; +#endif + } + } + + /* Restore the values of any scroll valuators that we already + know about. */ + + for (i = 0; i < info->num_classes; ++i) + { + switch (info->classes[i]->type) + { + case XIValuatorClass: + valuator_info = (XIValuatorClassInfo *) info->classes[i]; + + valuator = xi_get_scroll_valuator (device, + valuator_info->number); + if (valuator) + { + valuator->invalid_p = false; + valuator->current_value = valuator_info->value; + + /* Make sure that this is reset if the pointer moves + into a window of ours. + + Otherwise the valuator state could be left + invalid if the DeviceChange event happened with + the pointer outside any Emacs frame. */ + valuator->pending_enter_reset = true; + } + + break; + } + } + +#ifdef HAVE_XINPUT2_2 + /* The device is no longer a DirectTouch device, so + remove any touchpoints that we might have + recorded. */ + if (!device->direct_p) + { + tem = device->touchpoints; + + while (tem) + { + last = tem; + tem = tem->next; + xfree (last); + } + + device->touchpoints = NULL; + } +#endif + + XIFreeDeviceInfo (info); + } +#endif +} + #endif /* The focus may have changed. Figure out if it is a real focus change, @@ -22363,16 +22508,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, case XI_DeviceChanged: { - XIDeviceChangedEvent *device_changed = (XIDeviceChangedEvent *) xi_event; + XIDeviceChangedEvent *device_changed; struct xi_device_t *device; -#ifdef HAVE_XINPUT2_2 - struct xi_touch_point_t *tem, *last; -#endif - int c; -#ifdef HAVE_XINPUT2_1 - int i; -#endif + device_changed = (XIDeviceChangedEvent *) xi_event; device = xi_device_from_id (dpyinfo, device_changed->deviceid); /* If the device isn't enabled, then stop handling this @@ -22381,105 +22520,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (!device) goto XI_OTHER; - /* Free data that we will regenerate from new - information. */ -#ifdef HAVE_XINPUT2_1 - device->valuators = xrealloc (device->valuators, - (device_changed->num_classes - * sizeof *device->valuators)); - device->scroll_valuator_count = 0; -#endif -#ifdef HAVE_XINPUT2_2 - device->direct_p = false; -#endif - - for (c = 0; c < device_changed->num_classes; ++c) - { - switch (device_changed->classes[c]->type) - { -#ifdef HAVE_XINPUT2_1 - case XIScrollClass: - { - XIScrollClassInfo *info; - - info = (XIScrollClassInfo *) device_changed->classes[c]; - struct xi_scroll_valuator_t *valuator; - - valuator = &device->valuators[device->scroll_valuator_count++]; - valuator->horizontal - = (info->scroll_type == XIScrollTypeHorizontal); - valuator->invalid_p = true; - valuator->emacs_value = DBL_MIN; - valuator->increment = info->increment; - valuator->number = info->number; - - break; - } -#endif - -#ifdef HAVE_XINPUT2_2 - case XITouchClass: - { - XITouchClassInfo *info; - - info = (XITouchClassInfo *) device_changed->classes[c]; - device->direct_p = info->mode == XIDirectTouch; - } -#endif - default: - break; - } - } - -#ifdef HAVE_XINPUT2_1 - for (c = 0; c < device_changed->num_classes; ++c) - { - if (device_changed->classes[c]->type == XIValuatorClass) - { - XIValuatorClassInfo *info; - - info = (XIValuatorClassInfo *) device_changed->classes[c]; - - for (i = 0; i < device->scroll_valuator_count; ++i) - { - if (device->valuators[i].number == info->number) - { - device->valuators[i].invalid_p = false; - device->valuators[i].current_value = info->value; - - /* Make sure that this is reset if the - pointer moves into a window of ours. - - Otherwise the valuator state could be - left invalid if the DeviceChange - event happened with the pointer - outside any Emacs frame. */ - device->valuators[i].pending_enter_reset = true; - } - } - } - } -#endif - -#ifdef HAVE_XINPUT2_2 - /* The device is no longer a DirectTouch device, so - remove any touchpoints that we might have - recorded. */ - if (!device->direct_p) - { - tem = device->touchpoints; - - while (tem) - { - last = tem; - tem = tem->next; - xfree (last); - } - - device->touchpoints = NULL; - } -#endif - + /* Now handle the event by retrieving scroll valuators + and touch info. */ + xi_handle_device_changed (dpyinfo, device, device_changed); goto XI_OTHER; } commit fe4fd160a20e2935b9a6aba4dc5dfbb5e26fdfe1 Author: Michael Heerdegen Date: Tue Aug 9 03:55:14 2022 +0200 Another lisp-current-defun-name tweak * lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Avoid error when edebug spec is the symbol t. diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 82afa31ef1..1bc2c0ece6 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -762,7 +762,7 @@ decided heuristically.)" (when symbol (let ((spec (get symbol 'edebug-form-spec))) (save-excursion - (when (and (eq (car spec) '&define) + (when (and (eq (car-safe spec) '&define) (memq 'name spec)) (pop spec) (while (and spec (not name)) commit d2080e4183e462331bdb90476395d1ad003de7bb Author: Dmitry Gutov Date: Tue Aug 9 04:00:08 2022 +0300 Add separate tiny major mode for JSON * lisp/progmodes/js.el (js-json-mode): New major mode. * lisp/files.el (auto-mode-alist): Use it for JSON (bug#56682). * lisp/progmodes/js.el (js--class-decl-matcher): Skip work if there are no frameworks enabled. diff --git a/lisp/files.el b/lisp/files.el index e258bf7bbe..05a924a363 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2950,7 +2950,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\|SQUASHFS\\)\\'" . ("\\.js[mx]?\\'" . javascript-mode) ;; https://en.wikipedia.org/wiki/.har ("\\.har\\'" . javascript-mode) - ("\\.json\\'" . javascript-mode) + ("\\.json\\'" . js-json-mode) ("\\.[ds]?va?h?\\'" . verilog-mode) ("\\.by\\'" . bovine-grammar-mode) ("\\.wy\\'" . wisent-grammar-mode) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index eb2a1e4fcc..2eefcf44dc 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1830,22 +1830,23 @@ context." (defun js--class-decl-matcher (limit) "Font lock function used by `js-mode'. This performs fontification according to `js--class-styles'." - (cl-loop initially (js--ensure-cache limit) - while (re-search-forward js--quick-match-re limit t) - for orig-end = (match-end 0) - do (goto-char (match-beginning 0)) - if (cl-loop for style in js--class-styles - for decl-re = (plist-get style :class-decl) - if (and (memq (plist-get style :framework) - js-enabled-frameworks) - (memq (js-syntactic-context) - (plist-get style :contexts)) - decl-re - (looking-at decl-re)) - do (goto-char (match-end 0)) - and return t) - return t - else do (goto-char orig-end))) + (when js-enabled-frameworks + (cl-loop initially (js--ensure-cache limit) + while (re-search-forward js--quick-match-re limit t) + for orig-end = (match-end 0) + do (goto-char (match-beginning 0)) + if (cl-loop for style in js--class-styles + for decl-re = (plist-get style :class-decl) + if (and (memq (plist-get style :framework) + js-enabled-frameworks) + (memq (js-syntactic-context) + (plist-get style :contexts)) + decl-re + (looking-at decl-re)) + do (goto-char (match-end 0)) + and return t) + return t + else do (goto-char orig-end)))) (defconst js--font-lock-keywords '(js--font-lock-keywords-3 js--font-lock-keywords-1 @@ -3490,6 +3491,12 @@ This function is intended for use in `after-change-functions'." ;;(syntax-propertize (point-max)) ) +;;;###autoload +(define-derived-mode js-json-mode js-mode "JSON" + ;; JSON files can be big. Speed up syntax-ppss. + (setq-local syntax-propertize-function nil) + (setq-local js-enabled-frameworks nil)) + ;; Since we made JSX support available and automatically-enabled in ;; the base `js-mode' (for ease of use), now `js-jsx-mode' simply ;; serves as one other interface to unconditionally enable JSX in commit d6ea4894d3b0bb7d2159bc36b9c5e2ead8afd5b2 Author: Stefan Kangas Date: Tue Aug 9 00:03:49 2022 +0200 ; Delete stale comment from prolog.el * lisp/progmodes/prolog.el: Delete stale comment; XEmacs support has been removed. diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index e3ddf28bbb..6437bbd4c1 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -84,14 +84,6 @@ ;; You can also customize the variable ;; `prolog-program-name' (in the group `prolog-inferior') and provide ;; a full path for your Prolog system (swi, scitus, etc.). -;; -;; Note: I (Stefan, the current maintainer) work under XEmacs. Future -;; developments will thus be biased towards XEmacs (OK, I admit it, -;; I am biased towards XEmacs in general), though I will do my best -;; to keep the GNU Emacs compatibility. So if you work under Emacs -;; and see something that does not work do drop me a line, as I have -;; a smaller chance to notice this kind of bugs otherwise. -; [The above comment dates from 2011.] ;; Changelog: commit f1f1912658556e2f2a39cdae0da7ea2b8564d861 Author: Stefan Kangas Date: Mon Aug 8 21:31:50 2022 +0200 ; Delete stale and incorrect comment in ezimage.el The below comment seems to have been incorrect since 2002 (see commit 5f1fbf6b35). * lisp/ezimage.el (ezimage-insert-image-button-maybe): Delete stale and incorrect comment. diff --git a/lisp/ezimage.el b/lisp/ezimage.el index 9e5a08e682..ad98c45336 100644 --- a/lisp/ezimage.el +++ b/lisp/ezimage.el @@ -182,11 +182,6 @@ Optional argument STRING is a string upon which to add text properties." (when ezimage-use-images (let* ((bt (buffer-substring start (+ length start))) (a (assoc bt ezimage-expand-image-button-alist))) - ;; Regular images (created with `insert-image' are intangible - ;; which (I suppose) make them more compatible with XEmacs 21. - ;; Unfortunately, there is a giant pile of code dependent on the - ;; underlying text. This means if we leave it tangible, then I - ;; don't have to change said giant piles of code. (if (and a (symbol-value (cdr a))) (ezimage-insert-over-text (symbol-value (cdr a)) start commit d91ffdbec2bae4b338fa9148fc66b74853cb3f69 (refs/remotes/origin/emacs-28) Author: Stefan Kangas Date: Mon Aug 8 21:28:53 2022 +0200 Don't mention XEmacs toolbar in ediff manual * doc/misc/ediff.texi (Other Session Commands): Don't mention XEmacs specific toolbar support for now. This can be changed back once the toolbar is ported to Emacs. diff --git a/doc/misc/ediff.texi b/doc/misc/ediff.texi index d81ba158a1..8a7de88d65 100644 --- a/doc/misc/ediff.texi +++ b/doc/misc/ediff.texi @@ -947,12 +947,14 @@ This function can also be invoked from the Menubar. However, in some cases, the change will take place only after you execute one of the Ediff commands, such as going to the next difference or redisplaying. +@c --> The below can be revisited once the toolbar has been ported to Emacs: +@ignore @item ediff-toggle-use-toolbar @findex ediff-toggle-use-toolbar -Available in XEmacs only. The Ediff toolbar provides quick access to some -of the common Ediff functions. This function toggles the display of the -toolbar. If invoked from the menubar, the function may take sometimes -effect only after you execute an Ediff command, such as going to the next +The Ediff toolbar provides quick access to some of the common Ediff +functions. This function toggles the display of the toolbar. If +invoked from the menubar, the function may take sometimes effect only +after you execute an Ediff command, such as going to the next difference. @item ediff-use-toolbar-p @@ -961,6 +963,7 @@ The use of the toolbar can also be specified via the variable @code{ediff-use-toolbar-p} (default is @code{t}). This variable can be set only in @file{.emacs}: do @strong{not} change it interactively. Use the function @code{ediff-toggle-use-toolbar} instead. +@end ignore @item ediff-revert-buffers-then-recompute-diffs @findex ediff-revert-buffers-then-recompute-diffs commit 8028f22b1889d73151b85bd867dd27bb82da8216 Author: Stefan Kangas Date: Mon Aug 8 21:27:37 2022 +0200 ; * lisp/gnus/gnus.el (gnus-user-agent): Fix typo. diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 660dceec6f..b036978efa 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -2237,7 +2237,7 @@ Disabling the agent may result in noticeable loss of performance." Can be a list of symbols or a string. Valid symbols are `gnus' (show Gnus version) and `emacs' (show Emacs version). In -addition to the Emacs version, you can add`config' (show system +addition to the Emacs version, you can add `config' (show system configuration) or `type' (show system type). If you set it to a string, be sure to use a valid format, see RFC 2616." :version "22.1" commit a908d536c483c933ed68260cd920d9ed7a7d337c Author: Stefan Kangas Date: Mon Aug 8 19:33:28 2022 +0200 ; * lisp/gnus/gnus-art.el: Delete stale comments. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 18baf982b2..480ebe377d 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -268,7 +268,7 @@ This can also be a list of the above values." (defcustom gnus-hidden-properties ;; We use to have `intangible' here as well, but Emacs's command loop moves ;; point out of invisible text anyway, so `intangible' is clearly not - ;; needed there. And XEmacs doesn't handle `intangible' anyway. + ;; needed there. '(invisible t) "Property list to use for hiding text." :type 'plist @@ -8470,8 +8470,6 @@ url is put as the `gnus-button-url' overlay property on the button." (when comma (dotimes (_ (with-temp-buffer (insert comma) - ;; Note: the XEmacs version of `how-many' takes - ;; no optional argument. (goto-char (point-min)) (how-many ","))) (Info-index-next 1))) commit 870d59e72ee2f91c15e1bd0e187d0c0fc2a73a6e Author: Stefan Kangas Date: Mon Aug 8 18:08:20 2022 +0200 * lisp/progmodes/antlr-mode.el: Remove remnants of XEmacs support. diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el index d6e2ab8a87..5002a3bbfa 100644 --- a/lisp/progmodes/antlr-mode.el +++ b/lisp/progmodes/antlr-mode.el @@ -66,8 +66,6 @@ ;;; Installation: -;; This file requires Emacs-20.3, XEmacs-20.4 or higher and package cc-mode. - ;; If antlr-mode is not part of your distribution, put this file into your ;; load-path and the following into your init file: ;; (autoload 'antlr-mode "antlr-mode" nil t) @@ -75,9 +73,6 @@ ;; (add-hook 'speedbar-load-hook ; would be too late in antlr-mode.el ;; (lambda () (speedbar-add-supported-extension ".g"))) -;; I strongly recommend to use font-lock with a support mode like -;; jit-lock (Emacs) / lazy-shot (XEmacs). - ;; To customize, use menu item "Antlr" -> "Customize Antlr". ;;; Code: @@ -894,7 +889,7 @@ Used for `antlr-slow-syntactic-context'.") ;;;=========================================================================== -;;; Syntax functions -- Emacs vs XEmacs dependent, part 1 +;;; Syntax functions ;;;=========================================================================== ;;;=========================================================================== @@ -2431,8 +2426,6 @@ the default language." comment-start-skip "/\\*+ *\\|// *") ;; various ----------------------------------------------------------------- (set (make-local-variable 'font-lock-defaults) antlr-font-lock-defaults) - (when (featurep 'xemacs) - (easy-menu-add antlr-mode-menu)) (set (make-local-variable 'imenu-create-index-function) #'antlr-imenu-create-index-function) (set (make-local-variable 'imenu-generic-expression) t) ; fool stupid test commit 0b4470d1b77d5e91003d6878cab91da8c326b8d2 Author: Stefan Kangas Date: Mon Aug 8 17:56:36 2022 +0200 Remove XEmacs specific symbol from gnus-user-agent * lisp/gnus/gnus.el (gnus-user-agent): Remove XEmacs specific 'codename' symbol. diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 2c10969ba0..880192e3bb 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -1385,8 +1385,7 @@ sequence, this is like `mapcar'. With several, it is like the Common Lisp system-configuration) ((memq 'type lst) (symbol-name system-type)) - (t nil))) - ) ;; codename + (t nil)))) (cond ((not (memq 'emacs lst)) nil) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 8221f3017a..660dceec6f 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -2236,12 +2236,10 @@ Disabling the agent may result in noticeable loss of performance." "Which information should be exposed in the User-Agent header. Can be a list of symbols or a string. Valid symbols are `gnus' -\(show Gnus version) and `emacs' \(show Emacs version). In -addition to the Emacs version, you can add `codename' \(show -\(S)XEmacs codename) or either `config' \(show system -configuration) or `type' \(show system type). If you set it to -a string, be sure to use a valid format, see RFC 2616." - +(show Gnus version) and `emacs' (show Emacs version). In +addition to the Emacs version, you can add`config' (show system +configuration) or `type' (show system type). If you set it to a +string, be sure to use a valid format, see RFC 2616." :version "22.1" :group 'gnus-message :type '(choice (list (set :inline t @@ -2249,8 +2247,7 @@ a string, be sure to use a valid format, see RFC 2616." (const :value emacs :tag "Emacs version") (choice :tag "system" (const :value type :tag "system type") - (const :value config :tag "system configuration")) - (const :value codename :tag "Emacs codename"))) + (const :value config :tag "system configuration")))) (string))) ;; Convert old (< 2005-01-10) symbol type values: commit 0283d1c4e586d0d9496f5ebb1302731142b7dafc Author: Stefan Kangas Date: Mon Aug 8 17:48:10 2022 +0200 ; Delete stale comment in mh-utils.el * lisp/mh-e/mh-utils.el (mh-normalize-folder-name): Remove stale and incorrect comment. diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index bf2d3c71db..dd662f3552 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -445,10 +445,8 @@ no effect." (setq folder (format "%s/%s/" mh-current-folder-name (substring folder 1)))) ;; XXX: Purge empty strings from the list that split-string - ;; returns. In XEmacs, (split-string "+foo/" "/") returns - ;; ("+foo" "") while in GNU Emacs it returns ("+foo"). In the - ;; code it is assumed that the components list has no empty - ;; strings. + ;; returns. In the code it is assumed that the components list + ;; has no empty strings. (let ((components (delete "" (split-string folder "/"))) (result ())) ;; Remove .. and . from the pathname. commit f886a1d77236ead94b218cc7139f0a52db3311b3 Author: Stefan Kangas Date: Mon Aug 8 17:32:33 2022 +0200 Remove some XEmacs compat code from mh-alias.el * lisp/mh-e/mh-alias.el (crm): Don't require for autoloaded function. (multi-prompt): Don't require XEmacs specific library. diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el index 3d034554f2..3ceb419023 100644 --- a/lisp/mh-e/mh-alias.el +++ b/lisp/mh-e/mh-alias.el @@ -245,10 +245,6 @@ Blind aliases or users from /etc/passwd are not expanded." (t (mh-alias-ali alias)))) -(eval-and-compile - (require 'crm nil t) ; completing-read-multiple - (require 'multi-prompt nil t)) - ;;;###mh-autoload (defun mh-read-address (prompt) "Read an address from the minibuffer with PROMPT." commit bf8044b9cdf59aaff4d9611d007102272073814f Author: Stefan Kangas Date: Mon Aug 8 17:11:52 2022 +0200 ; Unconditionally require built-in libraries diff --git a/lisp/cedet/semantic/wisent/python.el b/lisp/cedet/semantic/wisent/python.el index 941efbbbef..6b2833ef44 100644 --- a/lisp/cedet/semantic/wisent/python.el +++ b/lisp/cedet/semantic/wisent/python.el @@ -1,6 +1,6 @@ ;;; wisent-python.el --- Semantic support for Python -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2006-2022 Free Software Foundation, Inc. +;; Copyright (C) 2002-2022 Free Software Foundation, Inc. ;; Author: Richard Kim ;; Created: June 2002 @@ -27,9 +27,7 @@ ;;; Code: -;; Try to load python support, but fail silently since it is only used -;; for optional functionality -(require 'python nil t) +(require 'python) (require 'semantic/wisent) (require 'semantic/wisent/python-wy) diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 5144e30512..9258ca5e40 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el @@ -539,7 +539,7 @@ list." (autoload 'parse-time-string "parse-time") (eval-when-compile - (require 'ange-ftp nil t)) ; ange-ftp-parse-filename + (require 'ange-ftp)) ; ange-ftp-parse-filename (defvar tramp-file-name-structure) (declare-function ange-ftp-ls "ange-ftp" diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index 7f200534ef..5b90290237 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el @@ -510,7 +510,7 @@ font-lock is done highlighting.") nil) ;; Register mh-folder-mode as supporting which-function-mode... -(eval-and-compile (require 'which-func nil t)) +(require 'which-func) (when (and (boundp 'which-func-modes) (listp which-func-modes)) (add-to-list 'which-func-modes 'mh-folder-mode)) diff --git a/lisp/mh-e/mh-gnus.el b/lisp/mh-e/mh-gnus.el index 685553164c..b797000566 100644 --- a/lisp/mh-e/mh-gnus.el +++ b/lisp/mh-e/mh-gnus.el @@ -28,12 +28,11 @@ (require 'mh-e) -(eval-and-compile - (require 'gnus-util nil t) - (require 'mm-bodies nil t) - (require 'mm-decode nil t) - (require 'mm-view nil t) - (require 'mml nil t)) +(require 'gnus-util) +(require 'mm-bodies) +(require 'mm-decode) +(require 'mm-view) +(require 'mml) (defun mh-gnus-local-map-property (map) "Return a list suitable for a text property list specifying keymap MAP." diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el index 8a8a8c3358..058ea4499f 100644 --- a/lisp/mh-e/mh-search.el +++ b/lisp/mh-e/mh-search.el @@ -1411,7 +1411,7 @@ being the list of messages originally from that folder." (when cur-msg (mh-goto-msg cur-msg t t)) (set-buffer-modified-p old-buffer-modified-flag))) -(eval-and-compile (require 'which-func nil t)) +(require 'which-func) ;;;###mh-autoload (defun mh-index-create-imenu-index () diff --git a/lisp/obsolete/mh-compat.el b/lisp/obsolete/mh-compat.el index 2c9d1b73e2..a5be3bd742 100644 --- a/lisp/obsolete/mh-compat.el +++ b/lisp/obsolete/mh-compat.el @@ -84,7 +84,7 @@ the completions." (define-obsolete-function-alias 'mh-line-end-position #'line-end-position "29.1") -(require 'mailabbrev nil t) +(require 'mailabbrev) (define-obsolete-function-alias 'mh-mail-abbrev-make-syntax-table #'mail-abbrev-make-syntax-table "29.1") commit c0c5f43f49d429ec63ea73df1f1886f84596cb0a Author: Lars Ingebrigtsen Date: Mon Aug 8 17:46:48 2022 +0200 Clean up fix_command code slightly * src/callint.c (fix_command): Remove superfluous check. diff --git a/src/callint.c b/src/callint.c index e670c8f638..c974967459 100644 --- a/src/callint.c +++ b/src/callint.c @@ -176,7 +176,7 @@ fix_command (Lisp_Object function, Lisp_Object values) Lisp_Object reps = Fget (function, Qinteractive_args); - if (!NILP (reps) && CONSP (reps)) + if (CONSP (reps)) { int i = 0; Lisp_Object vals = values; commit 27e1568967bd571e4e3da31f78ff3bb912865bc9 Author: Lars Ingebrigtsen Date: Mon Aug 8 17:46:21 2022 +0200 select-active-regions doc string improvement * src/keyboard.c (syms_of_keyboard): Mention post-select-region-hook. diff --git a/src/keyboard.c b/src/keyboard.c index 81e73a2833..f8e6ef748d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -12950,7 +12950,10 @@ This variable only has an effect when Transient Mark mode is enabled. If the value is `only', only temporarily active regions (usually made by mouse-dragging or shift-selection) set the window system's primary -selection. */); +selection. + +If this variable causes the region to be set as the primary selection, +`post-select-region-hook' is then run afterwards. */); Vselect_active_regions = Qt; DEFVAR_LISP ("saved-region-selection", commit b40def964414a5a3fab1da53a0f7cda2f87fc28f Author: Lars Ingebrigtsen Date: Mon Aug 8 17:45:41 2022 +0200 Do some NEWS tagging diff --git a/etc/NEWS b/etc/NEWS index 733ab673e4..2662ba453f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -887,6 +887,7 @@ specifiers can now use ':type webp'. ** Windows ++++ *** New user option 'display-buffer-avoid-small-windows'. If non-nil, this should be a window height, a number. Windows smaller than this will be avoided by 'display-buffer', if possible. @@ -1194,9 +1195,11 @@ This command visits the file on the current line with EWW. ** Elisp +--- *** New command 'elisp-eval-buffer' (bound to 'C-c C-e'). This command evals the forms in the current buffer. +--- *** New commands 'elisp-byte-compile-file' and 'elisp-byte-compile-buffer'. These commands (bound to 'C-c C-f' and 'C-c C-b', respectively) byte-compile the visited file and the current buffer, respectively. @@ -1231,6 +1234,7 @@ This controls how statements like the following are indented: bar ** Cperl Mode + --- *** New user option 'cperl-file-style'. This option determines the indentation style to be used. It can also @@ -1639,6 +1643,7 @@ the common "utm_" trackers from URLs. ** Find-Dired +--- *** New command 'find-dired-with-command'. This enables users to run 'find-dired' with an arbitrary command, enabling running commands previously unsupported and also enabling new @@ -2246,6 +2251,7 @@ The old name is still available as an obsolete function alias. Allows the creation of "functions with slots" or "function objects" via the macros 'oclosure-define' and 'oclosure-lambda'. ++++ *** New generic function 'oclosure-interactive-form'. Used by 'interactive-form' when called on an OClosure. This allows specific OClosure types to compute their interactive specs @@ -2527,6 +2533,7 @@ functions. ** '?\' at the end of a line now signals an error. Previously it produced a nonsense value, -1, that was never intended. +--- ** Some libraries obsolete since Emacs 24.1 and 24.3 have been removed: abbrevlist.el, assoc.el, complete.el, cust-print.el, erc-hecomplete.el, mailpost.el, mouse-sel.el, old-emacs-lock.el, @@ -2540,6 +2547,7 @@ patcomp.el, pc-mode.el, pc-select.el, s-region.el, and sregex.el. This can be used to specify what forms to put into 'command-history' when executing commands interactively. ++++ ** The FORM arg of 'time-convert' is mandatory. 'time-convert' can still be called without it, as before, but the compiler now emits a warning about this deprecated usage. @@ -2597,15 +2605,18 @@ for each specific data type while the selection is being converted. This function includes the current value of the variable in eldoc display and can be used as a more detailed alternative to 'elisp-eldoc-var-docstring'. ++++ ** 'save-some-buffers' can now be extended to save other things. Traditionally, 'save-some-buffers' saved buffers, and also saved abbrevs. This has been generalized via the 'save-some-buffers-functions' variable, and packages can now register things to be saved. ++++ ** New function 'string-equal-ignore-case'. This compares strings ignoring case differences. +--- ** 'symbol-file' can now report natively-compiled .eln files. If Emacs was built with native-compilation enabled, Lisp programs can now call 'symbol-file' with the new optional 3rd argument non-nil to @@ -2872,10 +2883,12 @@ them towards or away from each other. This hook is run before 'x-popup-menu' is about to display a deck-of-cards menu on screen. +--- ** New hook 'post-select-region-hook'. This hook is run immediately after 'select-active-regions' causes the region to be set as the primary selection. ++++ ** New function 'buffer-match-p'. Check if a buffer satisfies some condition. Some examples for conditions can be regular expressions that match a buffer name, a @@ -2883,6 +2896,7 @@ cons-cell like '(major-mode . shell-mode)' that matches any buffer where 'major-mode' is 'shell-mode' or a combined with a condition like '(and "\\`\\*.+\\*\\'" (major-mode . special-mode))'. ++++ ** New function 'match-buffers'. Use 'buffer-match-p' to gather a list of buffers that match a condition. commit 4073d5eeea5046f8771ef60c4165fef96751c01d Author: Stefan Kangas Date: Sat Aug 6 20:13:11 2022 +0200 * lisp/obsolete/makesum.el: Add "Obsolete-since" header. diff --git a/lisp/obsolete/makesum.el b/lisp/obsolete/makesum.el index 4272ce23f8..3e343c9537 100644 --- a/lisp/obsolete/makesum.el +++ b/lisp/obsolete/makesum.el @@ -4,6 +4,7 @@ ;; Maintainer: emacs-devel@gnu.org ;; Keywords: help +;; Obsolete-since: 29.1 ;; This file is part of GNU Emacs. commit 425a5bfc9a8a366743bdae88e05268a76f840fa8 Author: Stefan Kangas Date: Sat Aug 6 20:11:57 2022 +0200 Make makesum.el obsolete * lisp/makesum.el: Move from here... * lisp/obsolete/makesum.el: ...to here. (Bug#56979) * test/lisp/makesum-tests.el: Move from here... * test/lisp/obsolete/makesum-tests.el: ...to here. diff --git a/lisp/makesum.el b/lisp/obsolete/makesum.el similarity index 100% rename from lisp/makesum.el rename to lisp/obsolete/makesum.el diff --git a/test/lisp/makesum-tests.el b/test/lisp/obsolete/makesum-tests.el similarity index 100% rename from test/lisp/makesum-tests.el rename to test/lisp/obsolete/makesum-tests.el commit 9aae83fe303801d9481b3b106532fd592a4b5290 Author: Mattias Engdegård Date: Mon Aug 8 16:26:29 2022 +0200 * src/print.c (struct print_buffer): Revert gratuitous format change. diff --git a/src/print.c b/src/print.c index 73535550bb..1c96ec14b8 100644 --- a/src/print.c +++ b/src/print.c @@ -65,17 +65,10 @@ static unsigned int printchar_stdout_last; struct print_buffer { - /* Allocated buffer. */ - char *buffer; - - /* Size of allocated buffer. */ - ptrdiff_t size; - - /* Chars stored in buffer. */ - ptrdiff_t pos; - - /* Bytes stored in buffer. */ - ptrdiff_t pos_byte; + char *buffer; /* Allocated buffer. */ + ptrdiff_t size; /* Size of allocated buffer. */ + ptrdiff_t pos; /* Chars stored in buffer. */ + ptrdiff_t pos_byte; /* Bytes stored in buffer. */ }; /* When printing into a buffer, first we put the text in this commit 27599d8df838569e223bc8be4fb7c40cd75c1847 Author: Lars Ingebrigtsen Date: Mon Aug 8 16:07:23 2022 +0200 Add NEWS note about interactive-args diff --git a/etc/NEWS b/etc/NEWS index ea26c5e6ba..733ab673e4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2535,6 +2535,11 @@ patcomp.el, pc-mode.el, pc-select.el, s-region.el, and sregex.el. * Lisp Changes in Emacs 29.1 ++++ +** New 'declare' form 'interactive-args'. +This can be used to specify what forms to put into 'command-history' +when executing commands interactively. + ** The FORM arg of 'time-convert' is mandatory. 'time-convert' can still be called without it, as before, but the compiler now emits a warning about this deprecated usage. commit 3e93457ddbfe8f4bcc2a7eccf52ae96912c6b852 Author: Lars Ingebrigtsen Date: Mon Aug 8 16:02:24 2022 +0200 Update TODO about fix_command * etc/TODO: Remove bit about fix_command, which has now been fixed. diff --git a/etc/TODO b/etc/TODO index bd846dd898..da4a8c1fab 100644 --- a/etc/TODO +++ b/etc/TODO @@ -130,11 +130,6 @@ See also ESR's proposal for a BROWSER environment variable ** In Custom buffers, put the option that turns a mode on or off first This should use a heuristic of some kind? -** Define recompute-arg and recompute-arg-if for fix_command to use -See rms message of 11 Dec 05 in -https://lists.gnu.org/r/emacs-pretest-bug/2005-12/msg00165.html, -and the rest of that discussion. - ** In Emacs Info, examples of using Customize should be clickable They should create Custom buffers when clicked. commit 7331ee112c107caaece87db9f65751f9cbcc01c3 Author: Arash Esbati Date: Mon Aug 8 15:58:35 2022 +0200 Improve collecting of citation keys * lisp/textmodes/reftex-cite.el (reftex-all-used-citation-keys): Improve regexp for matching various cite commands incl. optional arguments. Recognize comments more robustly and don't interpret the control symbol \% as a comment starter. (bug#56655) * test/lisp/textmodes/reftex-tests.el (reftex-all-used-citation-keys): New test. diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 26b14ebc79..f3f95627af 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -1116,10 +1116,10 @@ recommended for follow mode. It works OK for individual lookups." (setq bibtype (reftex-bib-or-thebib)) (cond ((eq bibtype 'bib) -; ((assq 'bib (symbol-value reftex-docstruct-symbol)) + ;; ((assq 'bib (symbol-value reftex-docstruct-symbol)) (setq bibfile-list (reftex-get-bibfile-list))) ((eq bibtype 'thebib) -; ((assq 'thebib (symbol-value reftex-docstruct-symbol)) + ;; ((assq 'thebib (symbol-value reftex-docstruct-symbol)) (setq bibfile-list (reftex-uniquify (mapcar #'cdr @@ -1142,8 +1142,35 @@ recommended for follow mode. It works OK for individual lookups." ;;; Global BibTeX file (defun reftex-all-used-citation-keys () + "Return a list of all citation keys used in document." (reftex-access-scan-info) - (let ((files (reftex-all-document-files)) file keys kk k) + ;; FIXME: multicites macros provided by biblatex + ;; are not covered in this function. + (let ((files (reftex-all-document-files)) + (re (concat "\\\\" + "\\(?:" + ;; biblatex volcite macros take these args: + ;; \volcite[prenote]{volume}[pages]{key} + ;; so cater for the first 3 args: + (regexp-opt '("volcite" "Volcite" + "pvolcite" "Pvolcite" + "fvolcite" "ftvolcite" + "svolcite" "Svolcite" + "tvolcite" "Tvolcite" + "avolcite" "Avolcite")) + "\\(?:\\[[^]]*\\]\\)?" + "{[^}]*}" + "\\(?:\\[[^]]*\\]\\)?" + "\\|" + ;; Other cite macros usually go like: + ;; \cite[prenote][postnote]{key} + ;; so cater for the optional args: + "\\(?:bibentry\\|[a-zA-Z]*[Cc]ite[a-zA-Z*]*\\)" + "\\(?:\\[[^]]*\\]\\)\\{0,2\\}" + "\\)" + ;; Now match the key: + "{\\([^}]+\\)}")) + file keys kk k) (save-current-buffer (while (setq file (pop files)) (set-buffer (reftex-get-file-buffer-force file 'mark)) @@ -1151,14 +1178,17 @@ recommended for follow mode. It works OK for individual lookups." (save-restriction (widen) (goto-char (point-min)) - (while (re-search-forward "\\(?:^\\|\\=\\)[^%\n\r]*?\\\\\\(bibentry\\|[a-zA-Z]*cite[a-zA-Z]*\\)\\(\\[[^]]*\\]\\)?{\\([^}]+\\)}" nil t) - (setq kk (match-string-no-properties 3)) - (while (string-match "%.*\n?" kk) - (setq kk (replace-match "" t t kk))) - (setq kk (split-string kk "[, \t\r\n]+")) - (while (setq k (pop kk)) - (or (member k keys) - (setq keys (cons k keys))))))))) + (while (re-search-forward re nil t) + ;; Make sure we're not inside a comment: + (unless (save-match-data + (nth 4 (syntax-ppss))) + (setq kk (match-string-no-properties 1)) + (while (string-match "%.*\n?" kk) + (setq kk (replace-match "" t t kk))) + (setq kk (split-string kk "[, \t\r\n]+")) + (while (setq k (pop kk)) + (or (member k keys) + (setq keys (cons k keys)))))))))) (reftex-kill-temporary-buffers) keys)) diff --git a/test/lisp/textmodes/reftex-tests.el b/test/lisp/textmodes/reftex-tests.el index 9ef41088d1..97ff390817 100644 --- a/test/lisp/textmodes/reftex-tests.el +++ b/test/lisp/textmodes/reftex-tests.el @@ -190,8 +190,8 @@ (ert-deftest reftex-format-citation-test () "Test `reftex-format-citation'." - (let ((entry (reftex-parse-bibtex-entry -"@article{Foo13, + (let ((entry (reftex-parse-bibtex-entry "\ +@article{Foo13, author = {Jane Roe and John Doe and Jane Q. Taxpayer}, title = {Some Article}, journal = {Some Journal}, @@ -202,6 +202,137 @@ (should (string= (reftex-format-citation entry "%l:%A:%y:%t %j %P %a") "Foo13:Jane Roe:2013:Some Article Some Journal 1 Jane Roe, John Doe \\& Jane Taxpayer")))) +(ert-deftest reftex-all-used-citation-keys () + "Test `reftex-all-used-citation-keys'. +Take the cite macros provided by biblatex package as reference." + (ert-with-temp-directory temp-dir + (let ((tex-file (expand-file-name "keys.tex" temp-dir)) + keys) + (with-temp-buffer + (insert "\ +\\documentclass{article} +\\usepackage{biblatex} +\\begin{document} + +Standard commands: +\\cite[pre][pos]{cite:2022} +\\Cite[pos]{Cite:2022} +\\parencite{parencite:2022} +\\Parencite[pre][]{Parencite:2022} +\\footcite[][]{footcite:2022} +\\footcitetext[pre][pos]{footcitetext:2022} + +Style specific commands: +\\textcite{textcite:2022} +\\Textcite[pos]{Textcite:2022} +\\smartcite[pre][pos]{smartcite:2022} +\\Smartcite[pre][]{Smartcite:2022} +\\cite*[pre][pos]{cite*:2022} +\\parencite*[][]{parencite*:2022} + +Style independent commands: +\\autocite[pre][pos]{autocite:2022} +\\autocite*[pos]{autocite*:2022} +\\Autocite[pre][]{Autocite:2022} +\\Autocite*{Autocite*:2022} + +Text commands: +\\citeauthor[pre][pos]{citeauthor:2022} +\\citeauthor*[pre][]{citeauthor*:2022} +\\Citeauthor[pos]{Citeauthor:2022} +\\Citeauthor*{Citeauthor*:2022} +\\citetitle[][]{citetitle:2022} +\\citetitle*[pre][pos]{citetitle*:2022} +\\citeyear[pre][pos]{citeyear:2022} +\\citeyear*[pre][pos]{citeyear*:2022} +\\citedate[pre][pos]{citedate:2022} +\\citedate*[pre][pos]{citedate*:2022} +\\citeurl[pre][pos]{citeurl:2022} + +Special commands: +\\nocite{nocite:2022} +\\fullcite[pos]{fullcite:2022} +\\footfullcite[][]{fullfootcite:2022} +``volcite'' macros have different number of args. +\\volcite{2}{volcite:2022} +\\Volcite[pre]{1}{Volcite:2022} +\\pvolcite{1}[pg]{pvolcite:2022} +\\Pvolcite[pre]{2}[pg]{Pvolcite:2022} +\\fvolcite[pre]{3}[pg]{fvolcite:2022} +\\ftvolcite[pre]{3}[pg]{ftvolcite:2022} +\\svolcite[pre]{2}[pg]{svolcite:2022} +\\Svolcite[pre]{4}[pg]{Svolcite:2022} +\\tvolcite[pre]{5}[pg]{tvolcite:2022} +\\Tvolcite[pre]{2}[pg]{Tvolcite:2022} +\\avolcite[pre]{3}[pg]{avolcite:2022} +\\Avolcite[pre]{1}[pg]{Avolcite:2022} +\\Notecite[pre]{Notecite:2022} +\\pnotecite[pre]{pnotecite:2022} +\\Pnotecite[pre]{Pnotecite:2022} +\\fnotecite[pre]{fnotecite:2022} + +Natbib compatibility commands: +\\citet{citet:2022} +\\citet*[pre][pos]{citet*:2022} +\\citep[pre][pos]{citep:2022} +\\citep*[pos]{citep*:2022} +\\citealt[pre][]{citealt:2022} +\\citealt*[][]{citealt*:2022} +\\citealp[pre][pos]{citealp:2022} +\\citealp*{citealp*:2022} +\\Citet[pre][pos]{Citet:2022} +\\Citet*[pre][pos]{Citet*:2022} +\\Citep[pre][pos]{Citep:2022} +\\Citep*[pre][pos]{Citep*:2022} + +Test for bug#56655: +There was a few \\% of increase in budget \\Citep*{bug:56655}. + +And this should be % \\cite{ignored}. +\\end{document}") + (write-region (point-min) (point-max) tex-file)) + (find-file tex-file) + (setq keys (reftex-all-used-citation-keys)) + (should (equal (sort keys #'string<) + (sort '(;; Standard commands: + "cite:2022" "Cite:2022" + "parencite:2022" "Parencite:2022" + "footcite:2022" "footcitetext:2022" + ;; Style specific commands: + "textcite:2022" "Textcite:2022" + "smartcite:2022" "Smartcite:2022" + "cite*:2022" "parencite*:2022" + ;; Style independent commands: + "autocite:2022" "autocite*:2022" + "Autocite:2022" "Autocite*:2022" + ;; Text commands + "citeauthor:2022" "citeauthor*:2022" + "Citeauthor:2022" "Citeauthor*:2022" + "citetitle:2022" "citetitle*:2022" + "citeyear:2022" "citeyear*:2022" + "citedate:2022" "citedate*:2022" + "citeurl:2022" + ;; Special commands: + "nocite:2022" "fullcite:2022" + "fullfootcite:2022" + "volcite:2022" "Volcite:2022" + "pvolcite:2022" "Pvolcite:2022" + "fvolcite:2022" "ftvolcite:2022" + "svolcite:2022" "Svolcite:2022" + "tvolcite:2022" "Tvolcite:2022" + "avolcite:2022" "Avolcite:2022" + "Notecite:2022" "pnotecite:2022" + "Pnotecite:2022" "fnotecite:2022" + ;; Natbib compatibility commands: + "citet:2022" "citet*:2022" + "citep:2022" "citep*:2022" + "citealt:2022" "citealt*:2022" + "citealp:2022" "citealp*:2022" + "Citet:2022" "Citet*:2022" + "Citep:2022" "Citep*:2022" + "bug:56655") + #'string<))) + (kill-buffer (file-name-nondirectory tex-file))))) ;;; Autoload tests commit 7f8a3d4e919e495fadb4eb6fae3f73556b987700 Author: Lars Ingebrigtsen Date: Mon Aug 8 16:01:24 2022 +0200 Clean up fix_command slightly * src/callint.c (fix_command): Remove now-unused parameter. (Fcall_interactively): Ditto. diff --git a/src/callint.c b/src/callint.c index dfc479284c..e670c8f638 100644 --- a/src/callint.c +++ b/src/callint.c @@ -168,7 +168,7 @@ check_mark (bool for_region) of VALUES to do its job. */ static void -fix_command (Lisp_Object input, Lisp_Object function, Lisp_Object values) +fix_command (Lisp_Object function, Lisp_Object values) { /* Quick exit if there's no values to alter. */ if (!CONSP (values)) @@ -317,7 +317,6 @@ invoke it (via an `interactive' spec that contains, for instance, an { Lisp_Object funval = Findirect_function (function, Qt); uintmax_t events = num_input_events; - Lisp_Object input = specs; /* Compute the arg values using the user's expression. */ specs = Feval (specs, CONSP (funval) && EQ (Qclosure, XCAR (funval)) @@ -328,7 +327,7 @@ invoke it (via an `interactive' spec that contains, for instance, an Make a copy of the list of values, for the command history, and turn them into things we can eval. */ Lisp_Object values = quotify_args (Fcopy_sequence (specs)); - fix_command (input, function, values); + fix_command (function, values); call4 (intern ("add-to-history"), intern ("command-history"), Fcons (function, values), Qnil, Qt); } commit 909931cb9ad7251393a81076e9020225fe82845e Author: Lars Ingebrigtsen Date: Mon Aug 8 15:52:53 2022 +0200 Further lisp-current-defun-name tweaks * lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Further tweaks to finding the symbol being defined (defalias). diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 2e7f019aa9..82afa31ef1 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -776,8 +776,12 @@ decided heuristically.)" (when (and (not name) (string-match-p "\\`def" (symbol-name symbol))) (when-let ((candidate (ignore-errors (read (current-buffer))))) - (when (symbolp candidate) - (setq name candidate)))) + (cond + ((symbolp candidate) + (setq name candidate)) + ((and (consp candidate) + (symbolp (car (delete 'quote candidate)))) + (setq name (car (delete 'quote candidate))))))) (when-let ((result (or name symbol))) (symbol-name result))))))) commit ffc81ebc4b5d6cfc827e6a08679da55134f73fb5 Author: Lars Ingebrigtsen Date: Mon Aug 8 15:52:19 2022 +0200 Allow specifying how args are to be stored in `command-history' * doc/lispref/functions.texi (Declare Form): Document `interactive-args' * lisp/replace.el (replace-string): Store the correct interactive arguments (bug#45607). * lisp/emacs-lisp/byte-run.el (byte-run--set-interactive-args): New function. (defun-declarations-alist): Use it. * src/callint.c (fix_command): Remove the old hack (which now longer works since interactive specs are byte-compiled) and instead rely on `interactive-args'. diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 8e8cc5fd9c..8265e58210 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2498,6 +2498,10 @@ the current buffer. Specify that this command is meant to be applicable for @var{modes} only. +@item (interactive-args @var{arg} ...) +Specify the arguments that should be stored for @code{repeat-command}. +Each @var{arg} is on the form @code{@var{argument-name} @var{form}}. + @item (pure @var{val}) If @var{val} is non-@code{nil}, this function is @dfn{pure} (@pxref{What Is a Function}). This is the same as the @code{pure} diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 9370bd3a09..4a2860cd43 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -236,6 +236,20 @@ The return value of this function is not used." (list 'function-put (list 'quote f) ''command-modes (list 'quote val)))) +(defalias 'byte-run--set-interactive-args + #'(lambda (f args &rest val) + (setq args (remove '&optional (remove '&rest args))) + (list 'function-put (list 'quote f) + ''interactive-args + (list + 'quote + (mapcar + (lambda (elem) + (cons + (seq-position args (car elem)) + (cadr elem))) + val))))) + ;; Add any new entries to info node `(elisp)Declare Form'. (defvar defun-declarations-alist (list @@ -255,7 +269,8 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.") (list 'indent #'byte-run--set-indent) (list 'speed #'byte-run--set-speed) (list 'completion #'byte-run--set-completion) - (list 'modes #'byte-run--set-modes)) + (list 'modes #'byte-run--set-modes) + (list 'interactive-args #'byte-run--set-interactive-args)) "List associating function properties to their macro expansion. Each element of the list takes the form (PROP FUN) where FUN is a function. For each (PROP . VALUES) in a function's declaration, diff --git a/lisp/replace.el b/lisp/replace.el index ab9ac17ed9..cac0edf43a 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -664,7 +664,10 @@ which will run faster and will not set the mark or print anything. \(You may need a more complex loop if FROM-STRING can match the null string and TO-STRING is also null.)" (declare (interactive-only - "use `search-forward' and `replace-match' instead.")) + "use `search-forward' and `replace-match' instead.") + (interactive-args + (start (if (use-region-p) (region-beginning))) + (end (if (use-region-p) (region-end))))) (interactive (let ((common (query-replace-read-args diff --git a/src/callint.c b/src/callint.c index ffa3b231eb..dfc479284c 100644 --- a/src/callint.c +++ b/src/callint.c @@ -161,10 +161,8 @@ check_mark (bool for_region) xsignal0 (Qmark_inactive); } -/* If the list of args INPUT was produced with an explicit call to - `list', look for elements that were computed with - (region-beginning) or (region-end), and put those expressions into - VALUES instead of the present values. +/* If FUNCTION has an `interactive-args' spec, replace relevant + elements in VALUES with those forms instead. This function doesn't return a value because it modifies elements of VALUES to do its job. */ @@ -172,62 +170,24 @@ check_mark (bool for_region) static void fix_command (Lisp_Object input, Lisp_Object function, Lisp_Object values) { - /* FIXME: Instead of this ugly hack, we should provide a way for an - interactive spec to return an expression/function that will re-build the - args without user intervention. */ - if (CONSP (input)) + /* Quick exit if there's no values to alter. */ + if (!CONSP (values)) + return; + + Lisp_Object reps = Fget (function, Qinteractive_args); + + if (!NILP (reps) && CONSP (reps)) { - Lisp_Object car; + int i = 0; + Lisp_Object vals = values; - car = XCAR (input); - /* Skip through certain special forms. */ - while (EQ (car, Qlet) || EQ (car, Qletx) - || EQ (car, Qsave_excursion) - || EQ (car, Qprogn)) + while (!NILP (vals)) { - while (CONSP (XCDR (input))) - input = XCDR (input); - input = XCAR (input); - if (!CONSP (input)) - break; - car = XCAR (input); - } - if (EQ (car, Qlist)) - { - Lisp_Object intail, valtail; - for (intail = Fcdr (input), valtail = values; - CONSP (valtail); - intail = Fcdr (intail), valtail = XCDR (valtail)) - { - Lisp_Object elt; - elt = Fcar (intail); - if (CONSP (elt)) - { - Lisp_Object presflag, carelt; - carelt = XCAR (elt); - /* If it is (if X Y), look at Y. */ - if (EQ (carelt, Qif) - && NILP (Fnthcdr (make_fixnum (3), elt))) - elt = Fnth (make_fixnum (2), elt); - /* If it is (when ... Y), look at Y. */ - else if (EQ (carelt, Qwhen)) - { - while (CONSP (XCDR (elt))) - elt = XCDR (elt); - elt = Fcar (elt); - } - - /* If the function call we're looking at - is a special preserved one, copy the - whole expression for this argument. */ - if (CONSP (elt)) - { - presflag = Fmemq (Fcar (elt), preserved_fns); - if (!NILP (presflag)) - Fsetcar (valtail, Fcar (intail)); - } - } - } + Lisp_Object rep = Fassq (make_fixnum (i), reps); + if (!NILP (rep)) + Fsetcar (vals, XCDR (rep)); + vals = XCDR (vals); + ++i; } } @@ -235,31 +195,28 @@ fix_command (Lisp_Object input, Lisp_Object function, Lisp_Object values) optional, remove them from the list. This makes navigating the history less confusing, since it doesn't contain a lot of parameters that aren't used. */ - if (CONSP (values)) + Lisp_Object arity = Ffunc_arity (function); + /* We don't want to do this simplification if we have an &rest + function, because (cl-defun foo (a &optional (b 'zot)) ..) + etc. */ + if (FIXNUMP (XCAR (arity)) && FIXNUMP (XCDR (arity))) { - Lisp_Object arity = Ffunc_arity (function); - /* We don't want to do this simplification if we have an &rest - function, because (cl-defun foo (a &optional (b 'zot)) ..) - etc. */ - if (FIXNUMP (XCAR (arity)) && FIXNUMP (XCDR (arity))) + Lisp_Object final = Qnil; + ptrdiff_t final_i = 0, i = 0; + for (Lisp_Object tail = values; + CONSP (tail); + tail = XCDR (tail), ++i) { - Lisp_Object final = Qnil; - ptrdiff_t final_i = 0, i = 0; - for (Lisp_Object tail = values; - CONSP (tail); - tail = XCDR (tail), ++i) + if (!NILP (XCAR (tail))) { - if (!NILP (XCAR (tail))) - { - final = tail; - final_i = i; - } + final = tail; + final_i = i; } - - /* Chop the trailing optional values. */ - if (final_i > 0 && final_i >= XFIXNUM (XCAR (arity)) - 1) - XSETCDR (final, Qnil); } + + /* Chop the trailing optional values. */ + if (final_i > 0 && final_i >= XFIXNUM (XCAR (arity)) - 1) + XSETCDR (final, Qnil); } } @@ -950,4 +907,6 @@ use `event-start', `event-end', and `event-click-count'. */); defsubr (&Scall_interactively); defsubr (&Sfuncall_interactively); defsubr (&Sprefix_numeric_value); + + DEFSYM (Qinteractive_args, "interactive-args"); } diff --git a/test/src/callint-tests.el b/test/src/callint-tests.el index d964fc3c1f..5a633fdc2b 100644 --- a/test/src/callint-tests.el +++ b/test/src/callint-tests.el @@ -52,4 +52,17 @@ (call-interactively #'ignore t)) (should (= (length command-history) history-length)))) +(defun callint-test-int-args (foo bar &optional zot) + (declare (interactive-args + (bar 10) + (zot 11))) + (interactive (list 1 1 1)) + (+ foo bar zot)) + +(ert-deftest test-interactive-args () + (let ((history-length 1) + (command-history ())) + (should (= (call-interactively 'callint-test-int-args t) 3)) + (should (equal command-history '((callint-test-int-args 1 10 11)))))) + ;;; callint-tests.el ends here commit 498c5d26bb6360eda5c6cedbcf027e2cc67120ff Author: Po Lu Date: Mon Aug 8 20:56:41 2022 +0800 ; Fix coding style in recently installed changes to print.c * src/print.c (struct print_buffer, struct print_context): Fix brace position and make comments more like what is in lisp.h/xterm.c/etc. diff --git a/src/print.c b/src/print.c index dca5a07d79..73535550bb 100644 --- a/src/print.c +++ b/src/print.c @@ -63,11 +63,19 @@ static Lisp_Object being_printed[PRINT_CIRCLE]; /* Last char printed to stdout by printchar. */ static unsigned int printchar_stdout_last; -struct print_buffer { - char *buffer; /* Allocated buffer. */ - ptrdiff_t size; /* Size of allocated buffer. */ - ptrdiff_t pos; /* Chars stored in buffer. */ - ptrdiff_t pos_byte; /* Bytes stored in buffer. */ +struct print_buffer +{ + /* Allocated buffer. */ + char *buffer; + + /* Size of allocated buffer. */ + ptrdiff_t size; + + /* Chars stored in buffer. */ + ptrdiff_t pos; + + /* Bytes stored in buffer. */ + ptrdiff_t pos_byte; }; /* When printing into a buffer, first we put the text in this @@ -114,7 +122,8 @@ print_unwind (Lisp_Object saved_text) block of characters. */ /* State carried between print_prepare and print_finish. */ -struct print_context { +struct print_context +{ Lisp_Object printcharfun; Lisp_Object old_printcharfun; ptrdiff_t old_point, start_point; commit 55cc8b040b0e3c5f97fd1386d1e9c5a120be6340 Author: Lars Ingebrigtsen Date: Mon Aug 8 14:31:54 2022 +0200 Make which-func-mode output less junk * lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Use edebug specs to find the name (if they exist), and default to returning the top-level symbol if there isn't a define-like form (bug#49592). diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index c906ee6e31..2e7f019aa9 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -728,30 +728,58 @@ font-lock keywords will not be case sensitive." len)))) (defun lisp-current-defun-name () - "Return the name of the defun at point, or nil." + "Return the name of the defun at point. +If there is no defun at point, return the first symbol from the +top-level form. If there is no top-level form, return nil. + +(\"defun\" here means \"form that defines something\", and is +decided heuristically.)" (save-excursion - (let ((location (point))) + (let ((location (point)) + name) ;; If we are now precisely at the beginning of a defun, make sure ;; beginning-of-defun finds that one rather than the previous one. - (or (eobp) (forward-char 1)) + (unless (eobp) + (forward-char 1)) (beginning-of-defun) ;; Make sure we are really inside the defun found, not after it. - (when (and (looking-at "\\s(") - (progn (end-of-defun) - (< location (point))) - (progn (forward-sexp -1) - (>= location (point)))) - (if (looking-at "\\s(") - (forward-char 1)) - ;; Skip the defining construct name, typically "defun" or + (when (and (looking-at "(") + (progn + (end-of-defun) + (< location (point))) + (progn + (forward-sexp -1) + (>= location (point)))) + (when (looking-at "(") + (forward-char 1)) + ;; Read the defining construct name, typically "defun" or ;; "defvar". - (forward-sexp 1) - ;; The second element is usually a symbol being defined. If it - ;; is not, use the first symbol in it. - (skip-chars-forward " \t\n'(") - (buffer-substring-no-properties (point) - (progn (forward-sexp 1) - (point))))))) + (let ((symbol (ignore-errors (read (current-buffer))))) + (when (and symbol (not (symbolp symbol))) + (setq symbol nil)) + ;; If there's an edebug spec, use that to determine what the + ;; name is. + (when symbol + (let ((spec (get symbol 'edebug-form-spec))) + (save-excursion + (when (and (eq (car spec) '&define) + (memq 'name spec)) + (pop spec) + (while (and spec (not name)) + (let ((candidate (ignore-errors (read (current-buffer))))) + (when (eq (pop spec) 'name) + (setq name candidate + spec nil)))))))) + ;; We didn't have an edebug spec (or couldn't find the + ;; name). If the symbol starts with \"def\", then it's + ;; likely that the next symbol is the name. + (when (and (not name) + (string-match-p "\\`def" (symbol-name symbol))) + (when-let ((candidate (ignore-errors (read (current-buffer))))) + (when (symbolp candidate) + (setq name candidate)))) + (when-let ((result (or name symbol))) + (symbol-name result))))))) (defvar-keymap lisp-mode-shared-map :doc "Keymap for commands shared by all sorts of Lisp modes." diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 2e8e8d2319..4fe4edc164 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -61,6 +61,9 @@ ;;; Code: +;; So that we can use the edebug spec in `lisp-current-defun-name'. +(require 'edebug) + ;; Variables for customization ;; --------------------------- ;; diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el index fd1af75ba3..d3e78aa1d7 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el @@ -330,5 +330,28 @@ Expected initialization file: `%s'\" (faceup-clean-buffer) (should (faceup-test-font-lock-buffer 'emacs-lisp-mode faceup))))) +(ert-deftest test-lisp-current-defun-name () + (require 'edebug) + (with-temp-buffer + (emacs-lisp-mode) + (insert "(defun foo ()\n'bar)\n") + (goto-char 5) + (should (equal (lisp-current-defun-name) "foo"))) + (with-temp-buffer + (emacs-lisp-mode) + (insert "(define-flabbergast-test zot ()\n'bar)\n") + (goto-char 5) + (should (equal (lisp-current-defun-name) "zot"))) + (with-temp-buffer + (emacs-lisp-mode) + (insert "(progn\n ;; comment\n ;; about that\n (define-key ...)\n )") + (goto-char 5) + (should (equal (lisp-current-defun-name) "progn"))) + (with-temp-buffer + (emacs-lisp-mode) + (insert "(defblarg \"a\" 'b)") + (goto-char 5) + (should (equal (lisp-current-defun-name) "defblarg")))) + (provide 'lisp-mode-tests) ;;; lisp-mode-tests.el ends here commit 3d7d8ddc5ac73ebeb4aff9e672e649c8352beeb2 Author: Stefan Kangas Date: Mon Aug 8 14:08:47 2022 +0200 ; Fix typos diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index a8ce294ad9..26739bf5b8 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -2704,7 +2704,7 @@ Return the timestamp in @var{position}. This is the time at which the event occurred, in milliseconds. Such a timestamp is reported relative to an arbitrary starting time that varies according to the window system in use. On the X Window System, for example, it is the -number of miliseconds since the X server was started. +number of milliseconds since the X server was started. @end defun These functions compute a position list given particular buffer diff --git a/doc/misc/modus-themes.org b/doc/misc/modus-themes.org index a80bf6be8a..ddd9595fc8 100644 --- a/doc/misc/modus-themes.org +++ b/doc/misc/modus-themes.org @@ -1253,7 +1253,7 @@ accepts is as follows (order is not significant): The ~popup~ key takes the same values as ~selection~. -Apart from specfying each key separately, a fallback list is accepted. +Apart from specifying each key separately, a fallback list is accepted. This is only useful when the desired aesthetic is the same across all keys that are not explicitly referenced. For example, this: @@ -3639,7 +3639,7 @@ it if you plan to control face attributes. :end: #+cindex: Org custom emphasis faces -Org provides the user option ~org-emphasis-alist~ which assosiates a +Org provides the user option ~org-emphasis-alist~ which associates a character with a face, list of faces, or face attributes. The default specification of that variable looks like this: diff --git a/etc/themes/modus-themes.el b/etc/themes/modus-themes.el index 54e5e465b1..e64a11b74f 100644 --- a/etc/themes/modus-themes.el +++ b/etc/themes/modus-themes.el @@ -2270,7 +2270,7 @@ follows (order is not significant): The `popup' key takes the same values as `selection'. -Apart from specfying each key separately, a fallback list is +Apart from specifying each key separately, a fallback list is accepted. This is only useful when the desired aesthetic is the same across all keys that are not explicitly referenced. For example, this: diff --git a/lisp/ChangeLog.12 b/lisp/ChangeLog.12 index c45c8ae735..a89e515510 100644 --- a/lisp/ChangeLog.12 +++ b/lisp/ChangeLog.12 @@ -14359,7 +14359,7 @@ * ldefs-boot.el: Likewise. * textmodes/bibtex.el (bibtex-validate-globally): Fix typo in a - message text: "Duplicat" => "Duplicate". + message text. 2006-01-06 Sven Joachim (tiny change) diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el index 516fdeb10e..d60eedbc9c 100644 --- a/lisp/emacs-lisp/warnings.el +++ b/lisp/emacs-lisp/warnings.el @@ -209,7 +209,7 @@ SUPPRESS-LIST is the list of kinds of warnings to suppress." (text " stop ")) "Suppress warnings." :version "29.1" - :help-echo "Click to supress this warning type") + :help-echo "Click to suppress this warning type") (defun warnings-suppress (type) (pcase (car diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 768023b54c..59a509b221 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -799,7 +799,7 @@ the C sources, too." ;; different purposes, such as function name, var name, face name, ;; property name, ...). (concat - ;; The main "canonical" occurence of symbols is within '...'. + ;; The main "canonical" occurrence of symbols is within '...'. "'" quoted "'" ;; Commands can also occur as `M-x blabla'. "\\|M-x[ \t\n]+" quoted "\\_>" diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el index bdfe444bc1..2bda67fe3f 100644 --- a/lisp/x-dnd.el +++ b/lisp/x-dnd.el @@ -1480,7 +1480,7 @@ instead of returning \"E\".") (error '(STRING . "E"))))))) (defun x-dnd-handle-octet-stream (_selection _type _value) - "Handle a selecton request for `application/octet-stream'. + "Handle a selection request for `application/octet-stream'. Return the contents of the XDS file." (cons 'application/octet-stream (ignore-errors diff --git a/src/xterm.c b/src/xterm.c index 23a35aa161..36797bc0ab 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6837,7 +6837,7 @@ x_sync_trigger_fence (struct frame *f, XSyncValue value) idx = (n / 4) % 2; #ifdef FRAME_DEBUG - fprintf (stderr, "Triggering synchonization fence: %lu\n", idx); + fprintf (stderr, "Triggering synchronization fence: %lu\n", idx); #endif XSyncTriggerFence (FRAME_X_DISPLAY (f), @@ -18928,7 +18928,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, { /* Now clear dpyinfo->last_mouse_motion_frame, or gui_redo_mouse_highlight will end up highlighting the - last known poisition of the mouse if a tooltip frame is + last known position of the mouse if a tooltip frame is later unmapped. */ if (f == dpyinfo->last_mouse_motion_frame) @@ -20397,7 +20397,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, { /* Now clear dpyinfo->last_mouse_motion_frame, or gui_redo_mouse_highlight will end up highlighting - the last known poisition of the mouse if a + the last known position of the mouse if a tooltip frame is later unmapped. */ if (f == dpyinfo->last_mouse_motion_frame) diff --git a/test/lisp/erc/resources/erc-scenarios-common.el b/test/lisp/erc/resources/erc-scenarios-common.el index cbabfcd26b..bc2cb68cd8 100644 --- a/test/lisp/erc/resources/erc-scenarios-common.el +++ b/test/lisp/erc/resources/erc-scenarios-common.el @@ -142,10 +142,10 @@ Dialog resource directories are located by expanding the variable (declare (indent 1)) (let* ((orig-autojoin-mode (make-symbol "orig-autojoin-mode")) - (combind `((,orig-autojoin-mode (bound-and-true-p erc-autojoin-mode)) + (combined `((,orig-autojoin-mode (bound-and-true-p erc-autojoin-mode)) ,@(erc-scenarios-common--make-bindings bindings)))) - `(erc-d-t-with-cleanup (,@combind) + `(erc-d-t-with-cleanup (,@combined) (ert-info ("Restore autojoin, etc., kill ERC buffers") (dolist (buf (buffer-list)) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index e2cafc240b..a3e80e8956 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -2481,7 +2481,7 @@ This checks also `file-name-as-directory', `file-name-directory', (insert-file-contents tmp-name) (should (string-equal (buffer-string) "foo"))) - ;; Write empty string. Used for creation of temprorary files. + ;; Write empty string. Used for creation of temporary files. ;; Since Emacs 27.1. (when (fboundp 'make-empty-file) (with-no-warnings commit cf30432a14b935726cd0845ae490bdd5b94625ab Author: Stefan Kangas Date: Mon Aug 8 13:37:43 2022 +0200 * test/lisp/emacs-lisp/nadvice-tests.el: Re-add no-byte-compile. diff --git a/test/lisp/emacs-lisp/nadvice-tests.el b/test/lisp/emacs-lisp/nadvice-tests.el index fa76c72565..a675986b90 100644 --- a/test/lisp/emacs-lisp/nadvice-tests.el +++ b/test/lisp/emacs-lisp/nadvice-tests.el @@ -213,4 +213,8 @@ function being an around advice." (should (equal (cl-prin1-to-string (car x)) "#f(advice first :before #f(advice car :after cdr))")))) +;; Local Variables: +;; no-byte-compile: t +;; End: + ;;; nadvice-tests.el ends here commit d8d13f2fccadfdd999a818a5c320f6d0f0d428fe Author: Stefan Kangas Date: Mon Aug 8 13:18:36 2022 +0200 Remove redundant local variables in tests * test/lisp/calc/calc-tests.el: * test/lisp/progmodes/python-tests.el: Remove redundant local variables. * test/src/coding-tests.el: Pacify byte-compiler without using local variable. diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index 64e59f5b9b..cd984f7ff7 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -818,7 +818,3 @@ An existing calc stack is reused, otherwise a new one is created." (provide 'calc-tests) ;;; calc-tests.el ends here - -;; Local Variables: -;; bug-reference-url-format: "https://debbugs.gnu.org/%s" -;; End: diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index eb57122690..e3c8d5554a 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -6075,8 +6075,4 @@ buffer with overlapping strings." (provide 'python-tests) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: - ;;; python-tests.el ends here diff --git a/test/src/coding-tests.el b/test/src/coding-tests.el index de4ddb546d..f65d575d0c 100644 --- a/test/src/coding-tests.el +++ b/test/src/coding-tests.el @@ -61,16 +61,17 @@ ;; Return the contents (specified by CONTENT-TYPE; ascii, latin, or ;; binary) of a test file. (defun coding-tests-file-contents (content-type) - (let* ((ascii "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n") - (latin (concat ascii "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ\n")) - (binary (string-to-multibyte - (concat (string-as-unibyte latin) - (unibyte-string #xC0 #xC1 ?\n))))) - (cond ((eq content-type 'ascii) ascii) - ((eq content-type 'latin) latin) - ((eq content-type 'binary) binary) - (t - (error "Invalid file content type: %s" content-type))))) + (with-suppressed-warnings ((obsolete string-as-unibyte)) + (let* ((ascii "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n") + (latin (concat ascii "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ\n")) + (binary (string-to-multibyte + (concat (string-as-unibyte latin) + (unibyte-string #xC0 #xC1 ?\n))))) + (cond ((eq content-type 'ascii) ascii) + ((eq content-type 'latin) latin) + ((eq content-type 'binary) binary) + (t + (error "Invalid file content type: %s" content-type)))))) ;; Generate FILE with CONTENTS encoded by CODING-SYSTEM. ;; whose encoding specified by CODING-SYSTEM. @@ -429,9 +430,5 @@ '((iso-latin-1 3) (us-ascii 1 3)))) (should-error (check-coding-systems-region "å" nil '(bad-coding-system)))) -;; Local Variables: -;; byte-compile-warnings: (not obsolete) -;; End: - (provide 'coding-tests) ;;; coding-tests.el ends here commit 25636fcf5223341bf415a4014e643f4b2caa446d Author: Stefan Kangas Date: Mon Aug 8 12:03:30 2022 +0200 Revert "Don't autoload obsolete library tpu-extras.el" This reverts commit 77bf50cb330807039cc84138fb84870bd6d532e2. diff --git a/lisp/obsolete/tpu-edt.el b/lisp/obsolete/tpu-edt.el index 1e3fc0d569..8c4ec8f7e0 100644 --- a/lisp/obsolete/tpu-edt.el +++ b/lisp/obsolete/tpu-edt.el @@ -2412,6 +2412,35 @@ If FILE is nil, try to load a default file. The default file name is (error nil)) (setq tpu-edt-mode nil)) + +;;;### (autoloads nil "tpu-extras" "tpu-extras.el" "cbbb448cff48fab904ac19805aa6f36a") +;;; Generated autoloads from tpu-extras.el + +(autoload 'tpu-cursor-free-mode "tpu-extras" "\ +Minor mode to allow the cursor to move freely about the screen. +With a prefix argument ARG, enable the mode if ARG is positive, +and disable it otherwise. If called from Lisp, enable the mode +if ARG is omitted or nil. + +\(fn &optional ARG)" t nil) + +(autoload 'tpu-set-scroll-margins "tpu-extras" "\ +Set scroll margins. + +\(fn TOP BOTTOM)" t nil) + +(autoload 'tpu-set-cursor-free "tpu-extras" "\ +Allow the cursor to move freely about the screen. + +\(fn)" t nil) + +(autoload 'tpu-set-cursor-bound "tpu-extras" "\ +Constrain the cursor to the flow of the text. + +\(fn)" t nil) + +;;;*** + (provide 'tpu-edt) ;;; tpu-edt.el ends here diff --git a/lisp/obsolete/tpu-extras.el b/lisp/obsolete/tpu-extras.el index 23f6020fd3..76338cdd24 100644 --- a/lisp/obsolete/tpu-extras.el +++ b/lisp/obsolete/tpu-extras.el @@ -422,4 +422,8 @@ A repeat count means scroll that many sections." (provide 'tpu-extras) +;; Local Variables: +;; generated-autoload-file: "tpu-edt.el" +;; End: + ;;; tpu-extras.el ends here commit 8c8ae516403fc901a63cc02915abf9a1542d7248 Author: Mattias Engdegård Date: Mon Aug 8 13:09:39 2022 +0200 Group print buffer state in a struct * src/print.c (print_buffer, print_buffer_size, print_buffer_pos) (print_buffer_pos_byte): Replace with... (struct print_buffer, print_buffer): ...this. * src/print.c: (print_free_buffer, print_unwind) (print_prepare, print_finish, printchar, strout): Adapt users. diff --git a/src/print.c b/src/print.c index b2b35bd235..dca5a07d79 100644 --- a/src/print.c +++ b/src/print.c @@ -63,16 +63,16 @@ static Lisp_Object being_printed[PRINT_CIRCLE]; /* Last char printed to stdout by printchar. */ static unsigned int printchar_stdout_last; +struct print_buffer { + char *buffer; /* Allocated buffer. */ + ptrdiff_t size; /* Size of allocated buffer. */ + ptrdiff_t pos; /* Chars stored in buffer. */ + ptrdiff_t pos_byte; /* Bytes stored in buffer. */ +}; + /* When printing into a buffer, first we put the text in this block, then insert it all at once. */ -static char *print_buffer; - -/* Size allocated in print_buffer. */ -static ptrdiff_t print_buffer_size; -/* Chars stored in print_buffer. */ -static ptrdiff_t print_buffer_pos; -/* Bytes stored in print_buffer. */ -static ptrdiff_t print_buffer_pos_byte; +static struct print_buffer print_buffer; /* Vprint_number_table is a table, that keeps objects that are going to be printed, to allow use of #n= and #n# to express sharing. @@ -96,8 +96,8 @@ bool print_output_debug_flag EXTERNALLY_VISIBLE = 1; static void print_free_buffer (void) { - xfree (print_buffer); - print_buffer = NULL; + xfree (print_buffer.buffer); + print_buffer.buffer = NULL; } /* This is used to restore the saved contents of print_buffer @@ -105,7 +105,7 @@ print_free_buffer (void) static void print_unwind (Lisp_Object saved_text) { - memcpy (print_buffer, SDATA (saved_text), SCHARS (saved_text)); + memcpy (print_buffer.buffer, SDATA (saved_text), SCHARS (saved_text)); } /* Lisp functions to do output using a stream must start with a call to @@ -169,22 +169,22 @@ print_prepare (Lisp_Object printcharfun) if (! NILP (BVAR (current_buffer, enable_multibyte_characters)) && ! print_escape_nonascii) specbind (Qprint_escape_nonascii, Qt); - if (print_buffer != 0) + if (print_buffer.buffer != NULL) { - Lisp_Object string = make_string_from_bytes (print_buffer, - print_buffer_pos, - print_buffer_pos_byte); + Lisp_Object string = make_string_from_bytes (print_buffer.buffer, + print_buffer.pos, + print_buffer.pos_byte); record_unwind_protect (print_unwind, string); } else { int new_size = 1000; - print_buffer = xmalloc (new_size); - print_buffer_size = new_size; + print_buffer.buffer = xmalloc (new_size); + print_buffer.size = new_size; record_unwind_protect_void (print_free_buffer); } - print_buffer_pos = 0; - print_buffer_pos_byte = 0; + print_buffer.pos = 0; + print_buffer.pos_byte = 0; } if (EQ (printcharfun, Qt) && ! noninteractive) setup_echo_area_for_printing (multibyte); @@ -197,21 +197,21 @@ print_finish (struct print_context *pc) { if (NILP (pc->printcharfun)) { - if (print_buffer_pos != print_buffer_pos_byte + if (print_buffer.pos != print_buffer.pos_byte && NILP (BVAR (current_buffer, enable_multibyte_characters))) { USE_SAFE_ALLOCA; - unsigned char *temp = SAFE_ALLOCA (print_buffer_pos + 1); - copy_text ((unsigned char *) print_buffer, temp, - print_buffer_pos_byte, 1, 0); - insert_1_both ((char *) temp, print_buffer_pos, - print_buffer_pos, 0, 1, 0); + unsigned char *temp = SAFE_ALLOCA (print_buffer.pos + 1); + copy_text ((unsigned char *) print_buffer.buffer, temp, + print_buffer.pos_byte, 1, 0); + insert_1_both ((char *) temp, print_buffer.pos, + print_buffer.pos, 0, 1, 0); SAFE_FREE (); } else - insert_1_both (print_buffer, print_buffer_pos, - print_buffer_pos_byte, 0, 1, 0); - signal_after_change (PT - print_buffer_pos, 0, print_buffer_pos); + insert_1_both (print_buffer.buffer, print_buffer.pos, + print_buffer.pos_byte, 0, 1, 0); + signal_after_change (PT - print_buffer.pos, 0, print_buffer.pos); } if (MARKERP (pc->old_printcharfun)) set_marker_both (pc->old_printcharfun, Qnil, PT, PT_BYTE); @@ -310,13 +310,14 @@ printchar (unsigned int ch, Lisp_Object fun) if (NILP (fun)) { - ptrdiff_t incr = len - (print_buffer_size - print_buffer_pos_byte); + ptrdiff_t incr = len - (print_buffer.size - print_buffer.pos_byte); if (incr > 0) - print_buffer = xpalloc (print_buffer, &print_buffer_size, - incr, -1, 1); - memcpy (print_buffer + print_buffer_pos_byte, str, len); - print_buffer_pos += 1; - print_buffer_pos_byte += len; + print_buffer.buffer = xpalloc (print_buffer.buffer, + &print_buffer.size, + incr, -1, 1); + memcpy (print_buffer.buffer + print_buffer.pos_byte, str, len); + print_buffer.pos += 1; + print_buffer.pos_byte += len; } else if (noninteractive) { @@ -375,12 +376,13 @@ strout (const char *ptr, ptrdiff_t size, ptrdiff_t size_byte, { if (NILP (printcharfun)) { - ptrdiff_t incr = size_byte - (print_buffer_size - print_buffer_pos_byte); + ptrdiff_t incr = size_byte - (print_buffer.size - print_buffer.pos_byte); if (incr > 0) - print_buffer = xpalloc (print_buffer, &print_buffer_size, incr, -1, 1); - memcpy (print_buffer + print_buffer_pos_byte, ptr, size_byte); - print_buffer_pos += size; - print_buffer_pos_byte += size_byte; + print_buffer.buffer = xpalloc (print_buffer.buffer, + &print_buffer.size, incr, -1, 1); + memcpy (print_buffer.buffer + print_buffer.pos_byte, ptr, size_byte); + print_buffer.pos += size; + print_buffer.pos_byte += size_byte; } else if (noninteractive && EQ (printcharfun, Qt)) { commit 14f0ebc9ac8d2f0f272bdb1eac4dd2ea0b50a0f4 Author: Mattias Engdegård Date: Mon Aug 8 12:39:12 2022 +0200 Turn large macros in print.c to functions This is easier to read and maintain, and makes the state explicit. It is a pure refactoring; the compiled code should be equivalent. * src/print.c (PRINTPREPARE, PRINTFINISH): Replace with... (struct print_context, print_prepare, print_finish): ...these new functions and explicit state in a struct. (Fwrite_char, write_string, Fterpri, Fprin1, Fprin1_to_string) (Fprinc, Fprint): Adapt callers. diff --git a/src/print.c b/src/print.c index 7303e847aa..b2b35bd235 100644 --- a/src/print.c +++ b/src/print.c @@ -91,107 +91,8 @@ bool print_output_debug_flag EXTERNALLY_VISIBLE = 1; /* Low level output routines for characters and strings. */ -/* Lisp functions to do output using a stream - must have the stream in a variable called printcharfun - and must start with PRINTPREPARE, end with PRINTFINISH. - Use printchar to output one character, - or call strout to output a block of characters. */ - -#define PRINTPREPARE \ - ptrdiff_t old_point = -1, start_point = -1; \ - ptrdiff_t old_point_byte = -1, start_point_byte = -1; \ - specpdl_ref specpdl_count = SPECPDL_INDEX (); \ - bool multibyte \ - = !NILP (BVAR (current_buffer, enable_multibyte_characters)); \ - Lisp_Object original = printcharfun; \ - record_unwind_current_buffer (); \ - specbind(Qprint__unreadable_callback_buffer, Fcurrent_buffer ()); \ - if (NILP (printcharfun)) printcharfun = Qt; \ - if (BUFFERP (printcharfun)) \ - { \ - if (XBUFFER (printcharfun) != current_buffer) \ - Fset_buffer (printcharfun); \ - printcharfun = Qnil; \ - } \ - if (MARKERP (printcharfun)) \ - { \ - ptrdiff_t marker_pos; \ - if (! XMARKER (printcharfun)->buffer) \ - error ("Marker does not point anywhere"); \ - if (XMARKER (printcharfun)->buffer != current_buffer) \ - set_buffer_internal (XMARKER (printcharfun)->buffer); \ - marker_pos = marker_position (printcharfun); \ - if (marker_pos < BEGV || marker_pos > ZV) \ - signal_error ("Marker is outside the accessible " \ - "part of the buffer", printcharfun); \ - old_point = PT; \ - old_point_byte = PT_BYTE; \ - SET_PT_BOTH (marker_pos, \ - marker_byte_position (printcharfun)); \ - start_point = PT; \ - start_point_byte = PT_BYTE; \ - printcharfun = Qnil; \ - } \ - if (NILP (printcharfun)) \ - { \ - Lisp_Object string; \ - if (NILP (BVAR (current_buffer, enable_multibyte_characters)) \ - && ! print_escape_multibyte) \ - specbind (Qprint_escape_multibyte, Qt); \ - if (! NILP (BVAR (current_buffer, enable_multibyte_characters)) \ - && ! print_escape_nonascii) \ - specbind (Qprint_escape_nonascii, Qt); \ - if (print_buffer != 0) \ - { \ - string = make_string_from_bytes (print_buffer, \ - print_buffer_pos, \ - print_buffer_pos_byte); \ - record_unwind_protect (print_unwind, string); \ - } \ - else \ - { \ - int new_size = 1000; \ - print_buffer = xmalloc (new_size); \ - print_buffer_size = new_size; \ - record_unwind_protect_void (print_free_buffer); \ - } \ - print_buffer_pos = 0; \ - print_buffer_pos_byte = 0; \ - } \ - if (EQ (printcharfun, Qt) && ! noninteractive) \ - setup_echo_area_for_printing (multibyte); - -#define PRINTFINISH \ - if (NILP (printcharfun)) \ - { \ - if (print_buffer_pos != print_buffer_pos_byte \ - && NILP (BVAR (current_buffer, enable_multibyte_characters)))\ - { \ - USE_SAFE_ALLOCA; \ - unsigned char *temp = SAFE_ALLOCA (print_buffer_pos + 1); \ - copy_text ((unsigned char *) print_buffer, temp, \ - print_buffer_pos_byte, 1, 0); \ - insert_1_both ((char *) temp, print_buffer_pos, \ - print_buffer_pos, 0, 1, 0); \ - SAFE_FREE (); \ - } \ - else \ - insert_1_both (print_buffer, print_buffer_pos, \ - print_buffer_pos_byte, 0, 1, 0); \ - signal_after_change (PT - print_buffer_pos, 0, print_buffer_pos);\ - } \ - if (MARKERP (original)) \ - set_marker_both (original, Qnil, PT, PT_BYTE); \ - if (old_point >= 0) \ - SET_PT_BOTH (old_point + (old_point >= start_point \ - ? PT - start_point : 0), \ - old_point_byte + (old_point_byte >= start_point_byte \ - ? PT_BYTE - start_point_byte : 0)); \ - unbind_to (specpdl_count, Qnil); \ - /* This is used to free the print buffer; we don't simply record xfree since print_buffer can be reallocated during the printing. */ - static void print_free_buffer (void) { @@ -201,13 +102,129 @@ print_free_buffer (void) /* This is used to restore the saved contents of print_buffer when there is a recursive call to print. */ - static void print_unwind (Lisp_Object saved_text) { memcpy (print_buffer, SDATA (saved_text), SCHARS (saved_text)); } +/* Lisp functions to do output using a stream must start with a call to + print_prepare, and end with calling print_finish. + Use printchar to output one character, or call strout to output a + block of characters. */ + +/* State carried between print_prepare and print_finish. */ +struct print_context { + Lisp_Object printcharfun; + Lisp_Object old_printcharfun; + ptrdiff_t old_point, start_point; + ptrdiff_t old_point_byte, start_point_byte; + specpdl_ref specpdl_count; +}; + +static inline struct print_context +print_prepare (Lisp_Object printcharfun) +{ + struct print_context pc = { + .old_printcharfun = printcharfun, + .old_point = -1, + .start_point = -1, + .old_point_byte = -1, + .start_point_byte = -1, + .specpdl_count = SPECPDL_INDEX (), + }; + bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); + record_unwind_current_buffer (); + specbind(Qprint__unreadable_callback_buffer, Fcurrent_buffer ()); + if (NILP (printcharfun)) + printcharfun = Qt; + if (BUFFERP (printcharfun)) + { + if (XBUFFER (printcharfun) != current_buffer) + Fset_buffer (printcharfun); + printcharfun = Qnil; + } + if (MARKERP (printcharfun)) + { + if (! XMARKER (printcharfun)->buffer) + error ("Marker does not point anywhere"); + if (XMARKER (printcharfun)->buffer != current_buffer) + set_buffer_internal (XMARKER (printcharfun)->buffer); + ptrdiff_t marker_pos = marker_position (printcharfun); + if (marker_pos < BEGV || marker_pos > ZV) + signal_error ("Marker is outside the accessible part of the buffer", + printcharfun); + pc.old_point = PT; + pc.old_point_byte = PT_BYTE; + SET_PT_BOTH (marker_pos, marker_byte_position (printcharfun)); + pc.start_point = PT; + pc.start_point_byte = PT_BYTE; + printcharfun = Qnil; + } + if (NILP (printcharfun)) + { + if (NILP (BVAR (current_buffer, enable_multibyte_characters)) + && ! print_escape_multibyte) + specbind (Qprint_escape_multibyte, Qt); + if (! NILP (BVAR (current_buffer, enable_multibyte_characters)) + && ! print_escape_nonascii) + specbind (Qprint_escape_nonascii, Qt); + if (print_buffer != 0) + { + Lisp_Object string = make_string_from_bytes (print_buffer, + print_buffer_pos, + print_buffer_pos_byte); + record_unwind_protect (print_unwind, string); + } + else + { + int new_size = 1000; + print_buffer = xmalloc (new_size); + print_buffer_size = new_size; + record_unwind_protect_void (print_free_buffer); + } + print_buffer_pos = 0; + print_buffer_pos_byte = 0; + } + if (EQ (printcharfun, Qt) && ! noninteractive) + setup_echo_area_for_printing (multibyte); + pc.printcharfun = printcharfun; + return pc; +} + +static inline void +print_finish (struct print_context *pc) +{ + if (NILP (pc->printcharfun)) + { + if (print_buffer_pos != print_buffer_pos_byte + && NILP (BVAR (current_buffer, enable_multibyte_characters))) + { + USE_SAFE_ALLOCA; + unsigned char *temp = SAFE_ALLOCA (print_buffer_pos + 1); + copy_text ((unsigned char *) print_buffer, temp, + print_buffer_pos_byte, 1, 0); + insert_1_both ((char *) temp, print_buffer_pos, + print_buffer_pos, 0, 1, 0); + SAFE_FREE (); + } + else + insert_1_both (print_buffer, print_buffer_pos, + print_buffer_pos_byte, 0, 1, 0); + signal_after_change (PT - print_buffer_pos, 0, print_buffer_pos); + } + if (MARKERP (pc->old_printcharfun)) + set_marker_both (pc->old_printcharfun, Qnil, PT, PT_BYTE); + if (pc->old_point >= 0) + SET_PT_BOTH (pc->old_point + + (pc->old_point >= pc->start_point + ? PT - pc->start_point : 0), + pc->old_point_byte + + (pc->old_point_byte >= pc->start_point_byte + ? PT_BYTE - pc->start_point_byte : 0)); + unbind_to (pc->specpdl_count, Qnil); +} + /* Print character CH to the stdio stream STREAM. */ static void @@ -527,14 +544,14 @@ PRINTCHARFUN defaults to the value of `standard-output' (which see). */) if (NILP (printcharfun)) printcharfun = Vstandard_output; CHECK_FIXNUM (character); - PRINTPREPARE; - printchar (XFIXNUM (character), printcharfun); - PRINTFINISH; + struct print_context pc = print_prepare (printcharfun); + printchar (XFIXNUM (character), pc.printcharfun); + print_finish (&pc); return character; } /* Print the contents of a unibyte C string STRING using PRINTCHARFUN. - The caller should arrange to put this inside PRINTPREPARE and PRINTFINISH. + The caller should arrange to put this inside print_prepare and print_finish. Do not use this on the contents of a Lisp string. */ static void @@ -550,9 +567,9 @@ print_c_string (char const *string, Lisp_Object printcharfun) static void write_string (const char *data, Lisp_Object printcharfun) { - PRINTPREPARE; - print_c_string (data, printcharfun); - PRINTFINISH; + struct print_context pc = print_prepare (printcharfun); + print_c_string (data, pc.printcharfun); + print_finish (&pc); } @@ -605,21 +622,21 @@ If PRINTCHARFUN is omitted or nil, the value of `standard-output' is used. */) if (NILP (printcharfun)) printcharfun = Vstandard_output; - PRINTPREPARE; + struct print_context pc = print_prepare (printcharfun); if (NILP (ensure)) val = Qt; /* Difficult to check if at line beginning so abort. */ - else if (FUNCTIONP (printcharfun)) - signal_error ("Unsupported function argument", printcharfun); - else if (noninteractive && !NILP (printcharfun)) + else if (FUNCTIONP (pc.printcharfun)) + signal_error ("Unsupported function argument", pc.printcharfun); + else if (noninteractive && !NILP (pc.printcharfun)) val = printchar_stdout_last == 10 ? Qnil : Qt; else val = NILP (Fbolp ()) ? Qt : Qnil; if (!NILP (val)) - printchar ('\n', printcharfun); - PRINTFINISH; + printchar ('\n', pc.printcharfun); + print_finish (&pc); return val; } @@ -750,9 +767,9 @@ means "use default values for all the print-related settings". */) if (!NILP (overrides)) print_bind_overrides (overrides); - PRINTPREPARE; - print (object, printcharfun, 1); - PRINTFINISH; + struct print_context pc = print_prepare (printcharfun); + print (object, pc.printcharfun, 1); + print_finish (&pc); return unbind_to (count, object); } @@ -787,11 +804,10 @@ A printed representation of an object is text which describes that object. */) No need for specbind, since errors deactivate the mark. */ Lisp_Object save_deactivate_mark = Vdeactivate_mark; - Lisp_Object printcharfun = Vprin1_to_string_buffer; - PRINTPREPARE; - print (object, printcharfun, NILP (noescape)); - /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINISH */ - PRINTFINISH; + struct print_context pc = print_prepare (Vprin1_to_string_buffer); + print (object, pc.printcharfun, NILP (noescape)); + /* Make Vprin1_to_string_buffer be the default buffer after print_finish */ + print_finish (&pc); struct buffer *previous = current_buffer; set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); @@ -836,15 +852,15 @@ is used instead. */) { if (NILP (printcharfun)) printcharfun = Vstandard_output; - PRINTPREPARE; + struct print_context pc = print_prepare (printcharfun); if (STRINGP (object) && !string_intervals (object) && NILP (Vprint_continuous_numbering)) /* fast path for plain strings */ - print_string (object, printcharfun); + print_string (object, pc.printcharfun); else - print (object, printcharfun, 0); - PRINTFINISH; + print (object, pc.printcharfun, 0); + print_finish (&pc); return object; } @@ -875,11 +891,11 @@ is used instead. */) { if (NILP (printcharfun)) printcharfun = Vstandard_output; - PRINTPREPARE; - printchar ('\n', printcharfun); - print (object, printcharfun, 1); - printchar ('\n', printcharfun); - PRINTFINISH; + struct print_context pc = print_prepare (printcharfun); + printchar ('\n', pc.printcharfun); + print (object, pc.printcharfun, 1); + printchar ('\n', pc.printcharfun); + print_finish (&pc); return object; } commit 60738e569d24b74b9e6973225d143b3468bfc60f Author: Stefan Kangas Date: Mon Aug 8 11:50:33 2022 +0200 Remove no-byte-compile cookie from some libraries This gives us back byte-compiler warnings for these files. * lisp/mh-e/mh-acros.el: * test/lisp/comint-tests.el: * test/lisp/emacs-lisp/nadvice-tests.el: * test/lisp/emacs-lisp/syntax-tests.el: * test/lisp/xml-tests.el: * test/src/font-tests.el: Remove no-byte-compile cookie. * test/src/font-tests.el (font-parse-explain): Fix warning. diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el index faf27cd066..2b4807ab69 100644 --- a/lisp/mh-e/mh-acros.el +++ b/lisp/mh-e/mh-acros.el @@ -288,7 +288,6 @@ form (FUNCNAME ARGLIST BODY...), similar to defun." (provide 'mh-acros) ;; Local Variables: -;; no-byte-compile: t ;; sentence-end-double-space: nil ;; End: diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el index 2885aaa914..8402c13daf 100644 --- a/test/lisp/comint-tests.el +++ b/test/lisp/comint-tests.el @@ -95,8 +95,4 @@ flow. Hook function returns alternative password." password flow if it returns a nil value." (comint-tests/test-password-function #'ignore)) -;; Local Variables: -;; no-byte-compile: t -;; End: - ;;; comint-tests.el ends here diff --git a/test/lisp/emacs-lisp/nadvice-tests.el b/test/lisp/emacs-lisp/nadvice-tests.el index a675986b90..fa76c72565 100644 --- a/test/lisp/emacs-lisp/nadvice-tests.el +++ b/test/lisp/emacs-lisp/nadvice-tests.el @@ -213,8 +213,4 @@ function being an around advice." (should (equal (cl-prin1-to-string (car x)) "#f(advice first :before #f(advice car :after cdr))")))) -;; Local Variables: -;; no-byte-compile: t -;; End: - ;;; nadvice-tests.el ends here diff --git a/test/lisp/emacs-lisp/syntax-tests.el b/test/lisp/emacs-lisp/syntax-tests.el index 53812c0c80..f266db5c70 100644 --- a/test/lisp/emacs-lisp/syntax-tests.el +++ b/test/lisp/emacs-lisp/syntax-tests.el @@ -60,8 +60,4 @@ (should-error (syntax-propertize--shift-groups-and-backrefs "\\(a\\)\\3" 7))) -;; Local Variables: -;; no-byte-compile: t -;; End: - ;;; syntax-tests.el ends here. diff --git a/test/lisp/xml-tests.el b/test/lisp/xml-tests.el index 748f1e3944..0040e5c7ba 100644 --- a/test/lisp/xml-tests.el +++ b/test/lisp/xml-tests.el @@ -195,8 +195,4 @@ Parser is called with and without `symbol-qnames' argument.") (should (equal (cdr test) (xml-parse-region (point-min) (point-max)))))) -;; Local Variables: -;; no-byte-compile: t -;; End: - ;;; xml-tests.el ends here diff --git a/test/src/font-tests.el b/test/src/font-tests.el index d99b0be89e..7e9669c651 100644 --- a/test/src/font-tests.el +++ b/test/src/font-tests.el @@ -96,8 +96,7 @@ expected font properties from parsing NAME.") (put 'font-parse-check 'ert-explainer 'font-parse-explain) (defun font-parse-explain (name prop expected) - (let ((result (font-get (font-spec :name name) prop)) - (propname (symbol-name prop))) + (let ((propname (symbol-name prop))) (format "Parsing `%s': expected %s `%s', got `%s'." name (substring propname 1) expected (font-get (font-spec :name name) prop)))) @@ -184,9 +183,5 @@ expected font properties from parsing NAME.") :family) 'name-with-lots-of-dashes))) -;; Local Variables: -;; no-byte-compile: t -;; End: - (provide 'font-tests) ;;; font-tests.el ends here. commit 77bf50cb330807039cc84138fb84870bd6d532e2 Author: Stefan Kangas Date: Mon Aug 8 11:13:58 2022 +0200 Don't autoload obsolete library tpu-extras.el * lisp/obsolete/tpu-edt.el: Remove autoloads of obsolete library tpu-extras.el. * lisp/obsolete/tpu-extras.el: Don't set generated-autoload-file to tpu-edt.el. diff --git a/lisp/obsolete/tpu-edt.el b/lisp/obsolete/tpu-edt.el index 8c4ec8f7e0..1e3fc0d569 100644 --- a/lisp/obsolete/tpu-edt.el +++ b/lisp/obsolete/tpu-edt.el @@ -2412,35 +2412,6 @@ If FILE is nil, try to load a default file. The default file name is (error nil)) (setq tpu-edt-mode nil)) - -;;;### (autoloads nil "tpu-extras" "tpu-extras.el" "cbbb448cff48fab904ac19805aa6f36a") -;;; Generated autoloads from tpu-extras.el - -(autoload 'tpu-cursor-free-mode "tpu-extras" "\ -Minor mode to allow the cursor to move freely about the screen. -With a prefix argument ARG, enable the mode if ARG is positive, -and disable it otherwise. If called from Lisp, enable the mode -if ARG is omitted or nil. - -\(fn &optional ARG)" t nil) - -(autoload 'tpu-set-scroll-margins "tpu-extras" "\ -Set scroll margins. - -\(fn TOP BOTTOM)" t nil) - -(autoload 'tpu-set-cursor-free "tpu-extras" "\ -Allow the cursor to move freely about the screen. - -\(fn)" t nil) - -(autoload 'tpu-set-cursor-bound "tpu-extras" "\ -Constrain the cursor to the flow of the text. - -\(fn)" t nil) - -;;;*** - (provide 'tpu-edt) ;;; tpu-edt.el ends here diff --git a/lisp/obsolete/tpu-extras.el b/lisp/obsolete/tpu-extras.el index 76338cdd24..23f6020fd3 100644 --- a/lisp/obsolete/tpu-extras.el +++ b/lisp/obsolete/tpu-extras.el @@ -422,8 +422,4 @@ A repeat count means scroll that many sections." (provide 'tpu-extras) -;; Local Variables: -;; generated-autoload-file: "tpu-edt.el" -;; End: - ;;; tpu-extras.el ends here commit 4b5414abbc01a3b4ae441d28e96b0f3f46a487fb Author: Stefan Kangas Date: Sun Aug 7 19:23:36 2022 +0200 Clean up some local variable sections * lisp/filesets.el: * lisp/mh-e/mh-*.el: * lisp/progmodes/python.el (python): Don't set options that are already set in .dir-locals.el. * lisp/textmodes/ispell.el: Remove redundant local variables. * lisp/gnus/nnmaildir.el: Remove local variables that conflicts with Emacs defaults. diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el index 091b8aa92d..c54b12fcb0 100644 --- a/lisp/erc/erc-networks.el +++ b/lisp/erc/erc-networks.el @@ -1547,6 +1547,3 @@ VALUE is the options value.") (provide 'erc-networks) ;;; erc-networks.el ends here -;; -;; Local Variables: -;; End: diff --git a/lisp/filesets.el b/lisp/filesets.el index a8d837e7e1..e1d1379551 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -2499,8 +2499,4 @@ Set up hooks, load the cache file -- if existing -- and build the menu." (provide 'filesets) -;; Local Variables: -;; sentence-end-double-space:t -;; End: - ;;; filesets.el ends here diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 98e074233d..951978fc5b 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -1785,9 +1785,4 @@ This variable is set by `nnmaildir-request-article'.") (provide 'nnmaildir) -;; Local Variables: -;; indent-tabs-mode: t -;; fill-column: 77 -;; End: - ;;; nnmaildir.el ends here diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el index 31630b43ca..faf27cd066 100644 --- a/lisp/mh-e/mh-acros.el +++ b/lisp/mh-e/mh-acros.el @@ -289,7 +289,6 @@ form (FUNCNAME ARGLIST BODY...), similar to defun." ;; Local Variables: ;; no-byte-compile: t -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el index f39caac893..3d034554f2 100644 --- a/lisp/mh-e/mh-alias.el +++ b/lisp/mh-e/mh-alias.el @@ -662,7 +662,6 @@ show buffer, the message in the show buffer doesn't match." (provide 'mh-alias) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-buffers.el b/lisp/mh-e/mh-buffers.el index f21b57663b..4b15b77413 100644 --- a/lisp/mh-e/mh-buffers.el +++ b/lisp/mh-e/mh-buffers.el @@ -75,7 +75,6 @@ The function returns the size of the final size of the log buffer." (provide 'mh-buffers) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el index a9f6274e9d..678bffd168 100644 --- a/lisp/mh-e/mh-comp.el +++ b/lisp/mh-e/mh-comp.el @@ -1272,7 +1272,6 @@ discarded." (provide 'mh-comp) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el index 3762445271..93af525e39 100644 --- a/lisp/mh-e/mh-e.el +++ b/lisp/mh-e/mh-e.el @@ -3715,7 +3715,6 @@ The background and foreground are used in the image." (provide 'mh-e) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index 09df0465ed..7f200534ef 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el @@ -2012,7 +2012,6 @@ If MSG is nil then act on the message at point" (provide 'mh-folder) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-funcs.el b/lisp/mh-e/mh-funcs.el index f011ea47f8..ab89ef2a3d 100644 --- a/lisp/mh-e/mh-funcs.el +++ b/lisp/mh-e/mh-funcs.el @@ -366,7 +366,6 @@ Arguments are IGNORED (for `revert-buffer')." (provide 'mh-funcs) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-gnus.el b/lisp/mh-e/mh-gnus.el index c341b09683..685553164c 100644 --- a/lisp/mh-e/mh-gnus.el +++ b/lisp/mh-e/mh-gnus.el @@ -109,7 +109,6 @@ PROMPT overrides the default one used to ask user for a file name." ;; Local Variables: ;; no-update-autoloads: t -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-identity.el b/lisp/mh-e/mh-identity.el index 43eaeb7aa0..b7fa35a92f 100644 --- a/lisp/mh-e/mh-identity.el +++ b/lisp/mh-e/mh-identity.el @@ -316,7 +316,6 @@ the header." (provide 'mh-identity) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-inc.el b/lisp/mh-e/mh-inc.el index 2c29ec3223..cc6ebfef42 100644 --- a/lisp/mh-e/mh-inc.el +++ b/lisp/mh-e/mh-inc.el @@ -78,7 +78,6 @@ (provide 'mh-inc) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-junk.el b/lisp/mh-e/mh-junk.el index 1f773b878a..be1b7642eb 100644 --- a/lisp/mh-e/mh-junk.el +++ b/lisp/mh-e/mh-junk.el @@ -540,7 +540,6 @@ See `mh-spamprobe-blocklist' for more information." (provide 'mh-junk) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index 78355101c1..723e5bb36c 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el @@ -936,7 +936,6 @@ Otherwise, simply insert MH-INS-STRING before each line." (provide 'mh-letter) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-limit.el b/lisp/mh-e/mh-limit.el index 3e731e22a1..da3e5b4f35 100644 --- a/lisp/mh-e/mh-limit.el +++ b/lisp/mh-e/mh-limit.el @@ -325,7 +325,6 @@ The MH command pick is used to do the match." (provide 'mh-limit) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el index 865f817da5..2f1b835de0 100644 --- a/lisp/mh-e/mh-mime.el +++ b/lisp/mh-e/mh-mime.el @@ -1788,7 +1788,6 @@ initialized. Always use the command `mh-have-file-command'.") (provide 'mh-mime) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-print.el b/lisp/mh-e/mh-print.el index 2eec8d9160..78906b68ad 100644 --- a/lisp/mh-e/mh-print.el +++ b/lisp/mh-e/mh-print.el @@ -242,7 +242,6 @@ Consider using \\[mh-ps-print-msg] instead." (provide 'mh-print) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-scan.el b/lisp/mh-e/mh-scan.el index 06381a2e0e..4b4c594286 100644 --- a/lisp/mh-e/mh-scan.el +++ b/lisp/mh-e/mh-scan.el @@ -526,7 +526,6 @@ comes after that." (provide 'mh-scan) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el index c5519eba0a..8a8a8c3358 100644 --- a/lisp/mh-e/mh-search.el +++ b/lisp/mh-e/mh-search.el @@ -1932,7 +1932,6 @@ folder buffer." (provide 'mh-search) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-seq.el b/lisp/mh-e/mh-seq.el index a95c7c03d1..8339273fc9 100644 --- a/lisp/mh-e/mh-seq.el +++ b/lisp/mh-e/mh-seq.el @@ -996,7 +996,6 @@ removed." (provide 'mh-seq) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el index cc76b8d7e6..1731d75738 100644 --- a/lisp/mh-e/mh-show.el +++ b/lisp/mh-e/mh-show.el @@ -894,7 +894,6 @@ See also `mh-folder-mode'. (provide 'mh-show) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-speed.el b/lisp/mh-e/mh-speed.el index a7e9c9bd67..3babea7612 100644 --- a/lisp/mh-e/mh-speed.el +++ b/lisp/mh-e/mh-speed.el @@ -568,7 +568,6 @@ The function invalidates the latest ancestor that is present." (provide 'mh-speed) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-thread.el b/lisp/mh-e/mh-thread.el index 139e9b74cb..2358ba4bc6 100644 --- a/lisp/mh-e/mh-thread.el +++ b/lisp/mh-e/mh-thread.el @@ -865,7 +865,6 @@ This function can only be used the folder is threaded." (provide 'mh-thread) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el index 17df075cfa..933b3b633a 100644 --- a/lisp/mh-e/mh-tool-bar.el +++ b/lisp/mh-e/mh-tool-bar.el @@ -376,7 +376,6 @@ This button runs `mh-widen'")) (provide 'mh-tool-bar) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index ed32716ffa..bf2d3c71db 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -1010,7 +1010,6 @@ If the current line is too long truncate a part of it as well." (provide 'mh-utils) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el index b144c58d69..d6ecd83655 100644 --- a/lisp/mh-e/mh-xface.el +++ b/lisp/mh-e/mh-xface.el @@ -414,7 +414,6 @@ The argument CHANGE is ignored." (provide 'mh-xface) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/obsolete/mh-compat.el b/lisp/obsolete/mh-compat.el index 8025105083..2c9d1b73e2 100644 --- a/lisp/obsolete/mh-compat.el +++ b/lisp/obsolete/mh-compat.el @@ -130,7 +130,6 @@ This is taken from RFC 2396.") (provide 'mh-compat) ;; Local Variables: -;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 88b19c88cd..5edd6e7df5 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5852,11 +5852,6 @@ REPORT-FN is Flymake's callback function." (add-hook 'flymake-diagnostic-functions #'python-flymake nil t)) - (provide 'python) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: - ;;; python.el ends here diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 8c8522a6e5..f85d0aba9c 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -4235,17 +4235,10 @@ Both should not be used to define a buffer-local dictionary." ;;; LOCAL VARIABLES AND BUFFER-LOCAL VALUE EXAMPLES. -;; Local Variable options: -;; mode: name(-mode) -;; eval: expression -;; local-variable: value - ;; The following sets the buffer local dictionary to `american' English ;; and spell checks only comments. ;; Local Variables: -;; mode: emacs-lisp -;; comment-column: 40 ;; ispell-check-comments: exclusive ;; ispell-local-dictionary: "american" ;; End: