diff options
251 files changed, 3563 insertions, 3009 deletions
diff --git a/CONTRIBUTE b/CONTRIBUTE index bbf52628620..2d70c4916ca 100644 --- a/CONTRIBUTE +++ b/CONTRIBUTE @@ -72,9 +72,12 @@ the copyright for your contributions. (To see how many lines were non-trivially changed, count only added and modified lines in the patched code. Consider an added or changed line non-trivial if it includes at least one identifier, string, or substantial comment.) -Ask on emacs-devel@gnu.org, and we will send you the necessary form -together with the instructions to fill and email it, in order to start -this legal paperwork. +In most cases, to start the assignment process you should download +https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future +and return the completed information to the address at the top. +(There are other assignment options, but they are much less commonly used.) +If you have questions about the assignment process, you can ask the +address listed on the form, and/or emacs-devel@gnu.org. ** Issue tracker (a.k.a. "bug tracker") diff --git a/ChangeLog.3 b/ChangeLog.3 index 460a1d2ffa6..ed7704e47ff 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 @@ -1,3 +1,379 @@ +2021-03-25 Eli Zaretskii <eliz@gnu.org> + + * Version 27.2 released. + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + * etc/HISTORY: Update for Emacs 27.2. + + * README: + * configure.ac: + * nt/README.W32: + * msdos/sed2v2.inp: Set version to 27.2 + +2021-03-18 Lars Ingebrigtsen <larsi@gnus.org> + + Document that `buffer-string' retains text properties + + * doc/lispref/text.texi (Buffer Contents): Mention text properties + in the `buffer-string' documentation. + * src/editfns.c (Fbuffer_string): Mention text properties in the + doc string (bug#47220). + + (cherry picked from commit 60af754170f22f5d25510af069ed0ebfec95f992) + +2021-03-18 Fabrice Bauzac <noon@mykolab.com> + + Remove duplicate @table item from ELisp manual + + * doc/lispref/objects.texi (Special Read Syntax): Remove duplicate + item "#@N" from the table of Special Read Syntax. (Bug#47200) + +2021-03-18 Daniel Martín <mardani29@yahoo.es> + + Fix reference to 'diff-font-lock-syntax' in diff-mode documentation + + * doc/emacs/files.texi (Diff Mode): Add the omitted name of the + variable. (Bug#47129) + +2021-03-18 Alan Third <alan@idiocy.org> + + Fix buffer overflow in xbm_scan (bug#47094) + + * src/image.c (xbm_scan): Ensure reading a string doesn't overflow the + buffer. + + (cherry picked from commit ebc3b25409dd614c1814a0643960452683e37aa3) + +2021-03-18 Matt Armstrong <matt@rfc20.org> + + Fix typos and omissions for (elisp)Button Buffer Commands + + * doc/lispref/display.texi (Button Buffer Commands): Minor + typo and omission fixes `backward-button' and + `forward-button'. (Bug#47051) + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Teach Rmail about NBSP in "Re:" + + * lisp/mail/rmail.el (rmail-simplified-subject) + (rmail-reply-regexp): Allow NBSP in "RE:" prefixes. + +2021-03-18 Stefan Monnier <monnier@iro.umontreal.ca> + + Revert "* lisp/mouse.el: Fix mouse-1-clock-follows-mouse = double" + + This reverts commit 02a5cfce471613f671722b35536d2a78f17b0429. + That commit breaks because of a missing patch to `parse_modifiers_uncached` + in `src/keyboard.c`. IOW, too risky for `emacs-27`. + + Don't merge to `master`. + +2021-03-18 Stefan Monnier <monnier@iro.umontreal.ca> + + * lisp/mouse.el: Fix mouse-1-clock-follows-mouse = double + + This functionality was broken by commit 3d5e31eceb9dc1fb62b2b2, + the problem being that we end up considering as distinct the events + `down-double-mouse-1` and `double-down-mouse-1`. + + Reported by Eyal Soha <eyalsoha@gmail.com> + + (mouse--click-1-maybe-follows-link): Make sure the last element of + the list passed to `event-convert-list` is indeed a "basic" event. + +2021-03-18 Stefan Monnier <monnier@iro.umontreal.ca> + + * lisp/emacs-lisp/gv.el (edebug-after): Don't run the getter in the setter + + This fixes bug#46573 which was introduced by commit + d79cf638f278e50c22feb53d6ba556f5ce9d7853. + The new code is a middle ground, which makes sure the instrumentation + point is used (so the coverage checker won't have ghost unreachable + instrumentation points) yet without artificially running the getter + when we only need to run the setter. + +2021-03-18 Masahiro Nakamura <tsuucat@icloud.com> + + * doc/misc/tramp.texi (Remote shell setup): Fix reference. (Do not merge) + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Fix initialization of 'while-no-input-ignore-events' + + * src/keyboard.c (syms_of_keyboard_for_pdumper): Don't reset + 'while-no-input-ignore-events' after loading the dump file. + (Bug#46940) + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Update documentation of reading passwords + + * doc/emacs/mini.texi (Passwords): Update to match the modified + implementation. (Bug#46902) Add indexing. + +2021-03-18 Lars Ingebrigtsen <larsi@gnus.org> + + Improve the 'dired-do-kill-lines' doc string + + * lisp/dired-aux.el (dired-do-kill-lines): Document the FMT + parameter (bug#46867). + + (cherry picked from commit b9cb3b904008a80c69ab433f4851377967b100db) + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Avoid crashes in Mew due to corrupted tool-bar label + + * src/gtkutil.c (update_frame_tool_bar): Don't keep around a + 'char *' pointer to a Lisp string's contents when calling Lisp, + because that could relocate string data; keep the Lisp string + itself instead. This avoids crashes in Mew. (Bug#46791) + +2021-03-18 Stefan Kangas <stefan@marxist.se> + + * lisp/tooltip.el (tooltip): Doc fix for GTK. + +2021-03-18 Stefan Kangas <stefan@marxist.se> + + * lisp/help.el (help-for-help-internal): Doc fix; use imperative. + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + More accurate documentation of the "r" interactive spec + + * doc/lispref/commands.texi (Interactive Codes): Describe the + effect of 'mark-even-if-inactive'. + +2021-03-18 Stefan Kangas <stefan@marxist.se> + + Mention the GNU Kind Communications Guidelines in the FAQ + + * doc/misc/efaq.texi (Guidelines for newsgroup postings): Mention + the GNU Kind Communications Guidelines. + +2021-03-18 Ryan Prior <rprior@protonmail.com> (tiny change) + + Allow newlines in password prompts again in comint + + * lisp/comint.el (comint-password-prompt-regexp): Match all + whitespace (including newline) at the end of the passphrase, not + just space and \t (bug#46609). + (comint-watch-for-password-prompt): Remove trailing newlines from + the prompt (bug#46609). + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Avoid point movement when visiting image files + + * lisp/image-mode.el (image-toggle-display-image): Preserve point + around the call to exif-parse-buffer, to prevent it from moving + into the image data. (Bug#46552) + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Avoid assertion violation in callproc.c + + * src/callproc.c (call_process): Avoid assertion violation when + DESTINATION is a cons cell '(:file . "FOO")'. (Bug#46426) + +2021-03-18 Lars Ingebrigtsen <larsi@gnus.org> + + Clarify "changes" in CONTRIBUTE + + * CONTRIBUTE: Clarify that "changes" doesn't include removing code + (bug#44834). + + (cherry picked from commit 33c9556c9db9b8c62dcd80dd3cc665e669ea66d4) + +2021-03-18 Lars Ingebrigtsen <larsi@gnus.org> + + Clarify when activate-mark-hook is run + + * doc/lispref/markers.texi (The Mark): + * lisp/simple.el (activate-mark-hook): Clarify when the hook is + run (bug#23444). + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Fix language-environment and font selection on MS-Windows + + These changes improve setting the language-environment and font + selection when MS-Windows returns useless "ZZZ" as the "language + name", which then disrupts all the setup of the locale-dependent + stuff, and in particular font selection. + * lisp/w32-fns.el (w32-charset-info-alist): Add an element for + "iso8859-5", in case LANG is set to something unusable, like + "ZZZ". This allows fonts capable of displaying Cyrillic + characters to be used even when language preferences are screwed. + + * src/w32.c (init_environment): If GetLocaleInfo returns "ZZZ" as + the "language name" for LOCALE_USER_DEFAULT, try again with locale + ID based on what GetUserDefaultUILanguage returns. (Bug#39286) + +2021-03-18 Petteri Hintsanen <petterih@iki.fi> + + Fix example in Sequence Functions node in the manual + + * doc/lispref/sequences.texi (Sequence Functions): Fix the result + from the example. + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Improve doc string of 'text-scale-adjust' + + * lisp/face-remap.el (text-scale-adjust): Clarify that "default + face height" refers to the 'default' face. (Bug#25168) + +2021-03-18 Lars Ingebrigtsen <larsi@gnus.org> + + Clarify the indent-rigidly doc string + + * lisp/indent.el (indent-rigidly): Clarify exiting the transient + mode (bug#46296). + +2021-03-18 Martin Rudalics <rudalics@gmx.at> + + Fix two small tab bar issues + + * lisp/cus-start.el (frame-inhibit-implied-resize): Update version tag. + * lisp/frame.el (frame-inner-height): Do not count in tab bar. + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Fix last change in syntax.texi + + * doc/lispref/syntax.texi (Syntax Properties): Fix wording in last + change. (Bug#46274) + +2021-03-18 Lars Ingebrigtsen <larsi@gnus.org> + + Correct the lispref manual about flushing ppss info + + * doc/lispref/syntax.texi (Syntax Properties): Correct the + information about flushing the state by copying the text from the + doc string (bug#46274). + + (cherry picked from commit ff701ce2b261acce1dfcd1fe137268d87d5eab35) + +2021-03-18 Lars Ingebrigtsen <larsi@gnus.org> + + Clarify how transient indentation modes are exited in the manual + + * doc/emacs/indent.texi (Indentation Commands): Clarify that the + other keys don't just exit the transient mode, but are also + handled as normally (bug#46296). + +2021-03-18 Dmitry Gutov <dgutov@yandex.ru> + + Fix the previous change + + * lisp/progmodes/project.el (project-find-regexp): + Fix the previous change (project-root is not defined in this version). + (project-or-external-find-regexp): Same. + +2021-03-18 Dmitry Gutov <dgutov@yandex.ru> + + Bind default-directory to the project root + + * lisp/progmodes/project.el (project-find-regexp): + Bind default-directory to the project root, to save this value + in the resulting buffer (esp. if the project selector was used, + (https://lists.gnu.org/archive/html/emacs-devel/2021-02/msg00140.html). + (project-or-external-find-regexp): Same. + + (cherry picked from commit c07ebfcbe084e8219d8c2588f23f77ba4ef39087) + +2021-03-18 Dmitry Gutov <dgutov@yandex.ru> + + Make sure default-directory relates to the originating buffer + + * lisp/progmodes/xref.el (xref--show-xref-buffer): + Pick up default-directory value from the caller + (https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00551.html). + (xref-show-definitions-buffer-at-bottom): Same. + + (cherry picked from commit 6e73e07a6f5cbdd1c5ae6e0f3fbd0f8f56813f1a) + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Initialize signal descriptions after pdumping + + * src/sysdep.c (init_signals) [!HAVE_DECL_SYS_SIGLIST]: Reinit + sys_siglist also after pdumping. (Bug#46284) + +2021-03-18 Lars Ingebrigtsen <larsi@gnus.org> + + Clarify the "Sentinels" node in the lispref manual + + * doc/lispref/processes.texi (Sentinels): Mention "run" and that + the strings can be anything (bug#30461). + + (cherry picked from commit 859a4cb6b22f75a3456e29d08fcfe9b8940fbe8b) + +2021-03-18 Alexandre Duret-Lutz <adl@lrde.epita.fr> (tiny change) + + Fix problem with non-ASCII characters in nnmaildir + + * lisp/gnus/nnmaildir.el (nnmaildir-request-article): Enable + multipart 8bit-content-transfer-encoded files to be displayed + correctly by reading as `raw-text' instead of having Emacs + (incorrectly) decode the files (bug#44307). + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + * lisp/window.el (recenter-top-bottom): Clarify doc string. + +2021-03-18 Thomas Fitzsimmons <fitzsim@fitzsim.org> + + url-http.el: Special-case NTLM authentication + + * lisp/url/url-http.el (url-http-handle-authentication): Do not + signal an error on NTLM authorization strings. (Bug#43566) + +2021-03-18 Juri Linkov <juri@linkov.net> + + * lisp/isearch.el (isearch-lazy-highlight): Fix defcustom type (bug#46208) + +2021-03-18 Stefan Kangas <stefan@marxist.se> + + Sync latest SKK-JISYO.L + + * leim/SKK-DIC/SKK-JISYO.L: Sync to current upstream version. + +2021-03-18 Alan Third <alan@idiocy.org> + + Fix build failure on macOS 10.7 (bug#46036) + + * src/nsfns.m (ns_set_represented_filename): Define the NSNumber in a + more compatible manner. + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Improve documentation of auto-resize-tool/tab-bars + + * src/xdisp.c (syms_of_xdisp) <auto-resize-tool-bars> + <auto-resize-tab-bars>: Doc fix. (Bug#46178) + +2021-03-18 Dmitry Gutov <dgutov@yandex.ru> + + (xref-revert-buffer): Also 'erase-buffer' when handling a user-error + + * lisp/progmodes/xref.el (xref-revert-buffer): + Also 'erase-buffer' when handling a user-error (bug#46042). + + (cherry picked from commit e86b30d6fd04070b86560774ec82392dbe24ca1e) + +2021-03-18 Eli Zaretskii <eliz@gnu.org> + + Update files for 27.1.91 pretest + + * ChangeLog.3: + * etc/AUTHORS + * lisp/ldefs-boot.el: Update. + +2021-03-18 Eli Zaretskii <eliz@gnu.org> 2021-02-03 Eli Zaretskii <eliz@gnu.org> Bump Emacs version to 27.1.91 @@ -144446,6 +144822,7 @@ This file records repository revisions from commit 9d56a21e6a696ad19ac65c4b405aeca44785884a (exclusive) to +2021-03-18bd67a4f40a733cb139ace3af4616bc2702282 (inclusive). 2021-02-03d9244f7cbef9f91e697ad5fc0ce49ec97 (inclusive). commit 1ca4da054be7eb340c511d817f3ec89c8b819db7 (inclusive). See ChangeLog.2 for earlier changes. diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt index 5125086e881..9caf22d7188 100644 --- a/admin/make-tarball.txt +++ b/admin/make-tarball.txt @@ -33,6 +33,11 @@ General steps (for each step, check for possible errors): or some form of "git clean -x". It's probably simpler and safer to make a new working directory exclusively for the release branch. + If the working directory has subdirectories created when making + previous releases or pretests, remove those subdirectories, as the + command which updates the ChangeLog file might attempt to recurse + there and scan any ChangeLog.* files there. + Make sure the tree is built, or at least configured. That's because some of the commands below run Make, so they need Makefiles to be present. @@ -68,20 +73,23 @@ General steps (for each step, check for possible errors): 3. Set the version number (M-x load-file RET admin/admin.el RET, then M-x set-version RET). For a pretest, start at version .90. After - .99, use .990 (so that it sorts). + .99, use .990 (so that it sorts). Commit the resulting changes + as one, with nothing else included, and using a log message + of the format "Bump Emacs version to ...", so that the commit can + be skipped when merging branches (see admin/gitmerge.el). The final pretest should be a release candidate. Before a release candidate is made, the tasks listed in admin/release-process must be completed. - Set the version number to that of the actual release. Pick a date - about a week from now when you intend to make the release. Use M-x - add-release-logs to add entries to etc/HISTORY and the ChangeLog - file. It's best not to commit these files until the release is - actually made. Merge the entries from (unversioned) ChangeLog - into the top of the current versioned ChangeLog.N and commit that - along with etc/HISTORY. Then you can tag that commit as the - release. + Set the version number to that of the actual release (commit in + one, as described above). Pick a date about a week from now when + you intend to make the release. Use M-x add-release-logs to add + entries to etc/HISTORY and the ChangeLog file. It's best not to + commit these files until the release is actually made. Merge the + entries from (unversioned) ChangeLog into the top of the current + versioned ChangeLog.N and commit that along with etc/HISTORY. + Then you can tag that commit as the release. Name the tar file as emacs-XX.Y-rc1.tar. If all goes well in the following week, you can simply rename the file and use it for the diff --git a/configure.ac b/configure.ac index e0f763646cd..4284c997141 100644 --- a/configure.ac +++ b/configure.ac @@ -4008,6 +4008,11 @@ case $with_json,$HAVE_JSON in WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-json=ifavailable";; esac if test "X${MISSING}" != X; then + # If we have a missing library, and we don't have pkg-config installed, + # the missing pkg-config may be the reason. Give the user a hint. + if test "X${PKG_CONFIG}" = X; then + AC_MSG_WARN([Unable to locate a usable pkg-config]) + fi AC_MSG_ERROR([The following required libraries were not found: $MISSING Maybe some development libraries/packages are missing? diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 6b3bc430d97..912980b688c 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1670,8 +1670,9 @@ modify the original (``old'') source files rather than the patched (``new'') source files. @vindex diff-font-lock-syntax - If non-@code{nil}, fragments of source in hunks are highlighted -according to the appropriate major mode. + If @code{diff-font-lock-syntax} is non-@code{nil}, fragments of +source in hunks are highlighted according to the appropriate major +mode. @node Copying and Naming @section Copying, Naming and Renaming Files diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index f81e64bdf9b..9c1b9757593 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi @@ -800,6 +800,7 @@ can re-execute a command by calling @code{eval} with the @node Passwords @section Entering passwords +@cindex entering passwords Sometimes, you may need to enter a password into Emacs. For instance, when you tell Emacs to visit a file on another machine via a network @@ -810,7 +811,7 @@ access to the machine (@pxref{Remote Files}). displays a prompt in the echo area (such as @samp{Password: }); after you type the required password, press @key{RET} to submit it. To prevent others from seeing your password, every character you type is -displayed as a dot (@samp{.}) instead of its usual form. +displayed as an asterisk (@samp{*}) instead of its usual form. Most of the features and commands associated with the minibuffer @emph{cannot} be used when entering a password. There is no history diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 8e4b0ebfe96..de98d2206e2 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi @@ -1041,7 +1041,8 @@ functions written in Lisp, it cannot profile Emacs primitives. @cindex @file{benchmark.el} @cindex benchmarking You can measure the time it takes to evaluate individual Emacs Lisp -forms using the @file{benchmark} library. See the macros +forms using the @file{benchmark} library. See the function +@code{benchmark-call} as well as the macros @code{benchmark-run}, @code{benchmark-run-compiled} and @code{benchmark-progn} in @file{benchmark.el}. You can also use the @code{benchmark} command for timing forms interactively. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index f003d524272..2e1b4a6b669 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -7056,11 +7056,11 @@ end of the buffer continues from the other end. If @var{display-message} is non-@code{nil}, the button's help-echo string is displayed. Any button with a non-@code{nil} @code{skip} property is skipped over. Returns the button found, and signals an error if no -buttons can be found. If @var{no-error} in non-@code{nil}, return nil +buttons can be found. If @var{no-error} is non-@code{nil}, return nil instead of signaling the error. @end deffn -@deffn Command backward-button n &optional wrap display-message +@deffn Command backward-button n &optional wrap display-message no-error Move to the @var{n}th previous button, or @var{n}th next button if @var{n} is negative. If @var{n} is zero, move to the start of any button at point. If @var{wrap} is non-@code{nil}, moving past either @@ -7068,7 +7068,7 @@ end of the buffer continues from the other end. If @var{display-message} is non-@code{nil}, the button's help-echo string is displayed. Any button with a non-@code{nil} @code{skip} property is skipped over. Returns the button found, and signals an error if no -buttons can be found. If @var{no-error} in non-@code{nil}, return nil +buttons can be found. If @var{no-error} is non-@code{nil}, return nil instead of signaling the error. @end deffn diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index f4316b753d8..cd2ff8f3b31 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -1120,9 +1120,9 @@ The optional fourth argument @var{pixelwise} non-@code{nil} means that refuse to truly honor the request if it does not increase/decrease the frame height to a multiple of its character height. -When used interactively, this command will set the height of the -currently selected frame to the number of lines specified by the -numeric prefix. +When used interactively, this command will ask the user for the number +of lines to set the height of the currently selected frame. You can +also provide this value with a numeric prefix. @end defun @defun set-frame-width frame width &optional pretend pixelwise @@ -1136,9 +1136,9 @@ The optional fourth argument @var{pixelwise} non-@code{nil} means that refuse to fully honor the request if it does not increase/decrease the frame width to a multiple of its character width. -When used interactively, this command will set the width of the -currently selected frame to the number of columns specified by the -numeric prefix. +When used interactively, this command will ask the user for the number +of columns to set the width of the currently selected frame. You can +also provide this value with a numeric prefix. @end defun None of these three functions will make a frame smaller than needed to diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index e1299b52d41..6cf4dd21c19 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -3247,8 +3247,7 @@ set by means of @var{other-vars} in @code{font-lock-defaults} @defvar font-lock-mark-block-function If this variable is non-@code{nil}, it should be a function that is called with no arguments, to choose an enclosing range of text for -refontification for the command @kbd{M-o M-o} -(@code{font-lock-fontify-block}). +refontification for the command @kbd{M-x font-lock-fontify-block}. The function should report its choice by placing the region around it. A good choice is a range of text large enough to give proper results, diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 64e7d53d935..0d0caebd1f7 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -148,9 +148,6 @@ starting list count: object, so when reading back the object, they will be the same object instead of copies (@pxref{Circular Objects}). -@item #@@N -Skip the next @samp{N} characters (@pxref{Comments}). - @item #xN @samp{N} represented as a hexadecimal number (@samp{#x2a}). diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index e47e851b101..44c4b90b2fc 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -222,7 +222,9 @@ properties, just the characters themselves. @xref{Text Properties}. @defun buffer-string This function returns the contents of the entire accessible portion of -the current buffer, as a string. +the current buffer, as a string. If the text being copied has any +text properties, these are copied into the string along with the +characters they belong to. @end defun If you need to make sure the resulting string, when copied to a diff --git a/doc/misc/modus-themes.org b/doc/misc/modus-themes.org index ed464e84656..9764a3467fa 100644 --- a/doc/misc/modus-themes.org +++ b/doc/misc/modus-themes.org @@ -10,10 +10,7 @@ #+macro: export-date (eval (format-time-string "%F %R %z" (current-time))) #+macro: file @@texinfo:@file{@@$1@@texinfo:}@@ #+macro: space @@texinfo:@: @@ -# The "kbd" macro turns KBD into @kbd{KBD}. Additionally, it -# encloses case-sensitive special keys (SPC, RET...) within @key{...}. -# I got this from the Org source code. -#+macro: kbd (eval (let ((case-fold-search nil) (regexp (regexp-opt '("SPC" "RET" "LFD" "TAB" "BS" "ESC" "DELETE" "SHIFT" "Ctrl" "Meta" "Alt" "Cmd" "Super" "UP" "LEFT" "RIGHT" "DOWN") 'words))) (format "@@texinfo:@kbd{@@%s@@texinfo:}@@" (replace-regexp-in-string regexp "@@texinfo:@key{@@\\&@@texinfo:}@@" $1 t)))) +#+macro: kbd @@texinfo:@kbd{@@$1@@texinfo:}@@ #+texinfo_filename: modus-themes.info #+texinfo_dir_category: Emacs misc features diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index e5e15cdaa5d..7ae562244e2 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2653,7 +2653,7 @@ The method @option{sshfs} declares the mount arguments in the variable a list of list of strings, and can be overwritten by the connection property @t{"mount-args"}, @xref{Predefined connection information}. -Additionally. it declares also the arguments for running remote +Additionally, it declares also the arguments for running remote processes, using the @command{ssh} command. These don't need to be changed. diff --git a/etc/HISTORY b/etc/HISTORY index a6b9f57814f..1d6425e9380 100644 --- a/etc/HISTORY +++ b/etc/HISTORY @@ -222,6 +222,8 @@ GNU Emacs 26.3 (2019-08-28) emacs-26.3 GNU Emacs 27.1 (2020-08-10) emacs-27.1 +GNU Emacs 27.2 (2021-03-25) emacs-27.2 + ---------------------------------------------------------------------- This file is part of GNU Emacs. @@ -98,6 +98,10 @@ useful on systems such as FreeBSD which ships only with "etc/termcap". * Changes in Emacs 28.1 ++++ +** New command 'font-lock-update', bound to 'C-x x f'. +This command updates the syntax highlighting in this buffer. + ** The new NonGNU ELPA archive is enabled by default alongside GNU ELPA. +++ @@ -258,6 +262,10 @@ commands. The new keystrokes are 'C-x x g' ('revert-buffer'), ('clone-buffer'), 'C-x x i' ('insert-buffer') and 'C-x x t' ('toggle-truncate-lines'). +--- +** Commands 'set-frame-width' and 'set-frame-height' can now get their +input using the minibuffer. + * Editing Changes in Emacs 28.1 @@ -390,6 +398,11 @@ major mode. * Changes in Specialized Modes and Packages in Emacs 28.1 +** Benchmark +*** New function 'benchmark-call' to measure the execution time of a function. +Additionally, the number of repetitions can be expressed as a minimal duration +in seconds. + ** Macroexp --- *** New function 'macroexp-file-name' to know the name of the current file. @@ -524,11 +537,13 @@ It can be used to enable/disable the tab bar individually on each frame independently from the value of 'tab-bar-mode' and 'tab-bar-show'. --- -*** New variable 'tab-bar-format' defines a list of tab bar items. +*** New user option 'tab-bar-format' defines a list of tab bar items. When it contains 'tab-bar-format-global' (possibly appended after 'tab-bar-format-align-right'), then after enabling 'display-time-mode' (or any other mode that uses 'global-mode-string') it displays time aligned to the right on the tab bar instead of the mode line. +When 'tab-bar-format-tabs' is replaced with 'tab-bar-format-tabs-groups', +then the tab bar displays tab groups. --- *** 'Mod-9' bound to 'tab-last' now switches to the last tab. @@ -548,6 +563,8 @@ It also supports a negative argument. --- *** 'C-x t G' assigns a group name to the tab. 'tab-close-group' can close all tabs that belong to the selected group. +The user option 'tab-bar-new-tab-group' defines the default group of a +new tab. --- *** New user option 'tab-bar-tab-name-format-function'. @@ -1930,6 +1947,12 @@ highlight the current error message in the 'next-error' buffer. This user option can be also customized to keep highlighting on all visited errors, so you can have an overview what errors were already visited. +--- +*** New choice 'next-error-quit-window' for 'next-error-found-function'. +When 'next-error-found-function' is customized to 'next-error-quit-window', +then typing the numeric prefix argument 0 before the command 'next-error' +will quit the source window after visiting the next occurrence. + +++ *** New user option 'tab-first-completion'. If 'tab-always-indent' is 'complete', this new user option can be used to @@ -2250,12 +2273,17 @@ first). * Incompatible Editing Changes in Emacs 28.1 ** The 'M-o' ('facemenu-keymap') global binding has been removed. +To restore the old binding, say something like: + + (require 'facemenu) + (define-key global-map "\M-o" 'facemenu-keymap) ** The 'M-o M-s' and 'M-o M-S' global bindings have been removed. Use 'M-x center-line' and 'M-x center-paragraph' instead. -** The 'M-o M-o' global binding have been removed. -Use 'M-x font-lock-fontify-block' instead. +** The 'M-o M-o' global binding has been removed. +Use 'M-x font-lock-fontify-block' instead, or the new 'C-x x f' +command, which toggles fontification in the current buffer. ** In 'f90-mode', the backslash character ('\') no longer escapes. For about a decade, the backslash character has no longer had a @@ -2274,6 +2302,12 @@ directory instead of the default directory. * Incompatible Lisp Changes in Emacs 28.1 +** 'facemenu-color-alist' is now obsolete, and is not used. + +** 'facemenu.el' is no longer preloaded. +To use functions/variables from the package, you now have to say +'(require 'facemenu)' or similar. + ** 'pcomplete-ignore-case' is now an obsolete alias of 'completion-ignore-case'. ** 'completions-annotations' face is not used when the caller puts own face. @@ -2815,6 +2849,11 @@ semantics of RFC 8259 instead of the earlier RFC 4627. In particular, these functions now accept top-level JSON values that are neither arrays nor objects. +--- +** 'while-no-input-ignore-events' accepts more special events. +The special events 'dbus-event' and 'file-notify' are now ignored in +'while-no-input' when added to this variable. + * Changes in Emacs 28.1 on Non-Free Operating Systems diff --git a/etc/NEWS.27 b/etc/NEWS.27 index 9232a308c57..d96925705ff 100644 --- a/etc/NEWS.27 +++ b/etc/NEWS.27 @@ -15,18 +15,6 @@ in older Emacs versions. You can narrow news to a specific version by calling 'view-emacs-news' with a prefix argument or by typing 'C-u C-h C-n'. -Temporary note: -+++ indicates that all relevant manuals in doc/ have been updated. ---- means no change in the manuals is needed. -When you add a new item, use the appropriate mark if you are sure it -applies, and please also update docstrings as needed. - - -* Installation Changes in Emacs 27.2 - - -* Startup Changes in Emacs 27.2 - * Changes in Emacs 27.2 @@ -41,9 +29,6 @@ frame using the new function 'fit-mini-frame-to-buffer' which won't skip leading or trailing empty lines of the buffer. -* Editing Changes in Emacs 27.2 - - * Changes in Specialized Modes and Packages in Emacs 27.2 ** Tramp @@ -51,15 +36,6 @@ skip leading or trailing empty lines of the buffer. *** The user option 'tramp-completion-reread-directory-timeout' is now obsolete. -* New Modes and Packages in Emacs 27.2 - - -* Incompatible Lisp Changes in Emacs 27.2 - - -* Lisp Changes in Emacs 27.2 - - * Changes in Emacs 27.2 on Non-Free Operating Systems ** Emacs now ignores modifier keys when IME input is used. diff --git a/etc/themes/modus-themes.el b/etc/themes/modus-themes.el index c315d5971b1..ad2070766a8 100644 --- a/etc/themes/modus-themes.el +++ b/etc/themes/modus-themes.el @@ -4,7 +4,7 @@ ;; Author: Protesilaos Stavrou <info@protesilaos.com> ;; URL: https://gitlab.com/protesilaos/modus-themes -;; Version: 1.2.3 +;; Version: 1.2.4 ;; Package-Requires: ((emacs "26.1")) ;; Keywords: faces, theme, accessibility @@ -386,6 +386,20 @@ ;; - modus-operandi-theme.el (Light theme) ;; - modus-vivendi-theme.el (Dark theme) +;;; News: +;; +;; Users updating from older versions to >= 1.0.0, are advised to read +;; the anouncement on the emacs-devel mailing list: +;; <https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00300.html>. +;; +;; The web page of the change log is also available: +;; <https://protesilaos.com/modus-themes-changelog/>. +;; +;; An Info manual should be distributed with the Modus themes. +;; Evaluate this form to access it directly: +;; +;; (info "(modus-themes) Top") + ;;; Code: diff --git a/etc/themes/wombat-theme.el b/etc/themes/wombat-theme.el index aaa7cceaf68..d625b7f9cf7 100644 --- a/etc/themes/wombat-theme.el +++ b/etc/themes/wombat-theme.el @@ -57,6 +57,8 @@ are included.") `(font-lock-type-face ((,class (:foreground "#92a65e" :weight bold)))) `(font-lock-variable-name-face ((,class (:foreground "#cae682")))) `(font-lock-warning-face ((,class (:foreground "#ccaa8f")))) + ;; Help faces + `(help-key-binding ((,class (:background "#333333" :foreground "#f6f3e8")))) ;; Button and link faces `(link ((,class (:foreground "#8ac6f2" :underline t)))) `(link-visited ((,class (:foreground "#e5786d" :underline t)))) diff --git a/lisp/bindings.el b/lisp/bindings.el index 7111ae6612c..a502373997a 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -1432,6 +1432,7 @@ if `inhibit-field-text-motion' is non-nil." (defvar ctl-x-x-map (let ((map (make-sparse-keymap))) + (define-key map "f" #'font-lock-update) (define-key map "g" #'revert-buffer) (define-key map "r" #'rename-buffer) (define-key map "u" #'rename-uniquely) diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index 281b89e088f..29bcd6de2ce 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el @@ -700,7 +700,7 @@ ARG is positive, otherwise off." (let ((appt-active appt-timer)) (setq appt-active (if arg (> (prefix-numeric-value arg) 0) (not appt-active))) - (remove-hook 'write-file-functions #'appt-update-list 'local) + (remove-hook 'write-file-functions #'appt-update-list) (or global-mode-string (setq global-mode-string '(""))) (delq 'appt-mode-string global-mode-string) (when appt-timer @@ -708,7 +708,7 @@ ARG is positive, otherwise off." (setq appt-timer nil)) (if appt-active (progn - (add-hook 'write-file-functions #'appt-update-list nil t) + (add-hook 'write-file-functions #'appt-update-list) (setq appt-timer (run-at-time t 60 #'appt-check) global-mode-string (append global-mode-string '(appt-mode-string))) diff --git a/lisp/cedet/cedet-cscope.el b/lisp/cedet/cedet-cscope.el index 4d4a9f78d5d..6ffc2765d68 100644 --- a/lisp/cedet/cedet-cscope.el +++ b/lisp/cedet/cedet-cscope.el @@ -1,6 +1,6 @@ -;;; cedet-cscope.el --- CScope support for CEDET +;;; cedet-cscope.el --- CScope support for CEDET -*- lexical-binding: t; -*- -;;; Copyright (C) 2009-2021 Free Software Foundation, Inc. +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Package: cedet @@ -34,7 +34,7 @@ :type 'string :group 'cedet) -(defun cedet-cscope-search (searchtext texttype type scope) +(defun cedet-cscope-search (searchtext texttype type _scope) "Perform a search with CScope, return the created buffer. SEARCHTEXT is text to find. TEXTTYPE is the type of text, such as `regexp', `string', `tagname', @@ -85,7 +85,7 @@ options -cR." (with-current-buffer b (setq default-directory cd) (erase-buffer)) - (apply 'call-process cedet-cscope-command + (apply #'call-process cedet-cscope-command nil b nil flags) b)) diff --git a/lisp/cedet/cedet-files.el b/lisp/cedet/cedet-files.el index 31608159cc1..c9d557f5974 100644 --- a/lisp/cedet/cedet-files.el +++ b/lisp/cedet/cedet-files.el @@ -1,4 +1,4 @@ -;;; cedet-files.el --- Common routines dealing with file names. +;;; cedet-files.el --- Common routines dealing with file names. -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. diff --git a/lisp/cedet/cedet-global.el b/lisp/cedet/cedet-global.el index 77b44744399..227ebd54b86 100644 --- a/lisp/cedet/cedet-global.el +++ b/lisp/cedet/cedet-global.el @@ -1,4 +1,4 @@ -;;; cedet-global.el --- GNU Global support for CEDET. +;;; cedet-global.el --- GNU Global support for CEDET. -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -75,7 +75,7 @@ SCOPE is the scope of the search, such as `project' or `subdirs'." (with-current-buffer b (setq default-directory cd) (erase-buffer)) - (apply 'call-process cedet-global-command + (apply #'call-process cedet-global-command nil b nil flags) b)) @@ -88,7 +88,7 @@ SCOPE is the scope of the search, such as `project' or `subdirs'." (with-current-buffer b (setq default-directory cd) (erase-buffer)) - (apply 'call-process cedet-global-gtags-command + (apply #'call-process cedet-global-gtags-command nil b nil flags) diff --git a/lisp/cedet/cedet-idutils.el b/lisp/cedet/cedet-idutils.el index 3e3d6a5e949..a2b8cb35240 100644 --- a/lisp/cedet/cedet-idutils.el +++ b/lisp/cedet/cedet-idutils.el @@ -1,4 +1,4 @@ -;;; cedet-idutils.el --- ID Utils support for CEDET. +;;; cedet-idutils.el --- ID Utils support for CEDET. -*- lexical-binding: t; -*- ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. @@ -47,7 +47,7 @@ :type 'string :group 'cedet) -(defun cedet-idutils-search (searchtext texttype type scope) +(defun cedet-idutils-search (searchtext texttype type _scope) "Perform a search with ID Utils, return the created buffer. SEARCHTEXT is text to find. TEXTTYPE is the type of text, such as `regexp', `string', `tagname', @@ -64,7 +64,7 @@ Note: Scope is not yet supported." (let* ((resultflg (if (eq texttype 'tagcompletions) (list "--key=token") (list "--result=grep"))) - (scopeflgs nil) ; (cond ((eq scope 'project) "" ) ((eq scope 'target) "l"))) + ;; (scopeflgs (cond ((eq scope 'project) "" ) ((eq scope 'target) "l"))) (stflag (cond ((or (eq texttype 'tagname) (eq texttype 'tagregexp)) (list "-r" "-w")) @@ -77,7 +77,7 @@ Note: Scope is not yet supported." ;; t means 'symbol (t (list "-l" "-w")))) ) - (cedet-idutils-lid-call (append resultflg scopeflgs stflag + (cedet-idutils-lid-call (append resultflg nil stflag ;; scopeflgs (list searchtext)))))) (defun cedet-idutils-fnid-call (flags) @@ -89,7 +89,7 @@ Return the created buffer with program output." (with-current-buffer b (setq default-directory cd) (erase-buffer)) - (apply 'call-process cedet-idutils-file-command + (apply #'call-process cedet-idutils-file-command nil b nil flags) b)) @@ -103,7 +103,7 @@ Return the created buffer with program output." (with-current-buffer b (setq default-directory cd) (erase-buffer)) - (apply 'call-process cedet-idutils-token-command + (apply #'call-process cedet-idutils-token-command nil b nil flags) b)) @@ -117,7 +117,7 @@ Return the created buffer with program output." (with-current-buffer b (setq default-directory cd) (erase-buffer)) - (apply 'call-process cedet-idutils-make-command + (apply #'call-process cedet-idutils-make-command nil b nil flags) b)) @@ -133,7 +133,7 @@ Return a filename relative to the default directory." (if (looking-at "[^ \n]*fnid: ") (error "ID Utils not available") (split-string (buffer-string) "\n" t))))) - (setq ans (mapcar 'expand-file-name ans)) + (setq ans (mapcar #'expand-file-name ans)) (when (called-interactively-p 'interactive) (if ans (if (= (length ans) 1) diff --git a/lisp/cedet/cedet.el b/lisp/cedet/cedet.el index 5d98a1939d7..b6043f1403e 100644 --- a/lisp/cedet/cedet.el +++ b/lisp/cedet/cedet.el @@ -1,4 +1,4 @@ -;;; cedet.el --- Setup CEDET environment +;;; cedet.el --- Setup CEDET environment -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. @@ -48,25 +48,25 @@ (defvar cedet-menu-map ;(make-sparse-keymap "CEDET menu") (let ((map (make-sparse-keymap "CEDET menu"))) - (define-key map [semantic-force-refresh] 'undefined) - (define-key map [semantic-edit-menu] 'undefined) - (define-key map [navigate-menu] 'undefined) - (define-key map [semantic-options-separator] 'undefined) - (define-key map [global-semantic-highlight-func-mode] 'undefined) - (define-key map [global-semantic-stickyfunc-mode] 'undefined) - (define-key map [global-semantic-decoration-mode] 'undefined) - (define-key map [global-semantic-idle-completions-mode] 'undefined) - (define-key map [global-semantic-idle-summary-mode] 'undefined) - (define-key map [global-semantic-idle-scheduler-mode] 'undefined) - (define-key map [global-semanticdb-minor-mode] 'undefined) - (define-key map [cedet-menu-separator] 'undefined) - (define-key map [ede-find-file] 'undefined) - (define-key map [ede-speedbar] 'undefined) - (define-key map [ede] 'undefined) - (define-key map [ede-new] 'undefined) - (define-key map [ede-target-options] 'undefined) - (define-key map [ede-project-options] 'undefined) - (define-key map [ede-build-forms-menu] 'undefined) + (define-key map [semantic-force-refresh] #'undefined) + (define-key map [semantic-edit-menu] #'undefined) + (define-key map [navigate-menu] #'undefined) + (define-key map [semantic-options-separator] #'undefined) + (define-key map [global-semantic-highlight-func-mode] #'undefined) + (define-key map [global-semantic-stickyfunc-mode] #'undefined) + (define-key map [global-semantic-decoration-mode] #'undefined) + (define-key map [global-semantic-idle-completions-mode] #'undefined) + (define-key map [global-semantic-idle-summary-mode] #'undefined) + (define-key map [global-semantic-idle-scheduler-mode] #'undefined) + (define-key map [global-semanticdb-minor-mode] #'undefined) + (define-key map [cedet-menu-separator] #'undefined) + (define-key map [ede-find-file] #'undefined) + (define-key map [ede-speedbar] #'undefined) + (define-key map [ede] #'undefined) + (define-key map [ede-new] #'undefined) + (define-key map [ede-target-options] #'undefined) + (define-key map [ede-project-options] #'undefined) + (define-key map [ede-build-forms-menu] #'undefined) map) "Menu keymap for the CEDET package. This is used by `semantic-mode' and `global-ede-mode'.") diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el index f0fa91b3b17..428848be04d 100644 --- a/lisp/cedet/data-debug.el +++ b/lisp/cedet/data-debug.el @@ -1,4 +1,4 @@ -;;; data-debug.el --- Data structure debugger +;;; data-debug.el --- Data structure debugger -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -48,9 +48,9 @@ ;;; Compatibility ;; -(define-obsolete-function-alias 'data-debug-overlay-properties 'overlay-properties "28.1") -(define-obsolete-function-alias 'data-debug-overlay-p 'overlayp "28.1") -(define-obsolete-function-alias 'dd-propertize 'propertize "28.1") +(define-obsolete-function-alias 'data-debug-overlay-properties #'overlay-properties "28.1") +(define-obsolete-function-alias 'data-debug-overlay-p #'overlayp "28.1") +(define-obsolete-function-alias 'dd-propertize #'propertize "28.1") ;;; GENERIC STUFF ;; @@ -100,14 +100,14 @@ PREBUTTONTEXT is some text between prefix and the overlay button." (let ((start (point)) (end nil) (str (format "%s" overlay)) - (tip nil)) + ) ;; (tip nil) (insert prefix prebuttontext str) (setq end (point)) (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) (put-text-property start end 'ddebug overlay) (put-text-property start end 'ddebug-indent(length prefix)) (put-text-property start end 'ddebug-prefix prefix) - (put-text-property start end 'help-echo tip) + ;; (put-text-property start end 'help-echo tip) (put-text-property start end 'ddebug-function 'data-debug-insert-overlay-from-point) (insert "\n") @@ -149,14 +149,14 @@ PREBUTTONTEXT is some text between prefix and the overlay list button." (let ((start (point)) (end nil) (str (format "#<overlay list: %d entries>" (length overlaylist))) - (tip nil)) + ) ;; (tip nil) (insert prefix prebuttontext str) (setq end (point)) (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) (put-text-property start end 'ddebug overlaylist) (put-text-property start end 'ddebug-indent(length prefix)) (put-text-property start end 'ddebug-prefix prefix) - (put-text-property start end 'help-echo tip) + ;; (put-text-property start end 'help-echo tip) (put-text-property start end 'ddebug-function 'data-debug-insert-overlay-list-from-point) (insert "\n") @@ -204,14 +204,14 @@ PREBUTTONTEXT is some text between prefix and the buffer button." (let ((start (point)) (end nil) (str (format "%S" buffer)) - (tip nil)) + ) ;; (tip nil) (insert prefix prebuttontext str) (setq end (point)) (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) (put-text-property start end 'ddebug buffer) (put-text-property start end 'ddebug-indent(length prefix)) (put-text-property start end 'ddebug-prefix prefix) - (put-text-property start end 'help-echo tip) + ;; (put-text-property start end 'help-echo tip) (put-text-property start end 'ddebug-function 'data-debug-insert-buffer-from-point) (insert "\n") @@ -253,14 +253,14 @@ PREBUTTONTEXT is some text between prefix and the buffer list button." (let ((start (point)) (end nil) (str (format "#<buffer list: %d entries>" (length bufferlist))) - (tip nil)) + ) ;; (tip nil) (insert prefix prebuttontext str) (setq end (point)) (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) (put-text-property start end 'ddebug bufferlist) (put-text-property start end 'ddebug-indent(length prefix)) (put-text-property start end 'ddebug-prefix prefix) - (put-text-property start end 'help-echo tip) + ;; (put-text-property start end 'help-echo tip) (put-text-property start end 'ddebug-function 'data-debug-insert-buffer-list-from-point) (insert "\n") @@ -309,14 +309,14 @@ PREBUTTONTEXT is some text between prefix and the process button." (let ((start (point)) (end nil) (str (format "%S : %s" process (process-status process))) - (tip nil)) + ) ;; (tip nil) (insert prefix prebuttontext str) (setq end (point)) (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) (put-text-property start end 'ddebug process) (put-text-property start end 'ddebug-indent(length prefix)) (put-text-property start end 'ddebug-prefix prefix) - (put-text-property start end 'help-echo tip) + ;; (put-text-property start end 'help-echo tip) (put-text-property start end 'ddebug-function 'data-debug-insert-process-from-point) (insert "\n") @@ -363,8 +363,8 @@ PREBUTTONTEXT is some text between prefix and the stuff list button." (str (format "#<RING: %d, %d max>" (ring-length ring) (ring-size ring))) - (ringthing - (if (= (ring-length ring) 0) nil (ring-ref ring 0))) + ;; (ringthing + ;; (if (= (ring-length ring) 0) nil (ring-ref ring 0))) (tip (format "Ring max-size %d, length %d." (ring-size ring) (ring-length ring))) @@ -437,7 +437,7 @@ PREBUTTONTEXT is some text between prefix and the stuff list button." ;; Widgets have a long list of properties (defun data-debug-insert-widget-properties (widget prefix) "Insert the contents of WIDGET inserting PREFIX before each element." - (let ((type (car widget)) + (let (;; (type (car widget)) (rest (cdr widget))) (while rest (data-debug-insert-thing (car (cdr rest)) @@ -683,7 +683,7 @@ PREBUTTONTEXT is some text between prefix and the thing." ) ;;; nil thing -(defun data-debug-insert-nil (thing prefix prebuttontext) +(defun data-debug-insert-nil (_thing prefix prebuttontext) "Insert one simple THING with a face. PREFIX is the text that precedes the button. PREBUTTONTEXT is some text between prefix and the thing. @@ -856,19 +856,18 @@ If PARENT is non-nil, it is somehow related as a parent to thing." (defvar data-debug-mode-map (let ((km (make-sparse-keymap))) (suppress-keymap km) - (define-key km [mouse-2] 'data-debug-expand-or-contract-mouse) - (define-key km " " 'data-debug-expand-or-contract) - (define-key km "\C-m" 'data-debug-expand-or-contract) - (define-key km "n" 'data-debug-next) - (define-key km "p" 'data-debug-prev) - (define-key km "N" 'data-debug-next-expando) - (define-key km "P" 'data-debug-prev-expando) + (define-key km [mouse-2] #'data-debug-expand-or-contract-mouse) + (define-key km " " #'data-debug-expand-or-contract) + (define-key km "\C-m" #'data-debug-expand-or-contract) + (define-key km "n" #'data-debug-next) + (define-key km "p" #'data-debug-prev) + (define-key km "N" #'data-debug-next-expando) + (define-key km "P" #'data-debug-prev-expando) km) "Keymap used in data-debug.") (defcustom data-debug-mode-hook nil "Hook run when data-debug starts." - :group 'data-debug :type 'hook) (define-derived-mode data-debug-mode fundamental-mode "DATA-DEBUG" @@ -1032,7 +1031,7 @@ Do nothing if already contracted." nil read-expression-map t 'read-expression-history)) )) - (let ((v (eval expr))) + (let ((v (eval expr t))) (if (not v) (message "Expression %s is nil." expr) (data-debug-show-stuff v "expression")))) @@ -1049,12 +1048,12 @@ If the result is a list or vector, then use the data debugger to display it." (let (result) (if (null eval-expression-debug-on-error) - (setq result (values--store-value (eval expr))) + (setq result (values--store-value (eval expr t))) (let ((old-value (make-symbol "t")) new-value) ;; Bind debug-on-error to something unique so that we can ;; detect when evalled code changes it. (let ((debug-on-error old-value)) - (setq result (values--store-value (eval expr))) + (setq result (values--store-value (eval expr t))) (setq new-value debug-on-error)) ;; If evalled code has changed the value of debug-on-error, ;; propagate that change to the global binding. diff --git a/lisp/cedet/ede.el b/lisp/cedet/ede.el index 369a9f7e713..2ec9f5d9d67 100644 --- a/lisp/cedet/ede.el +++ b/lisp/cedet/ede.el @@ -1,4 +1,4 @@ -;;; ede.el --- Emacs Development Environment gloss +;;; ede.el --- Emacs Development Environment gloss -*- lexical-binding: t; -*- ;; Copyright (C) 1998-2005, 2007-2021 Free Software Foundation, Inc. @@ -87,7 +87,6 @@ target wants the file, the user is asked. If only one target wants the file, then it is automatically added to that target. If the value is `ask', then the user is always asked, unless there is no target willing to take the file. `never' means never perform the check." - :group 'ede :type '(choice (const always) (const multi-ask) (const ask) @@ -95,7 +94,6 @@ target willing to take the file. `never' means never perform the check." (defcustom ede-debug-program-function 'gdb "Default Emacs command used to debug a target." - :group 'ede :type 'function) ; make this be a list of options some day (defcustom ede-project-directories nil @@ -112,7 +110,6 @@ If you invoke the commands \\[ede] or \\[ede-new] on a directory that is not listed, Emacs will offer to add it to the list. Any other value disables searching for EDE project files." - :group 'ede :type '(choice (const :tag "Any directory" t) (repeat :tag "List of directories" (directory)) @@ -186,21 +183,23 @@ Argument LIST-O-O is the list of objects to choose from." ;;; Menu and Keymap +(declare-function ede-speedbar "ede/speedbar" ()) + (defvar ede-minor-mode-map (let ((map (make-sparse-keymap)) (pmap (make-sparse-keymap))) - (define-key pmap "e" 'ede-edit-file-target) - (define-key pmap "a" 'ede-add-file) - (define-key pmap "d" 'ede-remove-file) - (define-key pmap "t" 'ede-new-target) - (define-key pmap "g" 'ede-rescan-toplevel) - (define-key pmap "s" 'ede-speedbar) - (define-key pmap "f" 'ede-find-file) - (define-key pmap "C" 'ede-compile-project) - (define-key pmap "c" 'ede-compile-target) - (define-key pmap "\C-c" 'ede-compile-selected) - (define-key pmap "D" 'ede-debug-target) - (define-key pmap "R" 'ede-run-target) + (define-key pmap "e" #'ede-edit-file-target) + (define-key pmap "a" #'ede-add-file) + (define-key pmap "d" #'ede-remove-file) + (define-key pmap "t" #'ede-new-target) + (define-key pmap "g" #'ede-rescan-toplevel) + (define-key pmap "s" #'ede-speedbar) + (define-key pmap "f" #'ede-find-file) + (define-key pmap "C" #'ede-compile-project) + (define-key pmap "c" #'ede-compile-target) + (define-key pmap "\C-c" #'ede-compile-selected) + (define-key pmap "D" #'ede-debug-target) + (define-key pmap "R" #'ede-run-target) ;; bind our submap into map (define-key map "\C-c." pmap) map) @@ -476,7 +475,7 @@ To be used in hook functions." If this file is contained, or could be contained in an EDE controlled project, then this mode is activated automatically provided `global-ede-mode' is enabled." - :group 'ede + :global nil (cond ((or (eq major-mode 'dired-mode) (eq major-mode 'vc-dir-mode)) (ede-dired-minor-mode (if ede-minor-mode 1 -1))) @@ -486,6 +485,9 @@ provided `global-ede-mode' is enabled." ;; If we fail to have a project here, turn it back off. (ede-minor-mode -1))))) +(declare-function ede-directory-project-cons "ede/files" (dir &optional force)) +(declare-function ede-toplevel-project-or-nil "ede/files" (dir)) + (defun ede-initialize-state-current-buffer () "Initialize the current buffer's state for EDE. Sets buffer local variables for EDE." @@ -496,7 +498,7 @@ Sets buffer local variables for EDE." ;; Init the buffer. (let* ((ROOT nil) (proj (ede-directory-get-open-project default-directory - 'ROOT))) + (gv-ref ROOT)))) (when (not proj) ;; If there is no open project, look up the project @@ -517,7 +519,8 @@ Sets buffer local variables for EDE." (ede-directory-safe-p top))) ;; The project is safe, so load it in. - (setq proj (ede-load-project-file default-directory projdetect 'ROOT)))))) + (setq proj (ede-load-project-file default-directory projdetect + (gv-ref ROOT))))))) ;; If PROJ is now loaded in, we can initialize our buffer to it. (when proj @@ -561,30 +564,29 @@ Sets buffer local variables for EDE." This global minor mode enables `ede-minor-mode' in all buffers in an EDE controlled project." :global t - :group 'ede (if global-ede-mode ;; Turn on global-ede-mode (progn (if semantic-mode (define-key cedet-menu-map [cedet-menu-separator] '("--"))) - (add-hook 'semanticdb-project-predicate-functions 'ede-directory-project-p) - (add-hook 'semanticdb-project-root-functions 'ede-toplevel-project-or-nil) - (add-hook 'ecb-source-path-functions 'ede-ecb-project-paths) + (add-hook 'semanticdb-project-predicate-functions #'ede-directory-project-p) + (add-hook 'semanticdb-project-root-functions #'ede-toplevel-project-or-nil) + (add-hook 'ecb-source-path-functions #'ede-ecb-project-paths) ;; Append our hook to the end. This allows mode-local to finish ;; it's stuff before we start doing misc file loads, etc. - (add-hook 'find-file-hook 'ede-turn-on-hook t) - (add-hook 'dired-mode-hook 'ede-turn-on-hook) - (add-hook 'kill-emacs-hook 'ede-save-cache) + (add-hook 'find-file-hook #'ede-turn-on-hook t) + (add-hook 'dired-mode-hook #'ede-turn-on-hook) + (add-hook 'kill-emacs-hook #'ede-save-cache) (ede-load-cache) (ede-reset-all-buffers)) ;; Turn off global-ede-mode (define-key cedet-menu-map [cedet-menu-separator] nil) - (remove-hook 'semanticdb-project-predicate-functions 'ede-directory-project-p) - (remove-hook 'semanticdb-project-root-functions 'ede-toplevel-project-or-nil) - (remove-hook 'ecb-source-path-functions 'ede-ecb-project-paths) - (remove-hook 'find-file-hook 'ede-turn-on-hook) - (remove-hook 'dired-mode-hook 'ede-turn-on-hook) - (remove-hook 'kill-emacs-hook 'ede-save-cache) + (remove-hook 'semanticdb-project-predicate-functions #'ede-directory-project-p) + (remove-hook 'semanticdb-project-root-functions #'ede-toplevel-project-or-nil) + (remove-hook 'ecb-source-path-functions #'ede-ecb-project-paths) + (remove-hook 'find-file-hook #'ede-turn-on-hook) + (remove-hook 'dired-mode-hook #'ede-turn-on-hook) + (remove-hook 'kill-emacs-hook #'ede-save-cache) (ede-save-cache) (ede-reset-all-buffers))) @@ -1080,7 +1082,7 @@ Flush the dead projects from the project cache." (let ((dead nil)) (dolist (P ede-projects) (when (not (file-exists-p (oref P file))) - (add-to-list 'dead P))) + (cl-pushnew P dead :test #'equal))) (dolist (D dead) (ede-delete-project-from-global-list D)) )) @@ -1108,7 +1110,7 @@ Flush the dead projects from the project cache." "Project file independent way to read a project in from DIR. Optional DETECTIN is an autoload cons from `ede-detect-directory-for-project' which can be passed in to save time. -Optional ROOTRETURN will return the root project for DIR." +Optional ROOTRETURN reference will return the root project for DIR." ;; Don't do anything if we are in the process of ;; constructing an EDE object. ;; @@ -1147,7 +1149,8 @@ Optional ROOTRETURN will return the root project for DIR." (setq o (ede-auto-load-project autoloader toppath)))) ;; Return the found root project. - (when rootreturn (set rootreturn o)) + (when rootreturn (if (symbolp rootreturn) (set rootreturn o) + (setf (gv-deref rootreturn) o))) ;; The project has been found (in the global list) or loaded from ;; disk (via autoloader.) We can now search for the project asked @@ -1504,6 +1507,8 @@ It does not apply the value to buffers." ;;; Integration with project.el (defun project-try-ede (dir) + ;; FIXME: This passes the `ROOT' dynbound variable, but I don't know + ;; where it comes from! (let ((project-dir (locate-dominating-file dir @@ -1523,7 +1528,7 @@ It does not apply the value to buffers." (provide 'ede) ;; Include this last because it depends on ede. -(require 'ede/files) +(if t (require 'ede/files)) ;; Don't bother loading it at compile-time. ;; If this does not occur after the provide, we can get a recursive ;; load. Yuck! diff --git a/lisp/cedet/ede/auto.el b/lisp/cedet/ede/auto.el index e1417d7806c..ee9d0116af3 100644 --- a/lisp/cedet/ede/auto.el +++ b/lisp/cedet/ede/auto.el @@ -1,4 +1,4 @@ -;;; ede/auto.el --- Autoload features for EDE +;;; ede/auto.el --- Autoload features for EDE -*- lexical-binding: t; -*- ;; Copyright (C) 2010-2021 Free Software Foundation, Inc. @@ -325,13 +325,13 @@ NOTE: Do not call this - it should only be called from `ede-load-project-file'." ;; See if we can do without them. ;; @FIXME - delete from loaddefs to remove this. -(cl-defmethod ede-project-root ((this ede-project-autoload)) +(cl-defmethod ede-project-root ((_this ede-project-autoload)) "If a project knows its root, return it here. Allows for one-project-object-for-a-tree type systems." nil) ;; @FIXME - delete from loaddefs to remove this. -(cl-defmethod ede-project-root-directory ((this ede-project-autoload) &optional file) +(cl-defmethod ede-project-root-directory ((_this ede-project-autoload) &optional _file) "" nil) (provide 'ede/auto) diff --git a/lisp/cedet/ede/autoconf-edit.el b/lisp/cedet/ede/autoconf-edit.el index ca8535fdf23..d6f0a86f9ad 100644 --- a/lisp/cedet/ede/autoconf-edit.el +++ b/lisp/cedet/ede/autoconf-edit.el @@ -1,4 +1,4 @@ -;;; ede/autoconf-edit.el --- Keymap for autoconf +;;; ede/autoconf-edit.el --- Keymap for autoconf -*- lexical-binding: t; -*- ;; Copyright (C) 1998-2000, 2009-2021 Free Software Foundation, Inc. diff --git a/lisp/cedet/ede/config.el b/lisp/cedet/ede/config.el index 19686216cd5..bc1810aa84f 100644 --- a/lisp/cedet/ede/config.el +++ b/lisp/cedet/ede/config.el @@ -1,4 +1,4 @@ -;;; ede/config.el --- Configuration Handler baseclass +;;; ede/config.el --- Configuration Handler baseclass -*- lexical-binding: t; -*- ;; Copyright (C) 2014-2021 Free Software Foundation, Inc. @@ -171,7 +171,7 @@ the directory isn't on the `safe' list, ask to add it to the safe list." (oset config project proj))) config)) -(cl-defmethod ede-config-setup-configuration ((proj ede-project-with-config) config) +(cl-defmethod ede-config-setup-configuration ((_proj ede-project-with-config) _config) "Default configuration setup method." nil) @@ -187,7 +187,7 @@ the directory isn't on the `safe' list, ask to add it to the safe list." (let ((config (ede-config-get-configuration proj t))) (eieio-customize-object config))) -(cl-defmethod ede-customize ((target ede-target-with-config)) +(cl-defmethod ede-customize ((_target ede-target-with-config)) "Customize the EDE TARGET by actually configuring the config object." ;; Nothing unique for the targets, use the project. (ede-customize-project)) @@ -302,14 +302,14 @@ This class brings in method overloads for building.") "Class to mix into a project with configuration for builds. This class brings in method overloads for building.") -(cl-defmethod project-compile-project ((proj ede-project-with-config-build) &optional command) +(cl-defmethod project-compile-project ((proj ede-project-with-config-build) &optional _command) "Compile the entire current project PROJ. Argument COMMAND is the command to use when compiling." (let* ((config (ede-config-get-configuration proj t)) (comp (oref config build-command))) (compile comp))) -(cl-defmethod project-compile-target ((obj ede-target-with-config-build) &optional command) +(cl-defmethod project-compile-target ((_obj ede-target-with-config-build) &optional command) "Compile the current target OBJ. Argument COMMAND is the command to use for compiling the target." (project-compile-project (ede-current-project) command)) diff --git a/lisp/cedet/ede/cpp-root.el b/lisp/cedet/ede/cpp-root.el index 41f0c682892..652d6476f02 100644 --- a/lisp/cedet/ede/cpp-root.el +++ b/lisp/cedet/ede/cpp-root.el @@ -1,4 +1,4 @@ -;;; ede/cpp-root.el --- A simple way to wrap a C++ project with a single root +;;; ede/cpp-root.el --- A simple way to wrap a C++ project with a single root -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -275,7 +275,7 @@ Each directory needs a project file to control it.") ;; objects is deleted. (cl-defmethod initialize-instance ((this ede-cpp-root-project) - &rest fields) + &rest _fields) "Make sure the :file is fully expanded." ;; Add ourselves to the master list (cl-call-next-method) @@ -310,7 +310,7 @@ Each directory needs a project file to control it.") ;; project, simplifying authoring new single-point projects. (cl-defmethod ede-find-subproject-for-directory ((proj ede-cpp-root-project) - dir) + _dir) "Return PROJ, for handling all subdirs below DIR." proj) @@ -319,7 +319,7 @@ Each directory needs a project file to control it.") ;; Creating new targets on a per directory basis is a good way to keep ;; files organized. See ede-emacs for an example with multiple file ;; types. -(cl-defmethod ede-find-target ((proj ede-cpp-root-project) buffer) +(cl-defmethod ede-find-target ((proj ede-cpp-root-project) _buffer) "Find an EDE target in PROJ for BUFFER. If one doesn't exist, create a new one for this directory." (let* ((targets (oref proj targets)) @@ -451,7 +451,7 @@ This is for project include paths and spp source files." "Get the pre-processor map for project THIS." (ede-preprocessor-map (ede-target-parent this))) -(cl-defmethod project-compile-project ((proj ede-cpp-root-project) &optional command) +(cl-defmethod project-compile-project ((proj ede-cpp-root-project) &optional _command) "Compile the entire current project PROJ. Argument COMMAND is the command to use when compiling." ;; we need to be in the proj root dir for this to work @@ -474,7 +474,7 @@ Argument COMMAND is the command to use for compiling the target." (project-compile-project (oref obj project) command))) -(cl-defmethod project-rescan ((this ede-cpp-root-project)) +(cl-defmethod project-rescan ((_this ede-cpp-root-project)) "Don't rescan this project from the sources." (message "cpp-root has nothing to rescan.")) diff --git a/lisp/cedet/ede/custom.el b/lisp/cedet/ede/custom.el index a128f9e1241..ac4f9f66846 100644 --- a/lisp/cedet/ede/custom.el +++ b/lisp/cedet/ede/custom.el @@ -1,4 +1,4 @@ -;;; ede/custom.el --- customization of EDE projects. +;;; ede/custom.el --- customization of EDE projects. -*- lexical-binding: t; -*- ;; Copyright (C) 2010-2021 Free Software Foundation, Inc. @@ -97,13 +97,13 @@ OBJ is the target object to customize." "Create a custom-like buffer for sorting targets of current project." (interactive) (let ((proj (ede-current-project)) - (count 1) - current order) + ;; (count 1) + ) ;; current order (switch-to-buffer (get-buffer-create "*EDE sort targets*")) (erase-buffer) (setq ede-object-project proj) (widget-create 'push-button - :notify (lambda (&rest ignore) + :notify (lambda (&rest _ignore) (let ((targets (oref ede-object-project targets)) cur newtargets) (while (setq cur (pop ede-project-sort-targets-order)) @@ -115,7 +115,7 @@ OBJ is the target object to customize." " Accept ") (widget-insert " ") (widget-create 'push-button - :notify (lambda (&rest ignore) + :notify (lambda (&rest _ignore) (kill-buffer)) " Cancel ") (widget-insert "\n\n") @@ -133,45 +133,45 @@ OBJ is the target object to customize." (defun ede-project-sort-targets-list () "Sort the target list while using `ede-project-sort-targets'." (save-excursion - (let ((count 0) - (targets (oref ede-object-project targets)) + (let ((targets (oref ede-object-project targets)) (inhibit-read-only t) (inhibit-modification-hooks t)) (goto-char (point-min)) (forward-line 2) (delete-region (point) (point-max)) - (while (< count (length targets)) + (dotimes (count (length targets)) (if (> count 0) (widget-create 'push-button - :notify `(lambda (&rest ignore) - (let ((cur ede-project-sort-targets-order)) - (add-to-ordered-list - 'ede-project-sort-targets-order - (nth ,count cur) - (1- ,count)) - (add-to-ordered-list - 'ede-project-sort-targets-order - (nth (1- ,count) cur) ,count)) - (ede-project-sort-targets-list)) + :notify (lambda (&rest _ignore) + (let ((cur ede-project-sort-targets-order)) + (add-to-ordered-list + 'ede-project-sort-targets-order + (nth count cur) + (1- count)) + (add-to-ordered-list + 'ede-project-sort-targets-order + (nth (1- count) cur) count)) + (ede-project-sort-targets-list)) " Up ") (widget-insert " ")) (if (< count (1- (length targets))) (widget-create 'push-button - :notify `(lambda (&rest ignore) - (let ((cur ede-project-sort-targets-order)) - (add-to-ordered-list - 'ede-project-sort-targets-order - (nth ,count cur) (1+ ,count)) - (add-to-ordered-list - 'ede-project-sort-targets-order - (nth (1+ ,count) cur) ,count)) - (ede-project-sort-targets-list)) + :notify (lambda (&rest _ignore) + (let ((cur ede-project-sort-targets-order)) + (add-to-ordered-list + 'ede-project-sort-targets-order + (nth count cur) (1+ count)) + (add-to-ordered-list + 'ede-project-sort-targets-order + (nth (1+ count) cur) count)) + (ede-project-sort-targets-list)) " Down ") (widget-insert " ")) (widget-insert (concat " " (number-to-string (1+ count)) ".: " (oref (nth (nth count ede-project-sort-targets-order) - targets) name) "\n")) - (setq count (1+ count)))))) + targets) + name) + "\n")))))) ;;; Customization hooks ;; @@ -195,11 +195,11 @@ OBJ is the target object to customize." ;; These two methods should be implemented by subclasses of ;; project and targets in order to account for user specified ;; changes. -(cl-defmethod eieio-done-customizing ((target ede-target)) +(cl-defmethod eieio-done-customizing ((_target ede-target)) "Call this when a user finishes customizing TARGET." nil) -(cl-defmethod ede-commit-project ((proj ede-project)) +(cl-defmethod ede-commit-project ((_proj ede-project)) "Commit any change to PROJ to its file." nil ) diff --git a/lisp/cedet/ede/detect.el b/lisp/cedet/ede/detect.el index 027d008ea38..c933fc4515e 100644 --- a/lisp/cedet/ede/detect.el +++ b/lisp/cedet/ede/detect.el @@ -1,4 +1,4 @@ -;;; ede/detect.el --- EDE project detection and file associations +;;; ede/detect.el --- EDE project detection and file associations -*- lexical-binding: t; -*- ;; Copyright (C) 2014-2021 Free Software Foundation, Inc. diff --git a/lisp/cedet/ede/dired.el b/lisp/cedet/ede/dired.el index 8b9eae0b430..27735176c2a 100644 --- a/lisp/cedet/ede/dired.el +++ b/lisp/cedet/ede/dired.el @@ -35,11 +35,11 @@ (defvar ede-dired-keymap (let ((map (make-sparse-keymap))) - (define-key map ".a" 'ede-dired-add-to-target) - (define-key map ".t" 'ede-new-target) - (define-key map ".s" 'ede-speedbar) - (define-key map ".C" 'ede-compile-project) - (define-key map ".d" 'ede-make-dist) + (define-key map ".a" #'ede-dired-add-to-target) + (define-key map ".t" #'ede-new-target) + (define-key map ".s" #'ede-speedbar) + (define-key map ".C" #'ede-compile-project) + (define-key map ".d" #'ede-make-dist) (easy-menu-define ede-dired-menu map "EDE Dired Minor Mode Menu" diff --git a/lisp/cedet/ede/files.el b/lisp/cedet/ede/files.el index cf5396ad00e..6b7e1595646 100644 --- a/lisp/cedet/ede/files.el +++ b/lisp/cedet/ede/files.el @@ -1,4 +1,4 @@ -;;; ede/files.el --- Associate projects with files and directories. +;;; ede/files.el --- Associate projects with files and directories. -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -33,6 +33,7 @@ ;; till no ede-project-autoload structure matches. ;; +(require 'eieio) (require 'ede) (declare-function ede-locate-file-in-hash "ede/locate") @@ -75,13 +76,13 @@ Allows for one-project-object-for-a-tree type systems." (oref this rootproject)) (cl-defmethod ede-project-root-directory ((this ede-project-placeholder) - &optional file) + &optional _file) "If a project knows its root, return it here. Allows for one-project-object-for-a-tree type systems. Optional FILE is the file to test. It is ignored in preference of the anchor file for the project." - (let ((root (or (ede-project-root this) this))) - (file-name-directory (expand-file-name (oref this file))))) + ;; (let ((root (or (ede-project-root this) this))) + (file-name-directory (expand-file-name (oref this file)))) ;; ) ;; Why INODEs? @@ -141,7 +142,7 @@ Does not check subprojects." (defun ede-directory-get-open-project (dir &optional rootreturn) "Return an already open project that is managing DIR. -Optional ROOTRETURN specifies a symbol to set to the root project. +Optional ROOTRETURN specifies a `gv-ref' to set to the root project. If DIR is the root project, then it is the same." (let* ((inode (ede--inode-for-dir dir)) (ft (file-name-as-directory (expand-file-name dir))) @@ -153,7 +154,8 @@ If DIR is the root project, then it is the same." ;; Default answer is this project (setq ans proj) ;; Save. - (when rootreturn (set rootreturn proj)) + (when rootreturn (if (symbolp rootreturn) (set rootreturn proj) + (setf (gv-deref rootreturn) proj))) ;; Find subprojects. (when (and proj (if ede--disable-inode (not (string= ft (expand-file-name @@ -272,7 +274,7 @@ Do this whenever a new project is created, as opposed to loaded." (remhash (file-name-as-directory dir) ede-project-directory-hash) ;; Look for all subdirs of D, and remove them. (let ((match (concat "^" (regexp-quote dir)))) - (maphash (lambda (K O) + (maphash (lambda (K _O) (when (string-match match K) (remhash K ede-project-directory-hash))) ede-project-directory-hash))) @@ -363,7 +365,7 @@ If DIR is not part of a project, return nil." (t nil)))) -(defalias 'ede-toplevel-project-or-nil 'ede-toplevel-project) +(defalias 'ede-toplevel-project-or-nil #'ede-toplevel-project) ;;; DIRECTORY CONVERSION STUFF ;; @@ -469,15 +471,15 @@ is returned." ans)) -(cl-defmethod ede-expand-filename-impl ((this ede-project) filename &optional force) +(cl-defmethod ede-expand-filename-impl ((this ede-project) filename &optional _force) "Return a fully qualified file name based on project THIS. FILENAME should be just a filename which occurs in a directory controlled by this project. Optional argument FORCE forces the default filename to be provided even if it doesn't exist." (let ((loc (ede-get-locator-object this)) - (path (ede-project-root-directory this)) - (proj (oref this subproj)) + ;; (path (ede-project-root-directory this)) + ;; (proj (oref this subproj)) (found nil)) ;; find it Locally. (setq found (or (ede-expand-filename-local this filename) diff --git a/lisp/cedet/ede/generic.el b/lisp/cedet/ede/generic.el index 3d1e1c5818e..b3b59b5dc35 100644 --- a/lisp/cedet/ede/generic.el +++ b/lisp/cedet/ede/generic.el @@ -1,4 +1,4 @@ -;;; ede/generic.el --- Base Support for generic build systems +;;; ede/generic.el --- Base Support for generic build systems -*- lexical-binding: t; -*- ;; Copyright (C) 2010-2021 Free Software Foundation, Inc. @@ -93,7 +93,7 @@ ) "User Configuration object for a generic project.") -(defun ede-generic-load (dir &optional rootproj) +(defun ede-generic-load (dir &optional _rootproj) "Return a Generic Project object if there is a match. Return nil if there isn't one. Argument DIR is the directory it is created for. @@ -149,7 +149,7 @@ The class allocated value is replace by different sub classes.") :abstract t) (cl-defmethod initialize-instance ((this ede-generic-project) - &rest fields) + &rest _fields) "Make sure the targets slot is bound." (cl-call-next-method) (unless (slot-boundp this 'targets) @@ -161,7 +161,7 @@ The class allocated value is replace by different sub classes.") this) (cl-defmethod ede-find-subproject-for-directory ((proj ede-generic-project) - dir) + _dir) "Return PROJ, for handling all subdirs below DIR." proj) @@ -324,7 +324,7 @@ CLASS is the EIEIO class that is used to track this project. It should subclass ) "Generic Project for makefiles.") -(cl-defmethod ede-generic-setup-configuration ((proj ede-generic-makefile-project) config) +(cl-defmethod ede-generic-setup-configuration ((_proj ede-generic-makefile-project) config) "Setup a configuration for Make." (oset config build-command "make -k") (oset config debug-command "gdb ") @@ -337,7 +337,7 @@ CLASS is the EIEIO class that is used to track this project. It should subclass ) "Generic Project for scons.") -(cl-defmethod ede-generic-setup-configuration ((proj ede-generic-scons-project) config) +(cl-defmethod ede-generic-setup-configuration ((_proj ede-generic-scons-project) config) "Setup a configuration for SCONS." (oset config build-command "scons") (oset config debug-command "gdb ") @@ -350,7 +350,7 @@ CLASS is the EIEIO class that is used to track this project. It should subclass ) "Generic Project for cmake.") -(cl-defmethod ede-generic-setup-configuration ((proj ede-generic-cmake-project) config) +(cl-defmethod ede-generic-setup-configuration ((_proj ede-generic-cmake-project) config) "Setup a configuration for CMake." (oset config build-command "cmake") (oset config debug-command "gdb ") @@ -361,9 +361,9 @@ CLASS is the EIEIO class that is used to track this project. It should subclass () "Generic project found via Version Control files.") -(cl-defmethod ede-generic-setup-configuration ((proj ede-generic-vc-project) config) +(cl-defmethod ede-generic-setup-configuration ((_proj ede-generic-vc-project) _config) "Setup a configuration for projects identified by revision control." - ) + nil) (provide 'ede/generic) diff --git a/lisp/cedet/ede/linux.el b/lisp/cedet/ede/linux.el index 7a1c4c9e262..4b5530d6aca 100644 --- a/lisp/cedet/ede/linux.el +++ b/lisp/cedet/ede/linux.el @@ -1,4 +1,4 @@ -;;; ede/linux.el --- Special project for Linux +;;; ede/linux.el --- Special project for Linux -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -47,26 +47,22 @@ (defcustom project-linux-build-directory-default 'ask "Build directory." :version "24.4" - :group 'project-linux :type '(choice (const :tag "Same as source directory" same) (const :tag "Ask the user" ask))) (defcustom project-linux-architecture-default 'ask "Target architecture to assume when not auto-detected." :version "24.4" - :group 'project-linux :type '(choice (string :tag "Architecture name") (const :tag "Ask the user" ask))) (defcustom project-linux-compile-target-command (concat ede-make-command " -k -C %s SUBDIRS=%s") "Default command used to compile a target." - :group 'project-linux :type 'string) (defcustom project-linux-compile-project-command (concat ede-make-command " -k -C %s") "Default command used to compile a project." - :group 'project-linux :type 'string) (defun ede-linux-version (dir) diff --git a/lisp/cedet/ede/locate.el b/lisp/cedet/ede/locate.el index e6a89533cca..016092cd8bf 100644 --- a/lisp/cedet/ede/locate.el +++ b/lisp/cedet/ede/locate.el @@ -1,4 +1,4 @@ -;;; ede/locate.el --- Locate support +;;; ede/locate.el --- Locate support -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -110,7 +110,7 @@ based on `ede-locate-setup-options'." ) "Baseclass for LOCATE feature in EDE.") -(cl-defmethod initialize-instance ((loc ede-locate-base) &rest fields) +(cl-defmethod initialize-instance ((loc ede-locate-base) &rest _fields) "Make sure we have a hash table." ;; Basic setup. (cl-call-next-method) @@ -118,8 +118,8 @@ based on `ede-locate-setup-options'." (ede-locate-flush-hash loc) ) -(cl-defmethod ede-locate-ok-in-project ((loc (subclass ede-locate-base)) - root) +(cl-defmethod ede-locate-ok-in-project ((_loc (subclass ede-locate-base)) + _root) "Is it ok to use this project type under ROOT." t) @@ -149,17 +149,15 @@ that created this EDE locate object." (oset loc lastanswer ans) ans)) -(cl-defmethod ede-locate-file-in-project-impl ((loc ede-locate-base) - filesubstring - ) +(cl-defmethod ede-locate-file-in-project-impl ((_loc ede-locate-base) + _filesubstring) "Locate with LOC occurrences of FILESUBSTRING. Searches are done under the current root of the EDE project that created this EDE locate object." - nil - ) + nil) (cl-defmethod ede-locate-create/update-root-database - ((loc (subclass ede-locate-base)) root) + ((loc (subclass ede-locate-base)) _root) "Create or update the database for the current project. You cannot create projects for the baseclass." (error "Cannot create/update a database of type %S" @@ -177,8 +175,8 @@ You cannot create projects for the baseclass." Configure the Emacs `locate-program' variable to also configure the use of EDE locate.") -(cl-defmethod ede-locate-ok-in-project ((loc (subclass ede-locate-locate)) - root) +(cl-defmethod ede-locate-ok-in-project ((_loc (subclass ede-locate-locate)) + _root) "Is it ok to use this project type under ROOT." (or (featurep 'locate) (locate-library "locate")) ) @@ -198,7 +196,7 @@ that created this EDE locate object." (with-current-buffer b (setq default-directory cd) (erase-buffer)) - (apply 'call-process locate-command + (apply #'call-process locate-command nil b nil searchstr nil) (with-current-buffer b @@ -221,7 +219,7 @@ Configure EDE's use of GNU Global through the cedet-global.el variable `cedet-global-command'.") (cl-defmethod initialize-instance ((loc ede-locate-global) - &rest slots) + &rest _slots) "Make sure that we can use GNU Global." (require 'cedet-global) ;; Get ourselves initialized. @@ -235,8 +233,8 @@ variable `cedet-global-command'.") (oref loc root)))) ) -(cl-defmethod ede-locate-ok-in-project ((loc (subclass ede-locate-global)) - root) +(cl-defmethod ede-locate-ok-in-project ((_loc (subclass ede-locate-global)) + root) "Is it ok to use this project type under ROOT." (require 'cedet-global) (cedet-gnu-global-version-check) @@ -252,7 +250,7 @@ variable `cedet-global-command'.") (cedet-gnu-global-expand-filename filesubstring))) (cl-defmethod ede-locate-create/update-root-database - ((loc (subclass ede-locate-global)) root) + ((_loc (subclass ede-locate-global)) root) "Create or update the GNU Global database for the current project." (cedet-gnu-global-create/update-database root)) @@ -271,7 +269,7 @@ Configure EDE's use of IDUtils through the cedet-idutils.el file name searching variable `cedet-idutils-file-command'.") (cl-defmethod initialize-instance ((loc ede-locate-idutils) - &rest slots) + &rest _slots) "Make sure that we can use IDUtils." ;; Get ourselves initialized. (cl-call-next-method) @@ -283,8 +281,8 @@ file name searching variable `cedet-idutils-file-command'.") (oref loc root))) ) -(cl-defmethod ede-locate-ok-in-project ((loc (subclass ede-locate-idutils)) - root) +(cl-defmethod ede-locate-ok-in-project ((_loc (subclass ede-locate-idutils)) + root) "Is it ok to use this project type under ROOT." (require 'cedet-idutils) (cedet-idutils-version-check) @@ -301,7 +299,7 @@ that created this EDE locate object." (cedet-idutils-expand-filename filesubstring))) (cl-defmethod ede-locate-create/update-root-database - ((loc (subclass ede-locate-idutils)) root) + ((_loc (subclass ede-locate-idutils)) root) "Create or update the GNU Global database for the current project." (cedet-idutils-create/update-database root)) @@ -320,7 +318,7 @@ Configure EDE's use of Cscope through the cedet-cscope.el file name searching variable `cedet-cscope-file-command'.") (cl-defmethod initialize-instance ((loc ede-locate-cscope) - &rest slots) + &rest _slots) "Make sure that we can use Cscope." ;; Get ourselves initialized. (cl-call-next-method) @@ -332,8 +330,8 @@ file name searching variable `cedet-cscope-file-command'.") (oref loc root))) ) -(cl-defmethod ede-locate-ok-in-project ((loc (subclass ede-locate-cscope)) - root) +(cl-defmethod ede-locate-ok-in-project ((_loc (subclass ede-locate-cscope)) + root) "Is it ok to use this project type under ROOT." (require 'cedet-cscope) (cedet-cscope-version-check) @@ -350,7 +348,7 @@ that created this EDE locate object." (cedet-cscope-expand-filename filesubstring))) (cl-defmethod ede-locate-create/update-root-database - ((loc (subclass ede-locate-cscope)) root) + ((_loc (subclass ede-locate-cscope)) root) "Create or update the Cscope database for the current project." (require 'cedet-cscope) (cedet-cscope-create/update-database root)) diff --git a/lisp/cedet/ede/make.el b/lisp/cedet/ede/make.el index d9811ce52f9..3402020fc4a 100644 --- a/lisp/cedet/ede/make.el +++ b/lisp/cedet/ede/make.el @@ -1,6 +1,6 @@ ;;; ede/make.el --- General information about "make" -*- lexical-binding: t -*- -;;; Copyright (C) 2009-2021 Free Software Foundation, Inc. +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> diff --git a/lisp/cedet/ede/makefile-edit.el b/lisp/cedet/ede/makefile-edit.el index 43655a5d1e3..d6965945494 100644 --- a/lisp/cedet/ede/makefile-edit.el +++ b/lisp/cedet/ede/makefile-edit.el @@ -1,4 +1,4 @@ -;;; makefile-edit.el --- Makefile editing/scanning commands. +;;; makefile-edit.el --- Makefile editing/scanning commands. -*- lexical-binding: t; -*- ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. diff --git a/lisp/cedet/ede/pconf.el b/lisp/cedet/ede/pconf.el index 5bed32ff058..c5b2ea4cb60 100644 --- a/lisp/cedet/ede/pconf.el +++ b/lisp/cedet/ede/pconf.el @@ -1,7 +1,6 @@ -;;; ede/pconf.el --- configure.ac maintenance for EDE +;;; ede/pconf.el --- configure.ac maintenance for EDE -*- lexical-binding: t; -*- -;;; Copyright (C) 1998-2000, 2005, 2008-2021 Free Software Foundation, -;;; Inc. +;; Copyright (C) 1998-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: project @@ -67,7 +66,7 @@ don't do it. A value of nil means to just do it.") ;;(td (file-name-directory (ede-proj-configure-file this))) (targs (oref this targets)) (postcmd "") - (add-missing nil)) + ) ;; (add-missing nil) ;; First, make sure we have a file. (if (not (file-exists-p (ede-proj-configure-file this))) (autoconf-new-program b (oref this name) "Project.ede")) @@ -97,7 +96,7 @@ don't do it. A value of nil means to just do it.") (ede-map-targets sp #'ede-proj-flush-autoconf))) (ede-map-all-subprojects this - (lambda (sp) + (lambda (_sp) (ede-map-targets this #'ede-proj-tweak-autoconf))) ;; Now save (save-buffer) @@ -109,14 +108,15 @@ don't do it. A value of nil means to just do it.") (ede-proj-configure-test-required-file this "README") (ede-proj-configure-test-required-file this "ChangeLog") ;; Let specific targets get missing files. - (mapc 'ede-proj-configure-create-missing targs) + (mapc #'ede-proj-configure-create-missing targs) ;; Verify that we have a make system. (if (or (not (ede-expand-filename (ede-toplevel this) "Makefile")) ;; Now is this one of our old Makefiles? (with-current-buffer (find-file-noselect (ede-expand-filename (ede-toplevel this) - "Makefile" t) t) + "Makefile" t) + t) (goto-char (point-min)) ;; Here is the unique piece for our makefiles. (re-search-forward "For use with: make" nil t))) @@ -166,11 +166,11 @@ don't do it. A value of nil means to just do it.") "Tweak the configure file (current buffer) to accommodate THIS." ;; Check the compilers belonging to THIS, and call the autoconf ;; setup for those compilers. - (mapc 'ede-proj-tweak-autoconf (ede-proj-compilers this)) - (mapc 'ede-proj-tweak-autoconf (ede-proj-linkers this)) + (mapc #'ede-proj-tweak-autoconf (ede-proj-compilers this)) + (mapc #'ede-proj-tweak-autoconf (ede-proj-linkers this)) ) -(cl-defmethod ede-proj-flush-autoconf ((this ede-proj-target)) +(cl-defmethod ede-proj-flush-autoconf ((_this ede-proj-target)) "Flush the configure file (current buffer) to accommodate THIS. By flushing, remove any cruft that may be in the file. Subsequent calls to `ede-proj-tweak-autoconf' can restore items removed by flush." @@ -178,13 +178,13 @@ calls to `ede-proj-tweak-autoconf' can restore items removed by flush." ;; @TODO - No-one calls this ??? -(cl-defmethod ede-proj-configure-add-missing ((this ede-proj-target)) +(cl-defmethod ede-proj-configure-add-missing ((_this ede-proj-target)) "Query if any files needed by THIS provided by automake are missing. Results in --add-missing being passed to automake." nil) ;; @TODO - No-one implements this yet. -(cl-defmethod ede-proj-configure-create-missing ((this ede-proj-target)) +(cl-defmethod ede-proj-configure-create-missing ((_this ede-proj-target)) "Add any missing files for THIS by creating them." nil) diff --git a/lisp/cedet/ede/pmake.el b/lisp/cedet/ede/pmake.el index 47bb0c61eb4..fd6918c4e81 100644 --- a/lisp/cedet/ede/pmake.el +++ b/lisp/cedet/ede/pmake.el @@ -46,6 +46,7 @@ (require 'ede/proj) (require 'ede/proj-obj) (require 'ede/proj-comp) +(require 'seq) (declare-function ede-srecode-setup "ede/srecode") (declare-function ede-srecode-insert "ede/srecode") @@ -111,13 +112,13 @@ MFILENAME is the makefile to generate." (let* ((targ (if isdist (oref this targets) mt)) (sp (oref this subproj)) - (df (apply 'append + (df (apply #'append (mapcar (lambda (tg) (ede-proj-makefile-dependency-files tg)) targ)))) ;; Distribution variables (ede-compiler-begin-unique - (mapc 'ede-proj-makefile-insert-variables targ)) + (mapc #'ede-proj-makefile-insert-variables targ)) ;; Only add the distribution stuff in when depth != 0 (let ((top (ede-toplevel this)) (tmp this) @@ -153,7 +154,8 @@ MFILENAME is the makefile to generate." (concat ".deps/" (file-name-nondirectory (file-name-sans-extension - f)) ".P")) + f)) + ".P")) df " ")))) ;; ;; Insert ALL Rule @@ -188,11 +190,11 @@ MFILENAME is the makefile to generate." ;; (ede-compiler-begin-unique (ede-proj-makefile-insert-rules this) - (mapc 'ede-proj-makefile-insert-rules targ)) + (mapc #'ede-proj-makefile-insert-rules targ)) ;; ;; phony targets for sub projects ;; - (mapc 'ede-proj-makefile-insert-subproj-rules sp) + (mapc #'ede-proj-makefile-insert-subproj-rules sp) ;; ;; Distribution rules such as CLEAN and DIST ;; @@ -210,11 +212,11 @@ MFILENAME is the makefile to generate." ;; Distribution variables (let ((targ (if isdist (oref this targets) mt))) (ede-compiler-begin-unique - (mapc 'ede-proj-makefile-insert-automake-pre-variables targ)) + (mapc #'ede-proj-makefile-insert-automake-pre-variables targ)) (ede-compiler-begin-unique - (mapc 'ede-proj-makefile-insert-source-variables targ)) + (mapc #'ede-proj-makefile-insert-source-variables targ)) (ede-compiler-begin-unique - (mapc 'ede-proj-makefile-insert-automake-post-variables targ)) + (mapc #'ede-proj-makefile-insert-automake-post-variables targ)) (ede-compiler-begin-unique (ede-proj-makefile-insert-user-rules this)) (insert "\n# End of Makefile.am\n") @@ -264,14 +266,14 @@ Execute BODY in a location where a value can be placed." "Add VARNAME into the current Makefile if it doesn't exist. Execute BODY in a location where a value can be placed." (declare (debug t) (indent 1)) - `(let ((addcr t) (v ,varname)) - (unless - (save-excursion - (re-search-backward (concat "^" v "\\s-*=") nil t)) - (insert v "=") - ,@body - (when addcr (insert "\n")) - (goto-char (point-max))))) + `(let ((v ,varname)) + (unless + (save-excursion + (re-search-backward (concat "^" v "\\s-*=") nil t)) + (insert v "=") + ,@body + (insert "\n") + (goto-char (point-max))))) ;;; SOURCE VARIABLE NAME CONSTRUCTION @@ -464,9 +466,9 @@ sources variable." "Return a list of patterns that are considered garbage to THIS. These are removed with make clean." (let ((mc (ede-map-targets - this (lambda (c) (ede-proj-makefile-garbage-patterns c)))) + this #'ede-proj-makefile-garbage-patterns)) (uniq nil)) - (setq mc (sort (apply 'append mc) 'string<)) + (setq mc (sort (apply #'append mc) #'string<)) ;; Filter out duplicates from the targets. (while mc (if (and (car uniq) (string= (car uniq) (car mc))) @@ -502,13 +504,13 @@ These are removed with make clean." (cl-defmethod ede-proj-makefile-insert-rules ((this ede-proj-project)) "Insert rules needed by THIS target." - (mapc 'ede-proj-makefile-insert-rules (oref this inference-rules)) + (mapc #'ede-proj-makefile-insert-rules (oref this inference-rules)) ) (cl-defmethod ede-proj-makefile-insert-dist-dependencies ((this ede-proj-project)) "Insert any symbols that the DIST rule should depend on. Argument THIS is the project that should insert stuff." - (mapc 'ede-proj-makefile-insert-dist-dependencies (oref this targets)) + (mapc #'ede-proj-makefile-insert-dist-dependencies (oref this targets)) ) (cl-defmethod ede-proj-makefile-insert-dist-dependencies ((_this ede-proj-target)) @@ -608,10 +610,10 @@ Argument THIS is the target that should insert stuff." (cl-defmethod ede-proj-makefile-insert-rules ((this ede-proj-target-makefile)) "Insert rules needed by THIS target." - (mapc 'ede-proj-makefile-insert-rules (oref this rules)) + (mapc #'ede-proj-makefile-insert-rules (oref this rules)) (let ((c (ede-proj-compilers this))) (when c - (mapc 'ede-proj-makefile-insert-rules c) + (mapc #'ede-proj-makefile-insert-rules c) (if (oref this phony) (insert ".PHONY: " (ede-proj-makefile-target-name this) "\n")) (insert (ede-proj-makefile-target-name this) ": " @@ -622,9 +624,9 @@ Argument THIS is the target that should insert stuff." (cl-defmethod ede-proj-makefile-insert-commands ((this ede-proj-target-makefile)) "Insert the commands needed by target THIS. For targets, insert the commands needed by the chosen compiler." - (mapc 'ede-proj-makefile-insert-commands (ede-proj-compilers this)) + (mapc #'ede-proj-makefile-insert-commands (ede-proj-compilers this)) (when (object-assoc t :uselinker (ede-proj-compilers this)) - (mapc 'ede-proj-makefile-insert-commands (ede-proj-linkers this)))) + (mapc #'ede-proj-makefile-insert-commands (ede-proj-linkers this)))) (cl-defmethod ede-proj-makefile-insert-user-rules ((this ede-proj-project)) @@ -632,11 +634,11 @@ For targets, insert the commands needed by the chosen compiler." This is different from `ede-proj-makefile-insert-rules' in that this function won't create the building rules which are auto created with automake." - (mapc 'ede-proj-makefile-insert-user-rules (oref this inference-rules))) + (mapc #'ede-proj-makefile-insert-user-rules (oref this inference-rules))) (cl-defmethod ede-proj-makefile-insert-user-rules ((this ede-proj-target)) "Insert user specified rules needed by THIS target." - (mapc 'ede-proj-makefile-insert-rules (oref this rules))) + (mapc #'ede-proj-makefile-insert-rules (oref this rules))) (cl-defmethod ede-proj-makefile-dependencies ((this ede-proj-target-makefile)) "Return a string representing the dependencies for THIS. @@ -644,7 +646,7 @@ Some compilers only use the first element in the dependencies, others have a list of intermediates (object files), and others don't care. This allows customization of how these elements appear." (let* ((c (ede-proj-compilers this)) - (io (eval (cons 'or (mapcar 'ede-compiler-intermediate-objects-p c)))) + (io (seq-some #'ede-compiler-intermediate-objects-p c)) (out nil)) (if io (progn @@ -652,7 +654,8 @@ This allows customization of how these elements appear." (setq out (concat out "$(" (ede-compiler-intermediate-object-variable (car c) - (ede-proj-makefile-target-name this)) ")") + (ede-proj-makefile-target-name this)) + ")") c (cdr c))) out) (let ((sv (ede-proj-makefile-sourcevar this)) diff --git a/lisp/cedet/ede/proj-comp.el b/lisp/cedet/ede/proj-comp.el index 397354ad9c0..0d797aa5fb9 100644 --- a/lisp/cedet/ede/proj-comp.el +++ b/lisp/cedet/ede/proj-comp.el @@ -249,13 +249,12 @@ This will prevent rules from creating duplicate variables or rules." "Add VARNAME into the current Makefile if it doesn't exist. Execute BODY in a location where a value can be placed." (declare (indent 1) (debug (sexp body))) - `(let ((addcr t) (v ,varname)) + `(let ((v ,varname)) (unless (re-search-backward (concat "^" v "\\s-*=") nil t) (insert v "=") ,@body - (if addcr (insert "\n")) - (goto-char (point-max))) - )) + (insert "\n") + (goto-char (point-max))))) (cl-defmethod ede-proj-makefile-insert-variables ((this ede-compilation-program)) "Insert variables needed by the compiler THIS." @@ -309,7 +308,7 @@ Not all compilers do this." (cl-defmethod ede-proj-makefile-insert-rules ((this ede-compilation-program)) "Insert rules needed for THIS compiler object." (ede-compiler-only-once this - (mapc 'ede-proj-makefile-insert-rules (oref this rules)))) + (mapc #'ede-proj-makefile-insert-rules (oref this rules)))) (cl-defmethod ede-proj-makefile-insert-rules ((this ede-makefile-rule)) "Insert rules needed for THIS rule object." diff --git a/lisp/cedet/ede/proj-elisp.el b/lisp/cedet/ede/proj-elisp.el index 9ec96945c10..7e0f5a89346 100644 --- a/lisp/cedet/ede/proj-elisp.el +++ b/lisp/cedet/ede/proj-elisp.el @@ -1,4 +1,4 @@ -;;; ede-proj-elisp.el --- EDE Generic Project Emacs Lisp support +;;; ede-proj-elisp.el --- EDE Generic Project Emacs Lisp support -*- lexical-binding: t; -*- ;; Copyright (C) 1998-2005, 2007-2021 Free Software Foundation, Inc. @@ -64,7 +64,7 @@ This inserts the PRELOADS target-local variable." (when preloads (insert (format "%s: PRELOADS=%s\n" (oref this name) - (mapconcat 'identity preloads " "))))) + (mapconcat #'identity preloads " "))))) (insert "\n")) (cl-defmethod ede-proj-makefile-dependencies ((this ede-proj-target-elisp)) @@ -152,7 +152,7 @@ Bonus: Return a cons cell: (COMPILED . UPTODATE)." (utd 0)) (mapc (lambda (src) (let* ((fsrc (expand-file-name src dir)) - (elc (concat (file-name-sans-extension fsrc) ".elc"))) + ) ;; (elc (concat (file-name-sans-extension fsrc) ".elc")) (with-no-warnings (if (eq (byte-recompile-file fsrc nil 0) t) (setq comp (1+ comp)) @@ -169,7 +169,7 @@ is found, such as a `-version' variable, or the standard header." (if (and (slot-boundp this 'versionsource) (oref this versionsource)) (let ((vs (oref this versionsource)) - (match nil)) + ) ;; (match nil) (while vs (with-current-buffer (find-file-noselect (ede-expand-filename this (car vs))) @@ -177,7 +177,7 @@ is found, such as a `-version' variable, or the standard header." (let ((case-fold-search t)) (if (re-search-forward "-version\\s-+\"\\([^\"]+\\)\"" nil t) (progn - (setq match t) + ;; (setq match t) (delete-region (match-beginning 1) (match-end 1)) (goto-char (match-beginning 1)) @@ -331,27 +331,27 @@ Lays claim to all .elc files that match .el files in this target." If the `compiler' slot is empty, get the car of the compilers list." (let ((comp (oref obj compiler))) (if comp - (if (listp comp) - (setq comp (mapcar 'symbol-value comp)) - (setq comp (list (symbol-value comp)))) + (setq comp (if (listp comp) + (mapcar #'symbol-value comp) + (list (symbol-value comp)))) ;; Get the first element from our list of compilers. - (let ((avail (mapcar 'symbol-value (oref obj availablecompilers)))) + (let ((avail (mapcar #'symbol-value (oref obj availablecompilers)))) (setq comp (list (car avail))))) comp)) -(cl-defmethod ede-proj-makefile-insert-source-variables ((this ede-proj-target-elisp-autoloads) - &optional - moresource) +(cl-defmethod ede-proj-makefile-insert-source-variables ((_this ede-proj-target-elisp-autoloads) + &optional + _moresource) "Insert the source variables needed by THIS. Optional argument MORESOURCE is a list of additional sources to add to the sources variable." nil) -(cl-defmethod ede-proj-makefile-sourcevar ((this ede-proj-target-elisp-autoloads)) +(cl-defmethod ede-proj-makefile-sourcevar ((_this ede-proj-target-elisp-autoloads)) "Return the variable name for THIS's sources." nil) ; "LOADDEFS") -(cl-defmethod ede-proj-makefile-dependencies ((this ede-proj-target-elisp-autoloads)) +(cl-defmethod ede-proj-makefile-dependencies ((_this ede-proj-target-elisp-autoloads)) "Return a string representing the dependencies for THIS. Always return an empty string for an autoloads generator." "") @@ -361,21 +361,22 @@ Always return an empty string for an autoloads generator." (ede-pmake-insert-variable-shared "LOADDEFS" (insert (oref this autoload-file))) (ede-pmake-insert-variable-shared "LOADDIRS" - (insert (mapconcat 'identity + (insert (mapconcat #'identity (or (oref this autoload-dirs) '(".")) " "))) ) (cl-defmethod project-compile-target ((obj ede-proj-target-elisp-autoloads)) "Create or update the autoload target." - (require 'cedet-autogen) + (require 'cedet-autogen) ;FIXME: We don't have this file! + (declare-function cedet-update-autoloads "cedet-autogen") (let ((default-directory (ede-expand-filename obj "."))) - (apply 'cedet-update-autoloads + (apply #'cedet-update-autoloads (oref obj autoload-file) (oref obj autoload-dirs)) )) -(cl-defmethod ede-update-version-in-source ((this ede-proj-target-elisp-autoloads) version) +(cl-defmethod ede-update-version-in-source ((_this ede-proj-target-elisp-autoloads) _version) "In a Lisp file, updated a version string for THIS to VERSION. There are standards in Elisp files specifying how the version string is found, such as a `-version' variable, or the standard header." @@ -397,11 +398,11 @@ Argument THIS is the target which needs to insert an info file." (insert " " (oref this autoload-file)) ) -(cl-defmethod ede-proj-tweak-autoconf ((this ede-proj-target-elisp-autoloads)) +(cl-defmethod ede-proj-tweak-autoconf ((_this ede-proj-target-elisp-autoloads)) "Tweak the configure file (current buffer) to accommodate THIS." (error "Autoloads not supported in autoconf yet")) -(cl-defmethod ede-proj-flush-autoconf ((this ede-proj-target-elisp-autoloads)) +(cl-defmethod ede-proj-flush-autoconf ((_this ede-proj-target-elisp-autoloads)) "Flush the configure file (current buffer) to accommodate THIS." nil) diff --git a/lisp/cedet/ede/proj-info.el b/lisp/cedet/ede/proj-info.el index 3d437016e93..dbb86edb217 100644 --- a/lisp/cedet/ede/proj-info.el +++ b/lisp/cedet/ede/proj-info.el @@ -1,7 +1,6 @@ -;;; ede-proj-info.el --- EDE Generic Project texinfo support +;;; ede-proj-info.el --- EDE Generic Project texinfo support -*- lexical-binding: t; -*- -;;; Copyright (C) 1998-2001, 2004, 2007-2021 Free Software Foundation, -;;; Inc. +;; Copyright (C) 1998-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: project, make @@ -70,7 +69,7 @@ All other sources should be included independently.")) ;;; Makefile generation ;; (cl-defmethod ede-proj-configure-add-missing - ((this ede-proj-target-makefile-info)) + ((_this ede-proj-target-makefile-info)) "Query if any files needed by THIS provided by automake are missing. Results in --add-missing being passed to automake." (not (ede-expand-filename (ede-toplevel) "texinfo.tex"))) @@ -97,7 +96,7 @@ when working in Automake mode." (insert menu)) ;; Now insert the rest of the source elsewhere (ede-pmake-insert-variable-shared sv - (insert (mapconcat 'identity src " "))) + (insert (mapconcat #'identity src " "))) (if moresource (error "Texinfo files should not have moresource"))))) diff --git a/lisp/cedet/ede/proj-obj.el b/lisp/cedet/ede/proj-obj.el index 3aa4497f932..2ae62f4b38e 100644 --- a/lisp/cedet/ede/proj-obj.el +++ b/lisp/cedet/ede/proj-obj.el @@ -1,7 +1,6 @@ -;;; ede/proj-obj.el --- EDE Generic Project Object code generation support +;;; ede/proj-obj.el --- EDE Generic Project Object code generation support -*- lexical-binding: t; -*- -;;; Copyright (C) 1998-2000, 2005, 2008-2021 Free Software Foundation, -;;; Inc. +;; Copyright (C) 1998-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: project, make @@ -282,15 +281,15 @@ Argument THIS is the target to get sources from." (append (oref this source) (oref this auxsource))) (cl-defmethod ede-proj-makefile-insert-variables ((this ede-proj-target-makefile-objectcode) - &optional moresource) + &optional _moresource) "Insert variables needed by target THIS. Optional argument MORESOURCE is not used." (let ((ede-proj-objectcode-dodependencies (oref (ede-target-parent this) automatic-dependencies))) (cl-call-next-method))) -(cl-defmethod ede-buffer-header-file((this ede-proj-target-makefile-objectcode) - buffer) +(cl-defmethod ede-buffer-header-file ((this ede-proj-target-makefile-objectcode) + _buffer) "There are no default header files." (or (cl-call-next-method) ;; Ok, nothing obvious. Try looking in ourselves. diff --git a/lisp/cedet/ede/proj-prog.el b/lisp/cedet/ede/proj-prog.el index 3817cd7d40e..87b2ff7a551 100644 --- a/lisp/cedet/ede/proj-prog.el +++ b/lisp/cedet/ede/proj-prog.el @@ -1,4 +1,4 @@ -;;; ede-proj-prog.el --- EDE Generic Project program support +;;; ede-proj-prog.el --- EDE Generic Project program support -*- lexical-binding: t; -*- ;; Copyright (C) 1998-2001, 2005, 2008-2021 Free Software Foundation, ;; Inc. @@ -90,11 +90,11 @@ Note: Currently only used for Automake projects." (cl-defmethod ede-proj-makefile-insert-variables ((this ede-proj-target-makefile-program)) "Insert variables needed by the compiler THIS." (cl-call-next-method) - (let ((lf (mapconcat 'identity (oref this ldflags) " "))) + (let ((lf (mapconcat #'identity (oref this ldflags) " "))) (with-slots (ldlibs) this (if ldlibs (setq lf - (concat lf " -l" (mapconcat 'identity ldlibs " -l"))))) + (concat lf " -l" (mapconcat #'identity ldlibs " -l"))))) ;; LDFLAGS as needed. (when (and lf (not (string= "" lf))) (ede-pmake-insert-variable-once "LDDEPS" (insert lf))))) diff --git a/lisp/cedet/ede/proj-shared.el b/lisp/cedet/ede/proj-shared.el index 130d7b897aa..01f19bc6572 100644 --- a/lisp/cedet/ede/proj-shared.el +++ b/lisp/cedet/ede/proj-shared.el @@ -1,6 +1,6 @@ -;;; ede-proj-shared.el --- EDE Generic Project shared library support +;;; ede-proj-shared.el --- EDE Generic Project shared library support -*- lexical-binding: t; -*- -;;; Copyright (C) 1998-2000, 2009-2021 Free Software Foundation, Inc. +;; Copyright (C) 1998-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: project, make @@ -170,7 +170,7 @@ Use ldlibs to add addition libraries.") ) (cl-defmethod ede-proj-configure-add-missing - ((this ede-proj-target-makefile-shared-object)) + ((_this ede-proj-target-makefile-shared-object)) "Query if any files needed by THIS provided by automake are missing. Results in --add-missing being passed to automake." (not (and (ede-expand-filename (ede-toplevel) "ltconfig") @@ -185,7 +185,7 @@ Makefile.am generator, so use it to add this important bin program." (insert (concat "lib" (ede-name this) ".la")))) (cl-defmethod ede-proj-makefile-insert-automake-post-variables - ((this ede-proj-target-makefile-shared-object)) + ((_this ede-proj-target-makefile-shared-object)) "Insert bin_PROGRAMS variables needed by target THIS. We need to override -program which has an LDADD element." nil) diff --git a/lisp/cedet/ede/proj.el b/lisp/cedet/ede/proj.el index 4af8b4104f5..6ff763016ef 100644 --- a/lisp/cedet/ede/proj.el +++ b/lisp/cedet/ede/proj.el @@ -1,4 +1,4 @@ -;;; ede/proj.el --- EDE Generic Project file driver +;;; ede/proj.el --- EDE Generic Project file driver -*- lexical-binding: t; -*- ;; Copyright (C) 1998-2003, 2007-2021 Free Software Foundation, Inc. @@ -339,7 +339,7 @@ Argument PROJ is the project to save." (cl-call-next-method) (ede-proj-save proj)) -(cl-defmethod eieio-done-customizing ((target ede-proj-target)) +(cl-defmethod eieio-done-customizing ((_target ede-proj-target)) "Call this when a user finishes customizing this object. Argument TARGET is the project we are completing customization on." (cl-call-next-method) @@ -462,7 +462,7 @@ FILE must be massaged by `ede-convert-path'." (object-remove-from-list target 'auxsource (ede-convert-path target file)) (ede-proj-save)) -(cl-defmethod project-update-version ((this ede-proj-project)) +(cl-defmethod project-update-version ((_this ede-proj-project)) "The :version of project THIS has changed." (ede-proj-save)) @@ -486,7 +486,7 @@ FILE must be massaged by `ede-convert-path'." (concat (oref this name) "-" (oref this version) ".tar.gz") )) -(cl-defmethod project-compile-project ((proj ede-proj-project) &optional command) +(cl-defmethod project-compile-project ((proj ede-proj-project) &optional _command) "Compile the entire current project PROJ. Argument COMMAND is the command to use when compiling." (let ((pm (ede-proj-dist-makefile proj)) @@ -499,13 +499,13 @@ Argument COMMAND is the command to use when compiling." ;;; Target type specific compilations/debug ;; -(cl-defmethod project-compile-target ((obj ede-proj-target) &optional command) +(cl-defmethod project-compile-target ((_obj ede-proj-target) &optional command) "Compile the current target OBJ. Argument COMMAND is the command to use for compiling the target." (project-compile-project (ede-current-project) command)) (cl-defmethod project-compile-target ((obj ede-proj-target-makefile) - &optional command) + &optional _command) "Compile the current target program OBJ. Optional argument COMMAND is the s the alternate command to use." (ede-proj-setup-buildenvironment (ede-current-project)) @@ -545,11 +545,11 @@ Converts all symbols into the objects to be used." (if comp ;; Now that we have a pre-set compilers to use, convert tye symbols ;; into objects for ease of use - (if (listp comp) - (setq comp (mapcar 'symbol-value comp)) - (setq comp (list (symbol-value comp)))) + (setq comp (if (listp comp) + (mapcar #'symbol-value comp) + (list (symbol-value comp)))) (let* ((acomp (oref obj availablecompilers)) - (avail (mapcar 'symbol-value acomp)) + (avail (mapcar #'symbol-value acomp)) (st (oref obj sourcetype)) (sources (oref obj source))) ;; COMP is not specified, so generate a list from the available @@ -585,7 +585,7 @@ Converts all symbols into the objects to be used." (setq link (list (symbol-value link))) (error ":linker is not a symbol. Howd you do that?")) (let* ((alink (oref obj availablelinkers)) - (avail (mapcar 'symbol-value alink)) + (avail (mapcar #'symbol-value alink)) (st (oref obj sourcetype)) (sources (oref obj source))) ;; LINKER is not specified, so generate a list from the available diff --git a/lisp/cedet/ede/shell.el b/lisp/cedet/ede/shell.el index ba36fccd0ba..371b04f9d29 100644 --- a/lisp/cedet/ede/shell.el +++ b/lisp/cedet/ede/shell.el @@ -1,4 +1,4 @@ -;;; ede/shell.el --- A shell controlled by EDE. +;;; ede/shell.el --- A shell controlled by EDE. -*- lexical-binding: t; -*- ;; ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; diff --git a/lisp/cedet/ede/simple.el b/lisp/cedet/ede/simple.el index ea6162ef94f..aaeb3f713c9 100644 --- a/lisp/cedet/ede/simple.el +++ b/lisp/cedet/ede/simple.el @@ -1,4 +1,4 @@ -;;; ede/simple.el --- Overlay an EDE structure on an existing project +;;; ede/simple.el --- Overlay an EDE structure on an existing project -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -78,7 +78,7 @@ The directory has three parts: ede-simple-save-file-name) )) -(defun ede-simple-load (dir &optional rootproj) +(defun ede-simple-load (dir &optional _rootproj) "Load a project of type `Simple' for the directory DIR. Return nil if there isn't one. ROOTPROJ is nil, since we will only create a single EDE project here." @@ -112,7 +112,7 @@ Each directory needs a project file to control it.") (eieio-persistent-save proj)) (cl-defmethod ede-find-subproject-for-directory ((proj ede-simple-project) - dir) + _dir) "Return PROJ, for handling all subdirs below DIR." proj) diff --git a/lisp/cedet/ede/source.el b/lisp/cedet/ede/source.el index abdb07f2d73..5dbad4fcc00 100644 --- a/lisp/cedet/ede/source.el +++ b/lisp/cedet/ede/source.el @@ -1,4 +1,4 @@ -;; ede/source.el --- EDE source code object +;; ede/source.el --- EDE source code object -*- lexical-binding: t; -*- ;; Copyright (C) 2000, 2008-2021 Free Software Foundation, Inc. @@ -72,7 +72,7 @@ that they are willing to use.") ;;; Methods ;; -(cl-defmethod initialize-instance :after ((this ede-sourcecode) &rest fields) +(cl-defmethod initialize-instance :after ((this ede-sourcecode) &rest _fields) "Make sure that all ede compiler objects are cached in `ede-compiler-list'." (let ((lst ede-sourcecode-list)) diff --git a/lisp/cedet/ede/speedbar.el b/lisp/cedet/ede/speedbar.el index 48c4a89c440..01d4f943df5 100644 --- a/lisp/cedet/ede/speedbar.el +++ b/lisp/cedet/ede/speedbar.el @@ -1,4 +1,4 @@ -;;; ede/speedbar.el --- Speedbar viewing of EDE projects +;;; ede/speedbar.el --- Speedbar viewing of EDE projects -*- lexical-binding: t; -*- ;; Copyright (C) 1998-2001, 2003, 2005, 2007-2021 Free Software ;; Foundation, Inc. @@ -42,21 +42,21 @@ (setq ede-speedbar-key-map (speedbar-make-specialized-keymap)) ;; General viewing things - (define-key ede-speedbar-key-map "\C-m" 'speedbar-edit-line) - (define-key ede-speedbar-key-map "+" 'speedbar-expand-line) - (define-key ede-speedbar-key-map "=" 'speedbar-expand-line) - (define-key ede-speedbar-key-map "-" 'speedbar-contract-line) - (define-key ede-speedbar-key-map " " 'speedbar-toggle-line-expansion) + (define-key ede-speedbar-key-map "\C-m" #'speedbar-edit-line) + (define-key ede-speedbar-key-map "+" #'speedbar-expand-line) + (define-key ede-speedbar-key-map "=" #'speedbar-expand-line) + (define-key ede-speedbar-key-map "-" #'speedbar-contract-line) + (define-key ede-speedbar-key-map " " #'speedbar-toggle-line-expansion) ;; Some object based things - (define-key ede-speedbar-key-map "C" 'eieio-speedbar-customize-line) + (define-key ede-speedbar-key-map "C" #'eieio-speedbar-customize-line) ;; Some project based things - (define-key ede-speedbar-key-map "R" 'ede-speedbar-remove-file-from-target) - (define-key ede-speedbar-key-map "b" 'ede-speedbar-compile-line) - (define-key ede-speedbar-key-map "B" 'ede-speedbar-compile-project) - (define-key ede-speedbar-key-map "D" 'ede-speedbar-make-distribution) - (define-key ede-speedbar-key-map "E" 'ede-speedbar-edit-projectfile) + (define-key ede-speedbar-key-map "R" #'ede-speedbar-remove-file-from-target) + (define-key ede-speedbar-key-map "b" #'ede-speedbar-compile-line) + (define-key ede-speedbar-key-map "B" #'ede-speedbar-compile-project) + (define-key ede-speedbar-key-map "D" #'ede-speedbar-make-distribution) + (define-key ede-speedbar-key-map "E" #'ede-speedbar-edit-projectfile) ) (defvar ede-speedbar-menu @@ -98,7 +98,7 @@ (speedbar-get-focus) ) -(defun ede-speedbar-toplevel-buttons (dir) +(defun ede-speedbar-toplevel-buttons (_dir) "Return a list of objects to display in speedbar. Argument DIR is the directory from which to derive the list of objects." ede-projects @@ -180,13 +180,13 @@ Argument DIR is the directory from which to derive the list of objects." (setq depth (1- depth))) (speedbar-line-token)))) -(cl-defmethod eieio-speedbar-derive-line-path ((obj ede-project) &optional depth) +(cl-defmethod eieio-speedbar-derive-line-path ((obj ede-project) &optional _depth) "Return the path to OBJ. Optional DEPTH is the depth we start at." (file-name-directory (oref obj file)) ) -(cl-defmethod eieio-speedbar-derive-line-path ((obj ede-target) &optional depth) +(cl-defmethod eieio-speedbar-derive-line-path ((obj ede-target) &optional _depth) "Return the path to OBJ. Optional DEPTH is the depth we start at." (let ((proj (ede-target-parent obj))) @@ -208,7 +208,7 @@ Optional DEPTH is the depth we start at." "Provide a speedbar description for OBJ." (ede-description obj)) -(cl-defmethod eieio-speedbar-child-description ((obj ede-target)) +(cl-defmethod eieio-speedbar-child-description ((_obj ede-target)) "Provide a speedbar description for a plain-child of OBJ. A plain child is a child element which is not an EIEIO object." (or (speedbar-item-info-file-helper) @@ -251,7 +251,7 @@ It has depth DEPTH." ;;; Generic file management for TARGETS ;; -(defun ede-file-find (text token indent) +(defun ede-file-find (_text token indent) "Find the file TEXT at path TOKEN. INDENT is the current indentation level." (speedbar-find-file-in-frame @@ -290,7 +290,7 @@ level." (t (error "Ooops... not sure what to do"))) (speedbar-center-buffer-smartly)) -(defun ede-tag-find (text token indent) +(defun ede-tag-find (_text token _indent) "For the tag TEXT in a file TOKEN, goto that position. INDENT is the current indentation level." (let ((file (ede-find-nearest-file-line))) @@ -314,21 +314,21 @@ INDENT is the current indentation level." (defvar ede-speedbar-file-menu-additions '("----" ["Create EDE Target" ede-new-target (ede-current-project) ] - ["Add to project" ede-speedbar-file-add-to-project (ede-current-project) ] + ;; ["Add to project" ede-speedbar-file-add-to-project (ede-current-project) ] ["Compile project" ede-speedbar-compile-project (ede-current-project) ] - ["Compile file target" ede-speedbar-compile-file-target (ede-current-project) ] + ;; ["Compile file target" ede-speedbar-compile-file-target (ede-current-project) ] ["Make distribution" ede-make-dist (ede-current-project) ] ) "Set of menu items to splice into the speedbar menu.") (defvar ede-speedbar-file-keymap (let ((km (make-sparse-keymap))) - (define-key km "a" 'ede-speedbar-file-add-to-project) - (define-key km "t" 'ede-new-target) - (define-key km "s" 'ede-speedbar) - (define-key km "C" 'ede-speedbar-compile-project) - (define-key km "c" 'ede-speedbar-compile-file-target) - (define-key km "d" 'ede-make-dist) + ;; (define-key km "a" #'ede-speedbar-file-add-to-project) + (define-key km "t" #'ede-new-target) + (define-key km "s" #'ede-speedbar) + (define-key km "C" #'ede-speedbar-compile-project) + ;; (define-key km "c" #'ede-speedbar-compile-file-target) + (define-key km "d" #'ede-make-dist) km) "Keymap spliced into the speedbar keymap.") diff --git a/lisp/cedet/ede/util.el b/lisp/cedet/ede/util.el index 80cbc211fc2..2b2402c6425 100644 --- a/lisp/cedet/ede/util.el +++ b/lisp/cedet/ede/util.el @@ -1,4 +1,4 @@ -;;; ede/util.el --- EDE utilities +;;; ede/util.el --- EDE utilities -*- lexical-binding: t; -*- ;; Copyright (C) 2000, 2005, 2009-2021 Free Software Foundation, Inc. diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index 63e0cef61a3..4218b23c179 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -576,7 +576,7 @@ OVERARGS is a list of arguments passed to the override and (put :override-with-args 'lisp-indent-function 1) (define-obsolete-function-alias 'define-overload - 'define-overloadable-function "27.1") + #'define-overloadable-function "27.1") (define-obsolete-function-alias 'function-overload-p #'mode-local--function-overload-p "27.1") diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el index 3257feb1fed..d77d635f971 100644 --- a/lisp/cedet/pulse.el +++ b/lisp/cedet/pulse.el @@ -30,10 +30,9 @@ ;; ;; The following are useful entry points: ;; -;; `pulse' - Cause `pulse-highlight-face' to shift toward background color. +;; `pulse-tick' - Cause `pulse-highlight-face' to shift toward background color. ;; Assumes you are using a version of Emacs that supports pulsing. ;; -;; ;; `pulse-momentary-highlight-one-line' - Pulse a single line at POINT. ;; `pulse-momentary-highlight-region' - Pulse a region. ;; `pulse-momentary-highlight-overlay' - Pulse an overlay. @@ -50,7 +49,9 @@ ;; ;; Pulse is a part of CEDET. http://cedet.sf.net -(defun pulse-available-p () +(require 'color) + +(defun pulse-available-p () "Return non-nil if pulsing is available on the current frame." (condition-case nil (let ((v (color-values (face-background 'default)))) @@ -90,69 +91,27 @@ Face used for temporary highlighting of tags for effect." :group 'pulse) ;;; Code: -;; -(defun pulse-int-to-hex (int &optional nb-digits) - "Convert integer argument INT to a #XXXXXXXXXXXX format hex string. -Each X in the output string is a hexadecimal digit. -NB-DIGITS is the number of hex digits. If INT is too large to be -represented with NB-DIGITS, then the result is truncated from the -left. So, for example, INT=256 and NB-DIGITS=2 returns \"00\", since -the hex equivalent of 256 decimal is 100, which is more than 2 digits. - -This function was blindly copied from hexrgb.el by Drew Adams. -https://www.emacswiki.org/emacs/hexrgb.el" - (setq nb-digits (or nb-digits 4)) - (substring (format (concat "%0" (int-to-string nb-digits) "X") int) (- nb-digits))) - -(defun pulse-color-values-to-hex (values) - "Convert list of rgb color VALUES to a hex string, #XXXXXXXXXXXX. -Each X in the string is a hexadecimal digit. -Input VALUES is as for the output of `x-color-values'. - -This function was blindly copied from hexrgb.el by Drew Adams. -https://www.emacswiki.org/emacs/hexrgb.el" - (concat "#" - (pulse-int-to-hex (nth 0 values) 4) ; red - (pulse-int-to-hex (nth 1 values) 4) ; green - (pulse-int-to-hex (nth 2 values) 4))) ; blue (defcustom pulse-iterations 10 "Number of iterations in a pulse operation." :group 'pulse :type 'number) + (defcustom pulse-delay .03 "Delay between face lightening iterations." :group 'pulse :type 'number) -(defun pulse-lighten-highlight () - "Lighten the face by 1/`pulse-iterations' toward the background color. -Return t if there is more drift to do, nil if completed." - (if (>= (get 'pulse-highlight-face :iteration) pulse-iterations) - nil - (let* ((frame (color-values (face-background 'default))) - (pulse-background (face-background - (get 'pulse-highlight-face - :startface) - nil t)));; can be nil - (when pulse-background - (let* ((start (color-values pulse-background)) - (frac (list (/ (- (nth 0 frame) (nth 0 start)) pulse-iterations) - (/ (- (nth 1 frame) (nth 1 start)) pulse-iterations) - (/ (- (nth 2 frame) (nth 2 start)) pulse-iterations))) - (it (get 'pulse-highlight-face :iteration)) - ) - (set-face-background 'pulse-highlight-face - (pulse-color-values-to-hex - (list - (+ (nth 0 start) (* (nth 0 frac) it)) - (+ (nth 1 start) (* (nth 1 frac) it)) - (+ (nth 2 start) (* (nth 2 frac) it))))) - (put 'pulse-highlight-face :iteration (1+ it)) - (if (>= (1+ it) pulse-iterations) - nil - t))) - ))) +;;; Convenience Functions +;; +(defvar pulse-momentary-overlay nil + "The current pulsing overlay.") + +(defvar pulse-momentary-timer nil + "The current pulsing timer.") + +(defvar pulse-momentary-iteration 0 + "The current pulsing iteration.") (defun pulse-reset-face (&optional face) "Reset the pulse highlighting FACE." @@ -166,15 +125,7 @@ Return t if there is more drift to do, nil if completed." (face-extend-p face nil t))) (put 'pulse-highlight-face :startface (or face 'pulse-highlight-start-face)) - (put 'pulse-highlight-face :iteration 0)) - -;;; Convenience Functions -;; -(defvar pulse-momentary-overlay nil - "The current pulsing overlay.") - -(defvar pulse-momentary-timer nil - "The current pulsing timer.") + (setq pulse-momentary-iteration 0)) (defun pulse-momentary-highlight-overlay (o &optional face) "Pulse the overlay O, unhighlighting before next command. @@ -194,21 +145,29 @@ Optional argument FACE specifies the face to do the highlighting." (progn (overlay-put o 'face (or face 'pulse-highlight-start-face)) (add-hook 'pre-command-hook - 'pulse-momentary-unhighlight)) + #'pulse-momentary-unhighlight)) ;; Pulse it. (overlay-put o 'face 'pulse-highlight-face) ;; The pulse function puts FACE onto 'pulse-highlight-face. ;; Thus above we put our face on the overlay, but pulse ;; with a reference face needed for the color. (pulse-reset-face face) - (setq pulse-momentary-timer - (run-with-timer 0 pulse-delay #'pulse-tick - (time-add nil - (* pulse-delay pulse-iterations))))))) - -(defun pulse-tick (stop-time) + (let* ((start (color-name-to-rgb + (face-background 'pulse-highlight-start-face))) + (stop (color-name-to-rgb (face-background 'default))) + (colors (mapcar (apply-partially 'apply 'color-rgb-to-hex) + (color-gradient start stop pulse-iterations)))) + (setq pulse-momentary-timer + (run-with-timer 0 pulse-delay #'pulse-tick + colors + (time-add nil + (* pulse-delay pulse-iterations)))))))) + +(defun pulse-tick (colors stop-time) (if (time-less-p nil stop-time) - (pulse-lighten-highlight) + (when-let (color (elt colors pulse-momentary-iteration)) + (set-face-background 'pulse-highlight-face color) + (setq pulse-momentary-iteration (1+ pulse-momentary-iteration))) (pulse-momentary-unhighlight))) (defun pulse-momentary-unhighlight () @@ -233,7 +192,7 @@ Optional argument FACE specifies the face to do the highlighting." (cancel-timer pulse-momentary-timer)) ;; Remove this hook. - (remove-hook 'pre-command-hook 'pulse-momentary-unhighlight)) + (remove-hook 'pre-command-hook #'pulse-momentary-unhighlight)) ;;;###autoload (defun pulse-momentary-highlight-one-line (point &optional face) diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el index 797ff753a6c..15388f08d66 100644 --- a/lisp/cedet/semantic.el +++ b/lisp/cedet/semantic.el @@ -1,4 +1,4 @@ -;;; semantic.el --- Semantic buffer evaluator. +;;; semantic.el --- Semantic buffer evaluator. -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2021 Free Software Foundation, Inc. @@ -297,7 +297,7 @@ to use Semantic, and `semantic-init-hook' is run." 'semantic-inhibit-functions))) ;; Make sure that if this buffer is cloned, our tags and overlays ;; don't go along for the ride. - (add-hook 'clone-indirect-buffer-hook 'semantic-clear-toplevel-cache + (add-hook 'clone-indirect-buffer-hook #'semantic-clear-toplevel-cache nil t) ;; Specify that this function has done its work. At this point ;; we can consider that semantic is active in this buffer. @@ -466,12 +466,12 @@ is requested." ;; Nuke all semantic overlays. This is faster than deleting based ;; on our data structure. (let ((l (overlay-lists))) - (mapc 'semantic-delete-overlay-maybe (car l)) - (mapc 'semantic-delete-overlay-maybe (cdr l)) + (mapc #'semantic-delete-overlay-maybe (car l)) + (mapc #'semantic-delete-overlay-maybe (cdr l)) ) (semantic-parse-tree-set-needs-rebuild) ;; Remove this hook which tracks if a buffer is up to date or not. - (remove-hook 'after-change-functions 'semantic-change-function t) + (remove-hook 'after-change-functions #'semantic-change-function t) (run-hook-with-args 'semantic-after-toplevel-cache-change-hook semantic--buffer-cache) @@ -487,7 +487,7 @@ is requested." ;; This is specific to the bovine parser. (setq-local semantic-bovinate-nonterminal-check-obarray nil) (semantic-parse-tree-set-up-to-date) - (add-hook 'after-change-functions 'semantic-change-function nil t) + (add-hook 'after-change-functions #'semantic-change-function nil t) (run-hook-with-args 'semantic-after-toplevel-cache-change-hook semantic--buffer-cache) (setq semantic--completion-cache nil) @@ -779,25 +779,25 @@ Throw away all the old tags, and recreate the tag database." (defvar semantic-mode-map (let ((map (make-sparse-keymap))) ;; Key bindings: - ;; (define-key km "f" 'senator-search-set-tag-class-filter) - ;; (define-key km "i" 'senator-isearch-toggle-semantic-mode) - (define-key map "\C-c,j" 'semantic-complete-jump-local) - (define-key map "\C-c,J" 'semantic-complete-jump) - (define-key map "\C-c,m" 'semantic-complete-jump-local-members) - (define-key map "\C-c,g" 'semantic-symref-symbol) - (define-key map "\C-c,G" 'semantic-symref) - (define-key map "\C-c,p" 'senator-previous-tag) - (define-key map "\C-c,n" 'senator-next-tag) - (define-key map "\C-c,u" 'senator-go-to-up-reference) - (define-key map "\C-c, " 'semantic-complete-analyze-inline) - (define-key map "\C-c,\C-w" 'senator-kill-tag) - (define-key map "\C-c,\M-w" 'senator-copy-tag) - (define-key map "\C-c,\C-y" 'senator-yank-tag) - (define-key map "\C-c,r" 'senator-copy-tag-to-register) - (define-key map "\C-c,," 'semantic-force-refresh) - (define-key map [?\C-c ?, up] 'senator-transpose-tags-up) - (define-key map [?\C-c ?, down] 'senator-transpose-tags-down) - (define-key map "\C-c,l" 'semantic-analyze-possible-completions) + ;; (define-key km "f" #'senator-search-set-tag-class-filter) + ;; (define-key km "i" #'senator-isearch-toggle-semantic-mode) + (define-key map "\C-c,j" #'semantic-complete-jump-local) + (define-key map "\C-c,J" #'semantic-complete-jump) + (define-key map "\C-c,m" #'semantic-complete-jump-local-members) + (define-key map "\C-c,g" #'semantic-symref-symbol) + (define-key map "\C-c,G" #'semantic-symref) + (define-key map "\C-c,p" #'senator-previous-tag) + (define-key map "\C-c,n" #'senator-next-tag) + (define-key map "\C-c,u" #'senator-go-to-up-reference) + (define-key map "\C-c, " #'semantic-complete-analyze-inline) + (define-key map "\C-c,\C-w" #'senator-kill-tag) + (define-key map "\C-c,\M-w" #'senator-copy-tag) + (define-key map "\C-c,\C-y" #'senator-yank-tag) + (define-key map "\C-c,r" #'senator-copy-tag-to-register) + (define-key map "\C-c,," #'semantic-force-refresh) + (define-key map [?\C-c ?, up] #'senator-transpose-tags-up) + (define-key map [?\C-c ?, down] #'senator-transpose-tags-down) + (define-key map "\C-c,l" #'semantic-analyze-possible-completions) ;; This hack avoids showing the CEDET menu twice if ede-minor-mode ;; and Semantic are both enabled. Is there a better way? (define-key map [menu-bar cedet-menu] @@ -1029,7 +1029,7 @@ Semantic mode. (file-exists-p semanticdb-default-system-save-directory)) (require 'semantic/db-ebrowse) (semanticdb-load-ebrowse-caches))) - (add-hook 'mode-local-init-hook 'semantic-new-buffer-fcn) + (add-hook 'mode-local-init-hook #'semantic-new-buffer-fcn) ;; Add semantic-ia-complete-symbol to ;; completion-at-point-functions, so that it is run from ;; M-TAB. @@ -1037,11 +1037,11 @@ Semantic mode. ;; Note: The first entry added is the last entry run, so the ;; most specific entry should be last. (add-hook 'completion-at-point-functions - 'semantic-analyze-nolongprefix-completion-at-point-function) + #'semantic-analyze-nolongprefix-completion-at-point-function) (add-hook 'completion-at-point-functions - 'semantic-analyze-notc-completion-at-point-function) + #'semantic-analyze-notc-completion-at-point-function) (add-hook 'completion-at-point-functions - 'semantic-analyze-completion-at-point-function) + #'semantic-analyze-completion-at-point-function) (if (bound-and-true-p global-ede-mode) (define-key cedet-menu-map [cedet-menu-separator] '("--"))) @@ -1052,21 +1052,21 @@ Semantic mode. ;; introduced in the buffer is pretty much futile, but we have to ;; clean the hooks and delete Semantic-related overlays, so that ;; Semantic can be re-activated cleanly. - (remove-hook 'mode-local-init-hook 'semantic-new-buffer-fcn) + (remove-hook 'mode-local-init-hook #'semantic-new-buffer-fcn) (remove-hook 'completion-at-point-functions - 'semantic-analyze-completion-at-point-function) + #'semantic-analyze-completion-at-point-function) (remove-hook 'completion-at-point-functions - 'semantic-analyze-notc-completion-at-point-function) + #'semantic-analyze-notc-completion-at-point-function) (remove-hook 'completion-at-point-functions - 'semantic-analyze-nolongprefix-completion-at-point-function) + #'semantic-analyze-nolongprefix-completion-at-point-function) (remove-hook 'after-change-functions - 'semantic-change-function) + #'semantic-change-function) (define-key cedet-menu-map [cedet-menu-separator] nil) (define-key cedet-menu-map [semantic-options-separator] nil) ;; FIXME: handle semanticdb-load-ebrowse-caches (dolist (mode semantic-submode-list) - (if (and (boundp mode) (eval mode)) + (if (and (boundp mode) (symbol-value mode)) (funcall mode -1))) ;; Unlink buffer and clear cache (semantic--tag-unlink-cache-from-buffer) diff --git a/lisp/cedet/semantic/analyze/debug.el b/lisp/cedet/semantic/analyze/debug.el index 58d6644f9a9..69b3b9c8328 100644 --- a/lisp/cedet/semantic/analyze/debug.el +++ b/lisp/cedet/semantic/analyze/debug.el @@ -1,6 +1,6 @@ ;;; semantic/analyze/debug.el --- Debug the analyzer -*- lexical-binding: t; -*- -;;; Copyright (C) 2008-2021 Free Software Foundation, Inc. +;; Copyright (C) 2008-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> @@ -593,19 +593,20 @@ Look for key expressions, and add push-buttons near them." (setq-local semantic-analyzer-debug-orig orig-buffer) ;; First, add do-in buttons to recommendations. (while (re-search-forward "^\\s-*M-x \\(\\(\\w\\|\\s_\\)+\\) " nil t) - (let ((fcn (match-string 1))) - (when (not (fboundp (intern-soft fcn))) + (let* ((fcn (match-string 1)) + (fsym (intern-soft fcn))) + (when (not (fboundp fsym)) (error "Help Err: Can't find %s" fcn)) (end-of-line) (insert " ") (insert-button "[ Do It ]" 'mouse-face 'custom-button-pressed-face 'do-fcn fcn - 'action `(lambda (arg) - (let ((M semantic-analyzer-debug-orig)) - (set-buffer (marker-buffer M)) - (goto-char M)) - (call-interactively (quote ,(intern-soft fcn)))))))) + 'action (lambda (_arg) + (let ((M semantic-analyzer-debug-orig)) + (set-buffer (marker-buffer M)) + (goto-char M)) + (call-interactively fsym)))))) ;; Do something else? ;; Clean up the mess (set-buffer-modified-p nil)))) diff --git a/lisp/cedet/semantic/bovine/make.el b/lisp/cedet/semantic/bovine/make.el index 2c9b78f9dd1..bb579cfde3f 100644 --- a/lisp/cedet/semantic/bovine/make.el +++ b/lisp/cedet/semantic/bovine/make.el @@ -218,7 +218,7 @@ Uses default implementation, and also gets a list of filenames." ;; but not actually parsed. (file . "File")) semantic-case-fold t - semantic-tag-expand-function 'semantic-make-expand-tag + semantic-tag-expand-function #'semantic-make-expand-tag semantic-lex-syntax-modifications '((?. "_") (?= ".") (?/ "_") @@ -226,7 +226,7 @@ Uses default implementation, and also gets a list of filenames." (?+ ".") (?\\ ".") ) - imenu-create-index-function 'semantic-create-imenu-index + imenu-create-index-function #'semantic-create-imenu-index ) (setq semantic-lex-analyzer #'semantic-make-lexer) ) diff --git a/lisp/cedet/semantic/bovine/scm.el b/lisp/cedet/semantic/bovine/scm.el index 939348ef4a5..0395412069b 100644 --- a/lisp/cedet/semantic/bovine/scm.el +++ b/lisp/cedet/semantic/bovine/scm.el @@ -1,6 +1,6 @@ ;;; semantic/bovine/scm.el --- Semantic details for Scheme (guile) -*- lexical-binding: t; -*- -;;; Copyright (C) 2001-2004, 2008-2021 Free Software Foundation, Inc. +;; Copyright (C) 2001-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> @@ -102,8 +102,7 @@ syntax as specified by the syntax table." (function . "Functions") (include . "Loads") (package . "DefineModule")) - imenu-create-index-function 'semantic-create-imenu-index - imenu-create-index-function 'semantic-create-imenu-index + imenu-create-index-function #'semantic-create-imenu-index ) (setq semantic-lex-analyzer #'semantic-scheme-lexer) ) diff --git a/lisp/cedet/semantic/chart.el b/lisp/cedet/semantic/chart.el index e7848faf741..0abbe458647 100644 --- a/lisp/cedet/semantic/chart.el +++ b/lisp/cedet/semantic/chart.el @@ -1,4 +1,4 @@ -;;; semantic/chart.el --- Utilities for use with semantic tag tables +;;; semantic/chart.el --- Utilities for use with semantic tag tables -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2001, 2003, 2005, 2008-2021 Free Software ;; Foundation, Inc. @@ -43,7 +43,7 @@ TAGTABLE is passed to `semantic-something-to-tag-table'." (interactive) (let* ((stream (semantic-something-to-tag-table (or tagtable (current-buffer)))) - (names (mapcar 'cdr semantic-symbol->name-assoc-list)) + (names (mapcar #'cdr semantic-symbol->name-assoc-list)) (nums (mapcar (lambda (symname) (length @@ -57,7 +57,7 @@ TAGTABLE is passed to `semantic-something-to-tag-table'." nums "Volume") )) -(defun semantic-chart-database-size (&optional tagtable) +(defun semantic-chart-database-size (&optional _tagtable) "Create a bar chart representing the size of each file in semanticdb. Each bar represents how many toplevel tags in TAGTABLE exist in each database entry. @@ -68,7 +68,7 @@ TAGTABLE is passed to `semantic-something-to-tag-table'." (error "Semanticdb is not enabled")) (let* ((db semanticdb-current-database) (dbt (semanticdb-get-database-tables db)) - (names (mapcar 'car + (names (mapcar #'car (object-assoc-list 'file dbt))) @@ -84,8 +84,8 @@ TAGTABLE is passed to `semantic-something-to-tag-table'." (nums nil) (fh (/ (- (frame-height) 7) 4))) (setq numnuts (sort numnuts (lambda (a b) (> (car a) (car b))))) - (setq names (mapcar 'cdr numnuts) - nums (mapcar 'car numnuts)) + (setq names (mapcar #'cdr numnuts) + nums (mapcar #'car numnuts)) (if (> (length names) fh) (progn (setcdr (nthcdr fh names) nil) diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el index c83505818f5..d6ef7960473 100644 --- a/lisp/cedet/semantic/complete.el +++ b/lisp/cedet/semantic/complete.el @@ -1,4 +1,4 @@ -;;; semantic/complete.el --- Routines for performing tag completion +;;; semantic/complete.el --- Routines for performing tag completion -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2005, 2007-2021 Free Software Foundation, Inc. @@ -154,8 +154,8 @@ Presumably if you call this you will insert something new there." (defun semantic-completion-message (fmt &rest args) "Display the string FMT formatted with ARGS at the end of the minibuffer." (if semantic-complete-inline-overlay - (apply 'message fmt args) - (apply 'message (concat "%s" fmt) (buffer-string) args))) + (apply #'message fmt args) + (apply #'message (concat "%s" fmt) (buffer-string) args))) ;;; ------------------------------------------------------------ ;;; MINIBUFFER: Option Selection harnesses @@ -171,14 +171,14 @@ Value should be a ... what?") (defvar semantic-complete-key-map (let ((km (make-sparse-keymap))) - (define-key km " " 'semantic-complete-complete-space) - (define-key km "\t" 'semantic-complete-complete-tab) - (define-key km "\C-m" 'semantic-complete-done) - (define-key km "\C-g" 'abort-recursive-edit) - (define-key km "\M-n" 'next-history-element) - (define-key km "\M-p" 'previous-history-element) - (define-key km "\C-n" 'next-history-element) - (define-key km "\C-p" 'previous-history-element) + (define-key km " " #'semantic-complete-complete-space) + (define-key km "\t" #'semantic-complete-complete-tab) + (define-key km "\C-m" #'semantic-complete-done) + (define-key km "\C-g" #'abort-recursive-edit) + (define-key km "\M-n" #'next-history-element) + (define-key km "\M-p" #'previous-history-element) + (define-key km "\C-n" #'next-history-element) + (define-key km "\C-p" #'previous-history-element) ;; Add history navigation km) "Keymap used while completing across a list of tags.") @@ -488,7 +488,7 @@ If PARTIAL, do partial completion stopping at spaces." ) (t nil)))) -(defun semantic-complete-do-completion (&optional partial inline) +(defun semantic-complete-do-completion (&optional partial _inline) "Do a completion for the current minibuffer. If PARTIAL, do partial completion stopping at spaces. if INLINE, then completion is happening inline in a buffer." @@ -550,12 +550,12 @@ if INLINE, then completion is happening inline in a buffer." ;; push ourselves out of this mode on alternate keypresses. (defvar semantic-complete-inline-map (let ((km (make-sparse-keymap))) - (define-key km "\C-i" 'semantic-complete-inline-TAB) - (define-key km "\M-p" 'semantic-complete-inline-up) - (define-key km "\M-n" 'semantic-complete-inline-down) - (define-key km "\C-m" 'semantic-complete-inline-done) - (define-key km "\C-\M-c" 'semantic-complete-inline-exit) - (define-key km "\C-g" 'semantic-complete-inline-quit) + (define-key km "\C-i" #'semantic-complete-inline-TAB) + (define-key km "\M-p" #'semantic-complete-inline-up) + (define-key km "\M-n" #'semantic-complete-inline-down) + (define-key km "\C-m" #'semantic-complete-inline-done) + (define-key km "\C-\M-c" #'semantic-complete-inline-exit) + (define-key km "\C-g" #'semantic-complete-inline-quit) (define-key km "?" (lambda () (interactive) (describe-variable 'semantic-complete-inline-map))) @@ -620,7 +620,7 @@ Similar to `minibuffer-contents' when completing in the minibuffer." "Exit inline completion mode." (interactive) ;; Remove this hook FIRST! - (remove-hook 'pre-command-hook 'semantic-complete-pre-command-hook) + (remove-hook 'pre-command-hook #'semantic-complete-pre-command-hook) (condition-case nil (progn @@ -649,7 +649,7 @@ Similar to `minibuffer-contents' when completing in the minibuffer." ;; Remove this hook LAST!!! ;; This will force us back through this function if there was ;; some sort of error above. - (remove-hook 'post-command-hook 'semantic-complete-post-command-hook) + (remove-hook 'post-command-hook #'semantic-complete-post-command-hook) ;;(message "Exiting inline completion.") ) @@ -770,8 +770,8 @@ END is at the end of the current symbol being completed." (overlay-put semantic-complete-inline-overlay 'semantic-original-start start) ;; Install our command hooks - (add-hook 'pre-command-hook 'semantic-complete-pre-command-hook) - (add-hook 'post-command-hook 'semantic-complete-post-command-hook) + (add-hook 'pre-command-hook #'semantic-complete-pre-command-hook) + (add-hook 'post-command-hook #'semantic-complete-post-command-hook) ;; Go! (semantic-complete-inline-force-display) ) @@ -929,8 +929,8 @@ The only options available for completion are those which can be logically inserted into the current context.") (cl-defmethod semantic-collector-calculate-completions-raw - ((obj semantic-collector-analyze-completions) prefix completionlist) - "calculate the completions for prefix from completionlist." + ((obj semantic-collector-analyze-completions) prefix _completionlist) + "calculate the completions for prefix from COMPLETIONLIST." ;; if there are no completions yet, calculate them. (if (not (slot-boundp obj 'first-pass-completions)) (oset obj first-pass-completions @@ -943,7 +943,7 @@ inserted into the current context.") prefix (oref obj first-pass-completions))))) -(cl-defmethod semantic-collector-cleanup ((obj semantic-collector-abstract)) +(cl-defmethod semantic-collector-cleanup ((_obj semantic-collector-abstract)) "Clean up any mess this collector may have." nil) @@ -1004,7 +1004,7 @@ Output must be in semanticdb Find result format." (list (cons table result))))) (cl-defmethod semantic-collector-calculate-completions - ((obj semantic-collector-abstract) prefix partial) + ((obj semantic-collector-abstract) prefix _partial) "Calculate completions for prefix as setup for other queries." (let* ((case-fold-search semantic-case-fold) (same-prefix-p (semantic-collector-last-prefix= obj prefix)) @@ -1014,7 +1014,8 @@ Output must be in semanticdb Find result format." (cond ((or same-prefix-p (and last-prefix (eq (compare-strings last-prefix 0 nil - prefix 0 (length last-prefix)) t))) + prefix 0 (length last-prefix)) + t))) ;; We have the same prefix, or last-prefix is a ;; substring of the of new prefix, in which case we are ;; refining our symbol so just re-use cache. @@ -1023,7 +1024,8 @@ Output must be in semanticdb Find result format." (> (length prefix) 1) (eq (compare-strings prefix 0 nil - last-prefix 0 (length prefix)) t)) + last-prefix 0 (length prefix)) + t)) ;; The new prefix is a substring of the old ;; prefix, and it's longer than one character. ;; Perform a full search to pull in additional @@ -1134,7 +1136,7 @@ into a buffer." (semanticdb-find-result-nth-in-buffer (oref obj current-exact-match) 0))) (cl-defmethod semantic-collector-all-completions - ((obj semantic-collector-abstract) prefix) + ((obj semantic-collector-abstract) _prefix) "For OBJ, retrieve all completions matching PREFIX. The returned list consists of all the tags currently matching PREFIX." @@ -1142,7 +1144,7 @@ matching PREFIX." (oref obj last-all-completions))) (cl-defmethod semantic-collector-try-completion - ((obj semantic-collector-abstract) prefix) + ((obj semantic-collector-abstract) _prefix) "For OBJ, attempt to match PREFIX. See `try-completion' for details on how this works. Return nil for no match. @@ -1153,7 +1155,7 @@ with that name." (oref obj last-completion))) (cl-defmethod semantic-collector-calculate-cache - ((obj semantic-collector-abstract)) + ((_obj semantic-collector-abstract)) "Calculate the completion cache for OBJ." nil ) @@ -1176,7 +1178,7 @@ These collectors track themselves on a per-buffer basis." :abstract t) (cl-defmethod make-instance ((this (subclass semantic-collector-buffer-abstract)) - &rest args) + &rest _args) "Reuse previously created objects of this type in buffer." (let ((old nil) (bl semantic-collector-per-buffer-list)) @@ -1193,7 +1195,7 @@ These collectors track themselves on a per-buffer basis." old)) ;; Buffer specific collectors should flush themselves -(defun semantic-collector-buffer-flush (newcache) +(defun semantic-collector-buffer-flush (_newcache) "Flush all buffer collector objects. NEWCACHE is the new tag table, but we ignore it." (condition-case nil @@ -1204,7 +1206,7 @@ NEWCACHE is the new tag table, but we ignore it." (error nil))) (add-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-collector-buffer-flush) + #'semantic-collector-buffer-flush) ;;; DEEP BUFFER SPECIFIC COMPLETION ;; @@ -1246,8 +1248,8 @@ Uses semanticdb for searching all tags in the current project." (cl-defmethod semantic-collector-calculate-completions-raw - ((obj semantic-collector-project) prefix completionlist) - "Calculate the completions for prefix from completionlist." + ((obj semantic-collector-project) prefix _completionlist) + "Calculate the completions for prefix from COMPLETIONLIST." (semanticdb-find-tags-for-completion prefix (oref obj path))) ;;; Brutish Project search @@ -1259,8 +1261,8 @@ Uses semanticdb for searching all tags in the current project." "semantic/db-find") (cl-defmethod semantic-collector-calculate-completions-raw - ((obj semantic-collector-project-brutish) prefix completionlist) - "Calculate the completions for prefix from completionlist." + ((obj semantic-collector-project-brutish) prefix _completionlist) + "Calculate the completions for prefix from COMPLETIONLIST." (require 'semantic/db-find) (semanticdb-brute-deep-find-tags-for-completion prefix (oref obj path))) @@ -1273,8 +1275,8 @@ Uses semanticdb for searching all tags in the current project." "Completion engine for tags in a project.") (cl-defmethod semantic-collector-calculate-completions-raw - ((obj semantic-collector-local-members) prefix completionlist) - "Calculate the completions for prefix from completionlist." + ((obj semantic-collector-local-members) prefix _completionlist) + "Calculate the completions for prefix from COMPLETIONLIST." (let* ((scope (or (oref obj scope) (oset obj scope (semantic-calculate-scope)))) (localstuff (oref scope scope))) @@ -1323,7 +1325,7 @@ a collector, and tracking tables of completion to display." (define-obsolete-function-alias 'semantic-displayor-cleanup #'semantic-displayer-cleanup "27.1") -(cl-defmethod semantic-displayer-cleanup ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-cleanup ((_obj semantic-displayer-abstract)) "Clean up any mess this displayer may have." nil) @@ -1348,37 +1350,37 @@ a collector, and tracking tables of completion to display." (define-obsolete-function-alias 'semantic-displayor-show-request #'semantic-displayer-show-request "27.1") -(cl-defmethod semantic-displayer-show-request ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-show-request ((_obj semantic-displayer-abstract)) "A request to show the current tags table." (ding)) (define-obsolete-function-alias 'semantic-displayor-focus-request #'semantic-displayer-focus-request "27.1") -(cl-defmethod semantic-displayer-focus-request ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-focus-request ((_obj semantic-displayer-abstract)) "A request to for the displayer to focus on some tag option." (ding)) (define-obsolete-function-alias 'semantic-displayor-scroll-request #'semantic-displayer-scroll-request "27.1") -(cl-defmethod semantic-displayer-scroll-request ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-scroll-request ((_obj semantic-displayer-abstract)) "A request to for the displayer to scroll the completion list (if needed)." (scroll-other-window)) (define-obsolete-function-alias 'semantic-displayor-focus-previous #'semantic-displayer-focus-previous "27.1") -(cl-defmethod semantic-displayer-focus-previous ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-focus-previous ((_obj semantic-displayer-abstract)) "Set the current focus to the previous item." nil) (define-obsolete-function-alias 'semantic-displayor-focus-next #'semantic-displayer-focus-next "27.1") -(cl-defmethod semantic-displayer-focus-next ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-focus-next ((_obj semantic-displayer-abstract)) "Set the current focus to the next item." nil) (define-obsolete-function-alias 'semantic-displayor-current-focus #'semantic-displayer-current-focus "27.1") -(cl-defmethod semantic-displayer-current-focus ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-current-focus ((_obj semantic-displayer-abstract)) "Return a single tag currently in focus. This object type doesn't do focus, so will never have a focus object." nil) @@ -1452,7 +1454,7 @@ which have the same name." (define-obsolete-function-alias 'semantic-displayor-set-completions #'semantic-displayer-set-completions "27.1") (cl-defmethod semantic-displayer-set-completions ((obj semantic-displayer-focus-abstract) - table prefix) + _table _prefix) "Set the list of tags to be completed over to TABLE." (cl-call-next-method) (slot-makeunbound obj 'focus)) @@ -1663,7 +1665,7 @@ This will not happen if you directly set this variable via `setq'." "Display completions options in a tooltip. Display mechanism using tooltip for a list of possible completions.") -(cl-defmethod initialize-instance :after ((obj semantic-displayer-tooltip) &rest args) +(cl-defmethod initialize-instance :after ((_obj semantic-displayer-tooltip) &rest _args) "Make sure we have tooltips required." (require 'tooltip)) @@ -1681,16 +1683,16 @@ Display mechanism using tooltip for a list of possible completions.") (table (semantic-unique-tag-table-by-name tablelong)) (completions (mapcar semantic-completion-displayer-format-tag-function table)) (numcompl (length completions)) - (typing-count (oref obj typing-count)) + ;; (typing-count (oref obj typing-count)) (mode (oref obj mode)) (max-tags (oref obj max-tags-initial)) (matchtxt (semantic-completion-text)) msg msg-tail) ;; Keep a count of the consecutive completion commands entered by the user. - (if (and (stringp (this-command-keys)) - (string= (this-command-keys) "\C-i")) - (oset obj typing-count (1+ (oref obj typing-count))) - (oset obj typing-count 0)) + (oset obj typing-count + (if (equal (this-command-keys) "\C-i") + (1+ (oref obj typing-count)) + 0)) (cond ((eq mode 'quiet) ;; Switch back to standard mode if user presses key more than 5 times. @@ -1730,7 +1732,7 @@ Display mechanism using tooltip for a list of possible completions.") (when semantic-idle-scheduler-verbose-flag (setq msg "[NO MATCH]")))) ;; Create the tooltip text. - (setq msg (concat msg (mapconcat 'identity completions "\n")))) + (setq msg (concat msg (mapconcat #'identity completions "\n")))) ;; Add any tail info. (setq msg (concat msg msg-tail)) ;; Display tooltip. @@ -1828,12 +1830,10 @@ text using overlay options.") (define-obsolete-function-alias 'semantic-displayor-set-completions #'semantic-displayer-set-completions "27.1") (cl-defmethod semantic-displayer-set-completions ((obj semantic-displayer-ghost) - table prefix) + _table _prefix) "Set the list of tags to be completed over to TABLE." (cl-call-next-method) - - (semantic-displayer-cleanup obj) - ) + (semantic-displayer-cleanup obj)) (define-obsolete-function-alias 'semantic-displayor-show-request @@ -2058,9 +2058,8 @@ prompts. these are calculated from the CONTEXT variable passed in." (semantic-displayer-traditional-with-focus-highlight) (with-current-buffer (oref context buffer) (goto-char (cdr (oref context bounds))) - (concat prompt (mapconcat 'identity syms ".") - (if syms "." "") - )) + (concat prompt (mapconcat #'identity syms ".") + (if syms "." ""))) nil inp history))) diff --git a/lisp/cedet/semantic/db-debug.el b/lisp/cedet/semantic/db-debug.el index c553ab499ae..d8f7034f03a 100644 --- a/lisp/cedet/semantic/db-debug.el +++ b/lisp/cedet/semantic/db-debug.el @@ -1,6 +1,6 @@ -;;; semantic/db-debug.el --- Extra level debugging routines for Semantic +;;; semantic/db-debug.el --- Extra level debugging routines for Semantic -*- lexical-binding: t; -*- -;;; Copyright (C) 2008-2021 Free Software Foundation, Inc. +;; Copyright (C) 2008-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> @@ -38,7 +38,7 @@ (data-debug-new-buffer "*SEMANTICDB*") (data-debug-insert-stuff-list db "*"))) -(defalias 'semanticdb-adebug-database-list 'semanticdb-dump-all-table-summary) +(defalias 'semanticdb-adebug-database-list #'semanticdb-dump-all-table-summary) (defun semanticdb-adebug-current-database () "Run ADEBUG on the current database." diff --git a/lisp/cedet/semantic/db-ebrowse.el b/lisp/cedet/semantic/db-ebrowse.el index 946f9ef6326..db37512de3c 100644 --- a/lisp/cedet/semantic/db-ebrowse.el +++ b/lisp/cedet/semantic/db-ebrowse.el @@ -1,4 +1,4 @@ -;;; semantic/db-ebrowse.el --- Semanticdb backend using ebrowse. +;;; semantic/db-ebrowse.el --- Semanticdb backend using ebrowse. -*- lexical-binding: t; -*- ;; Copyright (C) 2005-2021 Free Software Foundation, Inc. @@ -135,8 +135,8 @@ is specified by `semanticdb-default-save-directory'." (let* ((savein (semanticdb-ebrowse-file-for-directory dir)) (filebuff (get-buffer-create "*SEMANTICDB EBROWSE TMP*")) (files (directory-files (expand-file-name dir) t)) - (mma auto-mode-alist) - (regexp nil) + ;; (mma auto-mode-alist) + ;; (regexp nil) ) ;; Create the input to the ebrowse command (with-current-buffer filebuff @@ -227,7 +227,7 @@ warn instead." () "Search Ebrowse for symbols.") -(cl-defmethod semanticdb-needs-refresh-p ((table semanticdb-table-ebrowse)) +(cl-defmethod semanticdb-needs-refresh-p ((_table semanticdb-table-ebrowse)) "EBROWSE database do not need to be refreshed. JAVE: stub for needs-refresh, because, how do we know if BROWSE files @@ -274,7 +274,7 @@ For instance: /home/<username>/.semanticdb/!usr!include!BROWSE" (insert-file-contents B) (let ((ans nil) (efcn (symbol-function 'ebrowse-show-progress))) - (fset 'ebrowse-show-progress #'(lambda (&rest junk) nil)) + (fset 'ebrowse-show-progress #'(lambda (&rest _junk) nil)) (unwind-protect ;; Protect against errors w/ ebrowse (setq ans (list B (ebrowse-read))) ;; These items must always happen @@ -341,10 +341,10 @@ If there is no database for DIRECTORY available, then (while T (let* ((tree (car T)) - (class (ebrowse-ts-class tree)); root class of tree + ;;(class (ebrowse-ts-class tree)); root class of tree ;; Something funny going on with this file thing... - (filename (or (ebrowse-cs-source-file class) - (ebrowse-cs-file class))) + ;; (filename (or (ebrowse-cs-source-file class) + ;; (ebrowse-cs-file class))) ) (cond ((ebrowse-globals-tree-p tree) @@ -363,18 +363,18 @@ If there is no database for DIRECTORY available, then ;;; Filename based methods ;; -(defun semanticdb-ebrowse-add-globals-to-table (dbe tree) +(defun semanticdb-ebrowse-add-globals-to-table (_dbe tree) "For database DBE, add the ebrowse TREE into the table." (if (or (not (ebrowse-ts-p tree)) (not (ebrowse-globals-tree-p tree))) (signal 'wrong-type-argument (list 'ebrowse-ts-p tree))) (let* ((class (ebrowse-ts-class tree)) - (fname (or (ebrowse-cs-source-file class) - (ebrowse-cs-file class) - ;; Not def'd here, assume our current - ;; file - (concat default-directory "/unknown-proxy.hh"))) + ;; (fname (or (ebrowse-cs-source-file class) + ;; (ebrowse-cs-file class) + ;; ;; Not def'd here, assume our current + ;; ;; file + ;; (concat default-directory "/unknown-proxy.hh"))) (vars (ebrowse-ts-member-functions tree)) (fns (ebrowse-ts-member-variables tree)) (toks nil) @@ -573,7 +573,7 @@ return that." ;; how your new search routines are implemented. ;; (cl-defmethod semanticdb-find-tags-by-name-method - ((table semanticdb-table-ebrowse) name &optional tags) + ((_table semanticdb-table-ebrowse) _name &optional tags) "Find all tags named NAME in TABLE. Return a list of tags." ;;(message "semanticdb-find-tags-by-name-method name -- %s" name) @@ -588,7 +588,7 @@ Return a list of tags." ) (cl-defmethod semanticdb-find-tags-by-name-regexp-method - ((table semanticdb-table-ebrowse) regex &optional tags) + ((_table semanticdb-table-ebrowse) _regex &optional tags) "Find all tags with name matching REGEX in TABLE. Optional argument TAGS is a list of tags to search. Return a list of tags." @@ -598,7 +598,7 @@ Return a list of tags." )) (cl-defmethod semanticdb-find-tags-for-completion-method - ((table semanticdb-table-ebrowse) prefix &optional tags) + ((_table semanticdb-table-ebrowse) _prefix &optional tags) "In TABLE, find all occurrences of tags matching PREFIX. Optional argument TAGS is a list of tags to search. Returns a table of all matching tags." @@ -608,7 +608,7 @@ Returns a table of all matching tags." )) (cl-defmethod semanticdb-find-tags-by-class-method - ((table semanticdb-table-ebrowse) class &optional tags) + ((_table semanticdb-table-ebrowse) _class &optional tags) "In TABLE, find all occurrences of tags of CLASS. Optional argument TAGS is a list of tags to search. Returns a table of all matching tags." @@ -625,7 +625,7 @@ Returns a table of all matching tags." ;; (cl-defmethod semanticdb-deep-find-tags-by-name-method - ((table semanticdb-table-ebrowse) name &optional tags) + ((_table semanticdb-table-ebrowse) _name &optional _tags) "Find all tags name NAME in TABLE. Optional argument TAGS is a list of tags to search. Like `semanticdb-find-tags-by-name-method' for ebrowse." @@ -633,7 +633,7 @@ Like `semanticdb-find-tags-by-name-method' for ebrowse." (cl-call-next-method)) (cl-defmethod semanticdb-deep-find-tags-by-name-regexp-method - ((table semanticdb-table-ebrowse) regex &optional tags) + ((_table semanticdb-table-ebrowse) _regex &optional _tags) "Find all tags with name matching REGEX in TABLE. Optional argument TAGS is a list of tags to search. Like `semanticdb-find-tags-by-name-method' for ebrowse." @@ -641,7 +641,7 @@ Like `semanticdb-find-tags-by-name-method' for ebrowse." (cl-call-next-method)) (cl-defmethod semanticdb-deep-find-tags-for-completion-method - ((table semanticdb-table-ebrowse) prefix &optional tags) + ((_table semanticdb-table-ebrowse) _prefix &optional _tags) "In TABLE, find all occurrences of tags matching PREFIX. Optional argument TAGS is a list of tags to search. Like `semanticdb-find-tags-for-completion-method' for ebrowse." @@ -651,7 +651,7 @@ Like `semanticdb-find-tags-for-completion-method' for ebrowse." ;;; Advanced Searches ;; (cl-defmethod semanticdb-find-tags-external-children-of-type-method - ((table semanticdb-table-ebrowse) type &optional tags) + ((_table semanticdb-table-ebrowse) _type &optional tags) "Find all nonterminals which are child elements of TYPE Optional argument TAGS is a list of tags to search. Return a list of tags." diff --git a/lisp/cedet/semantic/db-el.el b/lisp/cedet/semantic/db-el.el index de84b978026..78339c375fb 100644 --- a/lisp/cedet/semantic/db-el.el +++ b/lisp/cedet/semantic/db-el.el @@ -1,6 +1,6 @@ -;;; semantic/db-el.el --- Semantic database extensions for Emacs Lisp +;;; semantic/db-el.el --- Semantic database extensions for Emacs Lisp -*- lexical-binding: t; -*- -;;; Copyright (C) 2002-2021 Free Software Foundation, Inc. +;; Copyright (C) 2002-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: tags @@ -53,7 +53,7 @@ It does not need refreshing." "Return nil, we never need a refresh." nil) -(cl-defmethod semanticdb-debug-info ((obj semanticdb-table-emacs-lisp)) +(cl-defmethod semanticdb-debug-info ((_obj semanticdb-table-emacs-lisp)) (list "(proxy)")) (cl-defmethod cl-print-object ((obj semanticdb-table-emacs-lisp) stream) diff --git a/lisp/cedet/semantic/db-file.el b/lisp/cedet/semantic/db-file.el index d99b94f49eb..c9007ac7a02 100644 --- a/lisp/cedet/semantic/db-file.el +++ b/lisp/cedet/semantic/db-file.el @@ -1,6 +1,6 @@ -;;; semantic/db-file.el --- Save a semanticdb to a cache file. +;;; semantic/db-file.el --- Save a semanticdb to a cache file. -*- lexical-binding: t; -*- -;;; Copyright (C) 2000-2005, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 2000-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: tags @@ -358,13 +358,13 @@ Uses `semanticdb-persistent-path' to determine the return value." (object-assoc (file-name-nondirectory filename) 'file (oref obj tables))) (cl-defmethod semanticdb-file-name-non-directory - ((dbclass (subclass semanticdb-project-database-file))) + ((_dbclass (subclass semanticdb-project-database-file))) "Return the file name DBCLASS will use. File name excludes any directory part." semanticdb-default-file-name) (cl-defmethod semanticdb-file-name-directory - ((dbclass (subclass semanticdb-project-database-file)) directory) + ((_dbclass (subclass semanticdb-project-database-file)) directory) "Return the relative directory to where DBCLASS will save its cache file. The returned path is related to DIRECTORY." (if semanticdb-default-save-directory diff --git a/lisp/cedet/semantic/db-find.el b/lisp/cedet/semantic/db-find.el index db88463bfd1..c96a426280e 100644 --- a/lisp/cedet/semantic/db-find.el +++ b/lisp/cedet/semantic/db-find.el @@ -1,4 +1,4 @@ -;;; semantic/db-find.el --- Searching through semantic databases. +;;; semantic/db-find.el --- Searching through semantic databases. -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2021 Free Software Foundation, Inc. @@ -209,14 +209,14 @@ This class will cache data derived during various searches.") ) (cl-defmethod semanticdb-synchronize ((idx semanticdb-find-search-index) - new-tags) + _new-tags) "Synchronize the search index IDX with some NEW-TAGS." ;; Reset our parts. (semantic-reset idx) ;; Notify dependants by clearing their indices. (semanticdb-notify-references (oref idx table) - (lambda (tab me) + (lambda (tab _me) (semantic-reset (semanticdb-get-table-index tab)))) ) @@ -230,7 +230,7 @@ This class will cache data derived during various searches.") ;; Notify dependants by clearing their indices. (semanticdb-notify-references (oref idx table) - (lambda (tab me) + (lambda (tab _me) (semantic-reset (semanticdb-get-table-index tab)))) ) ;; Else, not an include, by just a type. @@ -240,7 +240,7 @@ This class will cache data derived during various searches.") ;; Notify dependants by clearing their indices. (semanticdb-notify-references (oref idx table) - (lambda (tab me) + (lambda (tab _me) (let ((tab-idx (semanticdb-get-table-index tab))) ;; Not a full reset? (when (oref tab-idx type-cache) @@ -791,7 +791,8 @@ PREBUTTONTEXT is some text between prefix and the overlay button." (file (semantic-tag-file-name tag)) (str1 (format "%S %s" mode name)) (str2 (format " : %s" file)) - (tip nil)) + ;; (tip nil) + ) (insert prefix prebuttontext str1) (setq end (point)) (insert str2) @@ -807,7 +808,7 @@ PREBUTTONTEXT is some text between prefix and the overlay button." (put-text-property start end 'ddebug (cdr consdata)) (put-text-property start end 'ddebug-indent(length prefix)) (put-text-property start end 'ddebug-prefix prefix) - (put-text-property start end 'help-echo tip) + ;; (put-text-property start end 'help-echo tip) (put-text-property start end 'ddebug-function 'data-debug-insert-tag-parts-from-point) (insert "\n") @@ -1009,7 +1010,7 @@ is still made current." (when norm ;; The normalized tags can now be found based on that ;; tags table. - (condition-case foo + (condition-case nil (progn (semanticdb-set-buffer (car norm)) ;; Now reset ans diff --git a/lisp/cedet/semantic/db-global.el b/lisp/cedet/semantic/db-global.el index 2f40082d53c..6bdc7b3f750 100644 --- a/lisp/cedet/semantic/db-global.el +++ b/lisp/cedet/semantic/db-global.el @@ -1,4 +1,4 @@ -;;; semantic/db-global.el --- Semantic database extensions for GLOBAL +;;; semantic/db-global.el --- Semantic database extensions for GLOBAL -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2006, 2008-2021 Free Software Foundation, Inc. @@ -69,7 +69,8 @@ values." (let ((semanticdb--ih (mode-local-value mode 'semantic-init-mode-hook))) (eval `(setq-mode-local ,mode semantic-init-mode-hook - (cons 'semanticdb-enable-gnu-global-hook semanticdb--ih)))) + (cons 'semanticdb-enable-gnu-global-hook ',semanticdb--ih)) + t)) t ) ) @@ -114,7 +115,7 @@ if optional DONT-ERR-IF-NOT-AVAILABLE is non-nil; else throw an error." ) "A table for returning search results from GNU Global.") -(cl-defmethod semanticdb-debug-info ((obj semanticdb-table-global)) +(cl-defmethod semanticdb-debug-info ((_obj semanticdb-table-global)) (list "(proxy)")) (cl-defmethod cl-print-object ((obj semanticdb-table-global) stream) @@ -123,7 +124,7 @@ Adds the number of tags in this file to the object print name." (princ (eieio-object-name obj (semanticdb-debug-info obj)) stream)) -(cl-defmethod semanticdb-equivalent-mode ((table semanticdb-table-global) &optional buffer) +(cl-defmethod semanticdb-equivalent-mode ((_table semanticdb-table-global) &optional _buffer) "Return t, pretend that this table's mode is equivalent to BUFFER. Equivalent modes are specified by the `semantic-equivalent-major-modes' local variable." @@ -146,7 +147,7 @@ For each file hit, get the traditional semantic table from that file." (cl-call-next-method)) -(cl-defmethod semanticdb-file-table ((obj semanticdb-project-database-global) filename) +(cl-defmethod semanticdb-file-table ((obj semanticdb-project-database-global) _filename) "From OBJ, return FILENAME's associated table object." ;; We pass in "don't load". I wonder if we need to avoid that or not? (car (semanticdb-get-database-tables obj)) @@ -157,7 +158,7 @@ For each file hit, get the traditional semantic table from that file." ;; Only NAME based searches work with GLOBAL as that is all it tracks. ;; (cl-defmethod semanticdb-find-tags-by-name-method - ((table semanticdb-table-global) name &optional tags) + ((_table semanticdb-table-global) name &optional tags) "Find all tags named NAME in TABLE. Return a list of tags." (if tags @@ -174,7 +175,7 @@ Return a list of tags." ))) (cl-defmethod semanticdb-find-tags-by-name-regexp-method - ((table semanticdb-table-global) regex &optional tags) + ((_table semanticdb-table-global) regex &optional tags) "Find all tags with name matching REGEX in TABLE. Optional argument TAGS is a list of tags to search. Return a list of tags." @@ -187,7 +188,7 @@ Return a list of tags." ))) (cl-defmethod semanticdb-find-tags-for-completion-method - ((table semanticdb-table-global) prefix &optional tags) + ((_table semanticdb-table-global) prefix &optional tags) "In TABLE, find all occurrences of tags matching PREFIX. Optional argument TAGS is a list of tags to search. Returns a table of all matching tags." diff --git a/lisp/cedet/semantic/db-javascript.el b/lisp/cedet/semantic/db-javascript.el index 2b138866215..cad561e7967 100644 --- a/lisp/cedet/semantic/db-javascript.el +++ b/lisp/cedet/semantic/db-javascript.el @@ -1,4 +1,4 @@ -;;; semantic/db-javascript.el --- Semantic database extensions for javascript +;;; semantic/db-javascript.el --- Semantic database extensions for javascript -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. @@ -129,20 +129,20 @@ Create one of our special tables that can act as an intermediary." (cl-call-next-method) ) -(cl-defmethod semanticdb-file-table ((obj semanticdb-project-database-javascript) filename) +(cl-defmethod semanticdb-file-table ((obj semanticdb-project-database-javascript) _filename) "From OBJ, return FILENAME's associated table object." ;; NOTE: See not for `semanticdb-get-database-tables'. (car (semanticdb-get-database-tables obj)) ) -(cl-defmethod semanticdb-get-tags ((table semanticdb-table-javascript )) +(cl-defmethod semanticdb-get-tags ((_table semanticdb-table-javascript )) "Return the list of tags belonging to TABLE." ;; NOTE: Omniscient databases probably don't want to keep large tables ;; lolly-gagging about. Keep internal Emacs tables empty and ;; refer to alternate databases when you need something. semanticdb-javascript-tags) -(cl-defmethod semanticdb-equivalent-mode ((table semanticdb-table-javascript) &optional buffer) +(cl-defmethod semanticdb-equivalent-mode ((_table semanticdb-table-javascript) &optional buffer) "Return non-nil if TABLE's mode is equivalent to BUFFER. Equivalent modes are specified by the `semantic-equivalent-major-modes' local variable." @@ -193,7 +193,7 @@ database (if available.)" result)) (cl-defmethod semanticdb-find-tags-by-name-method - ((table semanticdb-table-javascript) name &optional tags) + ((_table semanticdb-table-javascript) name &optional tags) "Find all tags named NAME in TABLE. Return a list of tags." (if tags @@ -203,7 +203,7 @@ Return a list of tags." )) (cl-defmethod semanticdb-find-tags-by-name-regexp-method - ((table semanticdb-table-javascript) regex &optional tags) + ((_table semanticdb-table-javascript) regex &optional tags) "Find all tags with name matching REGEX in TABLE. Optional argument TAGS is a list of tags to search. Return a list of tags." @@ -214,7 +214,7 @@ Return a list of tags." )) (cl-defmethod semanticdb-find-tags-for-completion-method - ((table semanticdb-table-javascript) prefix &optional tags) + ((_table semanticdb-table-javascript) prefix &optional tags) "In TABLE, find all occurrences of tags matching PREFIX. Optional argument TAGS is a list of tags to search. Returns a table of all matching tags." @@ -224,7 +224,7 @@ Returns a table of all matching tags." )) (cl-defmethod semanticdb-find-tags-by-class-method - ((table semanticdb-table-javascript) class &optional tags) + ((_table semanticdb-table-javascript) _class &optional tags) "In TABLE, find all occurrences of tags of CLASS. Optional argument TAGS is a list of tags to search. Returns a table of all matching tags." @@ -268,7 +268,7 @@ Like `semanticdb-find-tags-for-completion-method' for javascript." ;;; Advanced Searches ;; (cl-defmethod semanticdb-find-tags-external-children-of-type-method - ((table semanticdb-table-javascript) type &optional tags) + ((_table semanticdb-table-javascript) _type &optional tags) "Find all nonterminals which are child elements of TYPE. Optional argument TAGS is a list of tags to search. Return a list of tags." diff --git a/lisp/cedet/semantic/db-mode.el b/lisp/cedet/semantic/db-mode.el index aa4634faa98..839dcb8172d 100644 --- a/lisp/cedet/semantic/db-mode.el +++ b/lisp/cedet/semantic/db-mode.el @@ -1,4 +1,4 @@ -;;; semantic/db-mode.el --- Semanticdb Minor Mode +;;; semantic/db-mode.el --- Semanticdb Minor Mode -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. diff --git a/lisp/cedet/semantic/db-ref.el b/lisp/cedet/semantic/db-ref.el index da09f9830a7..10108d39772 100644 --- a/lisp/cedet/semantic/db-ref.el +++ b/lisp/cedet/semantic/db-ref.el @@ -1,6 +1,6 @@ -;;; semantic/db-ref.el --- Handle cross-db file references +;;; semantic/db-ref.el --- Handle cross-db file references -*- lexical-binding: t; -*- -;;; Copyright (C) 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 2007-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> @@ -67,7 +67,7 @@ will be added to the database that INCLUDE-TAG refers to." (object-add-to-list refdbt 'db-refs dbt) t))) -(cl-defmethod semanticdb-check-references ((dbt semanticdb-abstract-table)) +(cl-defmethod semanticdb-check-references ((_dbt semanticdb-abstract-table)) "Check and cleanup references in the database DBT. Abstract tables would be difficult to reference." ;; Not sure how an abstract table can have references. @@ -109,7 +109,7 @@ refers to DBT will be removed." )) (setq refs (cdr refs))))) -(cl-defmethod semanticdb-refresh-references ((dbt semanticdb-abstract-table)) +(cl-defmethod semanticdb-refresh-references ((_dbt semanticdb-abstract-table)) "Refresh references to DBT in other files." ;; alternate tables can't be edited, so can't be changed. nil diff --git a/lisp/cedet/semantic/db-typecache.el b/lisp/cedet/semantic/db-typecache.el index 8c394cd7fa9..c0fee3b2bd9 100644 --- a/lisp/cedet/semantic/db-typecache.el +++ b/lisp/cedet/semantic/db-typecache.el @@ -1,4 +1,4 @@ -;;; semantic/db-typecache.el --- Manage Datatypes +;;; semantic/db-typecache.el --- Manage Datatypes -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -74,14 +74,14 @@ Said object must support `semantic-reset' methods.") (oset tc stream nil) - (mapc 'semantic-reset (oref tc dependants)) + (mapc #'semantic-reset (oref tc dependants)) (oset tc dependants nil) ) (cl-defmethod semanticdb-typecache-notify-reset ((tc semanticdb-typecache)) "Do a reset from a notify from a table we depend on." (oset tc includestream nil) - (mapc 'semantic-reset (oref tc dependants)) + (mapc #'semantic-reset (oref tc dependants)) (oset tc dependants nil) ) @@ -90,7 +90,7 @@ Said object must support `semantic-reset' methods.") "Reset the typecache based on a partial reparse." (when (semantic-find-tags-by-class 'include new-tags) (oset tc includestream nil) - (mapc 'semantic-reset (oref tc dependants)) + (mapc #'semantic-reset (oref tc dependants)) (oset tc dependants nil) ) @@ -167,15 +167,15 @@ If there is no table, create one, and fill it in." (oset tc stream nil) ) -(cl-defmethod semanticdb-synchronize ((cache semanticdb-database-typecache) - new-tags) +(cl-defmethod semanticdb-synchronize ((_cache semanticdb-database-typecache) + _new-tags) "Synchronize a CACHE with some NEW-TAGS." - ) + nil) -(cl-defmethod semanticdb-partial-synchronize ((cache semanticdb-database-typecache) - new-tags) +(cl-defmethod semanticdb-partial-synchronize ((_cache semanticdb-database-typecache) + _new-tags) "Synchronize a CACHE with some changed NEW-TAGS." - ) + nil) (cl-defmethod semanticdb-get-typecache ((db semanticdb-project-database)) "Retrieve the typecache from the semantic database DB. @@ -312,7 +312,7 @@ If TAG has fully qualified names, expand it to a series of nested namespaces instead." tag) -(cl-defmethod semanticdb-typecache-file-tags ((table semanticdb-abstract-table)) +(cl-defmethod semanticdb-typecache-file-tags ((_table semanticdb-abstract-table)) "No tags available from non-file based tables." nil) @@ -338,7 +338,7 @@ all included files." (oref cache filestream) )) -(cl-defmethod semanticdb-typecache-include-tags ((table semanticdb-abstract-table)) +(cl-defmethod semanticdb-typecache-include-tags ((_table semanticdb-abstract-table)) "No tags available from non-file based tables." nil) @@ -611,7 +611,7 @@ If there isn't one, create it. (require 'data-debug) (let* ((tab semanticdb-current-table) (idx (semanticdb-get-table-index tab)) - (junk (oset idx type-cache nil)) ;; flush! + (_ (oset idx type-cache nil)) ;; flush! (start (current-time)) (tc (semanticdb-typecache-for-database (oref tab parent-db))) (end (current-time)) diff --git a/lisp/cedet/semantic/debug.el b/lisp/cedet/semantic/debug.el index ce4afbbf26d..4f96746166b 100644 --- a/lisp/cedet/semantic/debug.el +++ b/lisp/cedet/semantic/debug.el @@ -1,4 +1,4 @@ -;;; semantic/debug.el --- Language Debugger framework +;;; semantic/debug.el --- Language Debugger framework -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2005, 2008-2021 Free Software Foundation, Inc. @@ -265,12 +265,12 @@ on different types of return values." ) "One frame representation.") -(cl-defmethod semantic-debug-frame-highlight ((frame semantic-debug-frame)) +(cl-defmethod semantic-debug-frame-highlight ((_frame semantic-debug-frame)) "Highlight one parser frame." ) -(cl-defmethod semantic-debug-frame-info ((frame semantic-debug-frame)) +(cl-defmethod semantic-debug-frame-info ((_frame semantic-debug-frame)) "Display info about this one parser frame." ) @@ -279,21 +279,21 @@ on different types of return values." ;; (defvar semantic-debug-mode-map (let ((km (make-sparse-keymap))) - (define-key km "n" 'semantic-debug-next) - (define-key km " " 'semantic-debug-next) - (define-key km "s" 'semantic-debug-step) - (define-key km "u" 'semantic-debug-up) - (define-key km "d" 'semantic-debug-down) - (define-key km "f" 'semantic-debug-fail-match) - (define-key km "h" 'semantic-debug-print-state) - (define-key km "s" 'semantic-debug-jump-to-source) - (define-key km "p" 'semantic-debug-jump-to-parser) - (define-key km "q" 'semantic-debug-quit) - (define-key km "a" 'semantic-debug-abort) - (define-key km "g" 'semantic-debug-go) - (define-key km "b" 'semantic-debug-set-breakpoint) + (define-key km "n" #'semantic-debug-next) + (define-key km " " #'semantic-debug-next) + (define-key km "s" #'semantic-debug-step) + (define-key km "u" #'semantic-debug-up) + (define-key km "d" #'semantic-debug-down) + (define-key km "f" #'semantic-debug-fail-match) + (define-key km "h" #'semantic-debug-print-state) + (define-key km "s" #'semantic-debug-jump-to-source) + (define-key km "p" #'semantic-debug-jump-to-parser) + (define-key km "q" #'semantic-debug-quit) + (define-key km "a" #'semantic-debug-abort) + (define-key km "g" #'semantic-debug-go) + (define-key km "b" #'semantic-debug-set-breakpoint) ;; Some boring bindings. - (define-key km "e" 'eval-expression) + (define-key km "e" #'eval-expression) km) "Keymap used when in semantic-debug-node.") @@ -514,49 +514,49 @@ by overriding one of the command methods. Be sure to use down to your parser later." :abstract t) -(cl-defmethod semantic-debug-parser-next ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-next ((_parser semantic-debug-parser)) "Execute next for this PARSER." (setq semantic-debug-user-command 'next) ) -(cl-defmethod semantic-debug-parser-step ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-step ((_parser semantic-debug-parser)) "Execute a step for this PARSER." (setq semantic-debug-user-command 'step) ) -(cl-defmethod semantic-debug-parser-go ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-go ((_parser semantic-debug-parser)) "Continue execution in this PARSER until the next breakpoint." (setq semantic-debug-user-command 'go) ) -(cl-defmethod semantic-debug-parser-fail ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-fail ((_parser semantic-debug-parser)) "Continue execution in this PARSER until the next breakpoint." (setq semantic-debug-user-command 'fail) ) -(cl-defmethod semantic-debug-parser-quit ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-quit ((_parser semantic-debug-parser)) "Continue execution in this PARSER until the next breakpoint." (setq semantic-debug-user-command 'quit) ) -(cl-defmethod semantic-debug-parser-abort ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-abort ((_parser semantic-debug-parser)) "Continue execution in this PARSER until the next breakpoint." (setq semantic-debug-user-command 'abort) ) -(cl-defmethod semantic-debug-parser-print-state ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-print-state ((_parser semantic-debug-parser)) "Print state for this PARSER at the current breakpoint." (with-slots (current-frame) semantic-debug-current-interface (when current-frame (semantic-debug-frame-info current-frame) ))) -(cl-defmethod semantic-debug-parser-break ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-break ((_parser semantic-debug-parser)) "Set a breakpoint for this PARSER." ) ;; Stack stuff -(cl-defmethod semantic-debug-parser-frames ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-frames ((_parser semantic-debug-parser)) "Return a list of frames for the current parser. A frame is of the form: ( .. .what ? .. ) diff --git a/lisp/cedet/semantic/decorate.el b/lisp/cedet/semantic/decorate.el index 53c54ab4cc8..3e6651df152 100644 --- a/lisp/cedet/semantic/decorate.el +++ b/lisp/cedet/semantic/decorate.el @@ -1,7 +1,6 @@ -;;; semantic/decorate.el --- Utilities for decorating/highlighting tokens. +;;; semantic/decorate.el --- Utilities for decorating/highlighting tokens. -*- lexical-binding: t; -*- -;;; Copyright (C) 1999-2003, 2005-2007, 2009-2021 Free Software -;;; Foundation, Inc. +;; Copyright (C) 1999-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: syntax @@ -51,7 +50,7 @@ Optional FACE specifies the face to use." )) ;;; Momentary Highlighting - One line -(defun semantic-momentary-highlight-one-tag-line (tag &optional face) +(defun semantic-momentary-highlight-one-tag-line (tag &optional _face) "Highlight the first line of TAG, unhighlighting before next command. Optional argument FACE specifies the face to do the highlighting." (save-excursion @@ -88,7 +87,7 @@ If VISIBLE is non-nil, make the text visible." (overlay-get (semantic-tag-overlay tag) 'invisible)) (defun semantic-overlay-signal-read-only - (overlay after start end &optional len) + (overlay after start end &optional _len) "Hook used in modification hooks to prevent modification. Allows deletion of the entire text. Argument OVERLAY, AFTER, START, END, and LEN are passed in by the system." @@ -261,7 +260,7 @@ nil implies the tag should be fully shown." (declare-function semantic-current-tag "semantic/find") -(defun semantic-set-tag-folded-isearch (overlay) +(defun semantic-set-tag-folded-isearch (_overlay) "Called by isearch if it discovers text in the folded region. OVERLAY is passed in by isearch." (semantic-set-tag-folded (semantic-current-tag) nil) diff --git a/lisp/cedet/semantic/decorate/include.el b/lisp/cedet/semantic/decorate/include.el index 851a2c46a9e..a3bf4e252f7 100644 --- a/lisp/cedet/semantic/decorate/include.el +++ b/lisp/cedet/semantic/decorate/include.el @@ -55,7 +55,7 @@ Used by the decoration style: `semantic-decoration-on-includes'." (defvar semantic-decoration-on-include-map (let ((km (make-sparse-keymap))) - (define-key km semantic-decoration-mouse-3 'semantic-decoration-include-menu) + (define-key km semantic-decoration-mouse-3 #'semantic-decoration-include-menu) km) "Keymap used on includes.") @@ -114,7 +114,7 @@ Used by the decoration style: `semantic-decoration-on-unknown-includes'." (defvar semantic-decoration-on-unknown-include-map (let ((km (make-sparse-keymap))) ;(define-key km [ mouse-2 ] 'semantic-decoration-unknown-include-describe) - (define-key km semantic-decoration-mouse-3 'semantic-decoration-unknown-include-menu) + (define-key km semantic-decoration-mouse-3 #'semantic-decoration-unknown-include-menu) km) "Keymap used on unparsed includes.") @@ -169,7 +169,7 @@ Used by the decoration style: `semantic-decoration-on-fileless-includes'." (defvar semantic-decoration-on-fileless-include-map (let ((km (make-sparse-keymap))) ;(define-key km [ mouse-2 ] 'semantic-decoration-fileless-include-describe) - (define-key km semantic-decoration-mouse-3 'semantic-decoration-fileless-include-menu) + (define-key km semantic-decoration-mouse-3 #'semantic-decoration-fileless-include-menu) km) "Keymap used on unparsed includes.") @@ -223,7 +223,7 @@ Used by the decoration style: `semantic-decoration-on-unparsed-includes'." (defvar semantic-decoration-on-unparsed-include-map (let ((km (make-sparse-keymap))) - (define-key km semantic-decoration-mouse-3 'semantic-decoration-unparsed-include-menu) + (define-key km semantic-decoration-mouse-3 #'semantic-decoration-unparsed-include-menu) km) "Keymap used on unparsed includes.") diff --git a/lisp/cedet/semantic/decorate/mode.el b/lisp/cedet/semantic/decorate/mode.el index 89cc9304d47..78950159199 100644 --- a/lisp/cedet/semantic/decorate/mode.el +++ b/lisp/cedet/semantic/decorate/mode.el @@ -264,9 +264,9 @@ non-nil if the minor mode is enabled." (buffer-name))) ;; Add hooks (add-hook 'semantic-after-partial-cache-change-hook - 'semantic-decorate-tags-after-partial-reparse nil t) + #'semantic-decorate-tags-after-partial-reparse nil t) (add-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-decorate-tags-after-full-reparse nil t) + #'semantic-decorate-tags-after-full-reparse nil t) ;; Add decorations to available tags. The above hooks ensure ;; that new tags will be decorated when they become available. ;; However, don't do this immediately, because EDE will be @@ -282,9 +282,9 @@ non-nil if the minor mode is enabled." (semantic-decorate-flush-decorations) ;; Remove hooks (remove-hook 'semantic-after-partial-cache-change-hook - 'semantic-decorate-tags-after-partial-reparse t) + #'semantic-decorate-tags-after-partial-reparse t) (remove-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-decorate-tags-after-full-reparse t))) + #'semantic-decorate-tags-after-full-reparse t))) (semantic-add-minor-mode 'semantic-decoration-mode "") @@ -350,13 +350,11 @@ Return non-nil if the decoration style is enabled." (defun semantic-decoration-build-style-menu (style) "Build a menu item for controlling a specific decoration STYLE." - (vector (car style) - `(lambda () (interactive) - (semantic-toggle-decoration-style - ,(car style))) - :style 'toggle - :selected `(semantic-decoration-style-enabled-p ,(car style)) - )) + (let ((s (car style))) + (vector s + (lambda () (interactive) (semantic-toggle-decoration-style s)) + :style 'toggle + :selected `(semantic-decoration-style-enabled-p ',s)))) (defun semantic-build-decoration-mode-menu (&rest _ignore) "Create a menu listing all the known decorations for toggling. diff --git a/lisp/cedet/semantic/dep.el b/lisp/cedet/semantic/dep.el index db8be5ecf47..efebe21a945 100644 --- a/lisp/cedet/semantic/dep.el +++ b/lisp/cedet/semantic/dep.el @@ -1,4 +1,4 @@ -;;; semantic/dep.el --- Methods for tracking dependencies (include files) +;;; semantic/dep.el --- Methods for tracking dependencies (include files) -*- lexical-binding: t; -*- ;; Copyright (C) 2006-2021 Free Software Foundation, Inc. @@ -123,12 +123,12 @@ Changes made by this function are not persistent." (if (not mode) (setq mode major-mode)) (let ((dirtmp (file-name-as-directory dir)) (value - (mode-local-value mode 'semantic-dependency-system-include-path)) - ) - (add-to-list 'value dirtmp t) + (mode-local-value mode 'semantic-dependency-system-include-path))) (eval `(setq-mode-local ,mode - semantic-dependency-system-include-path value)) - )) + semantic-dependency-system-include-path + ',(if (member dirtmp value) value + (append value (list dirtmp)))) + t))) ;;;###autoload (defun semantic-remove-system-include (dir &optional mode) @@ -146,10 +146,10 @@ Changes made by this function are not persistent." (value (mode-local-value mode 'semantic-dependency-system-include-path)) ) - (setq value (delete dirtmp value)) + (setq value (remove dirtmp value)) (eval `(setq-mode-local ,mode semantic-dependency-system-include-path - value)) - )) + ',value) + t))) ;;;###autoload (defun semantic-reset-system-include (&optional mode) @@ -157,10 +157,10 @@ Changes made by this function are not persistent." Modifies a mode-local version of `semantic-dependency-system-include-path'." (interactive) - (if (not mode) (setq mode major-mode)) - (eval `(setq-mode-local ,mode semantic-dependency-system-include-path - nil)) - ) + (eval `(setq-mode-local ,(or mode major-mode) + semantic-dependency-system-include-path + nil) + t)) ;;;###autoload (defun semantic-customize-system-include-path (&optional mode) diff --git a/lisp/cedet/semantic/doc.el b/lisp/cedet/semantic/doc.el index d4dd9286421..413ed83a154 100644 --- a/lisp/cedet/semantic/doc.el +++ b/lisp/cedet/semantic/doc.el @@ -1,4 +1,4 @@ -;;; semantic/doc.el --- Routines for documentation strings +;;; semantic/doc.el --- Routines for documentation strings -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2003, 2005, 2008-2021 Free Software Foundation, ;; Inc. @@ -85,7 +85,7 @@ just the lexical token and not the string." )) (define-obsolete-function-alias 'semantic-documentation-comment-preceeding-tag - 'semantic-documentation-comment-preceding-tag + #'semantic-documentation-comment-preceding-tag "25.1") (defun semantic-doc-snarf-comment-for-tag (nosnarf) diff --git a/lisp/cedet/semantic/ede-grammar.el b/lisp/cedet/semantic/ede-grammar.el index 64fc07fe1bb..6bb83526f6c 100644 --- a/lisp/cedet/semantic/ede-grammar.el +++ b/lisp/cedet/semantic/ede-grammar.el @@ -1,4 +1,4 @@ -;;; semantic/ede-grammar.el --- EDE support for Semantic Grammar Files +;;; semantic/ede-grammar.el --- EDE support for Semantic Grammar Files -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc. @@ -30,6 +30,7 @@ (require 'ede/pconf) (require 'ede/proj-elisp) (require 'semantic/grammar) +(eval-when-compile (require 'cl-lib)) ;;; Code: (defclass semantic-ede-proj-target-grammar (ede-proj-target-elisp) @@ -118,7 +119,7 @@ For Emacs Lisp, return addsuffix command on source files." "Compile Emacs Lisp programs.") ;;; Target options. -(cl-defmethod ede-buffer-mine ((this semantic-ede-proj-target-grammar) buffer) +(cl-defmethod ede-buffer-mine ((_this semantic-ede-proj-target-grammar) buffer) "Return t if object THIS lays claim to the file in BUFFER. Lays claim to all -by.el, and -wy.el files." ;; We need to be a little more careful than this, but at the moment it @@ -130,7 +131,7 @@ Lays claim to all -by.el, and -wy.el files." (cl-defmethod project-compile-target ((obj semantic-ede-proj-target-grammar)) "Compile all sources in a Lisp target OBJ." - (let* ((cb (current-buffer)) + (let* (;; (cb (current-buffer)) (proj (ede-target-parent obj)) (default-directory (oref proj directory)) (comp 0) @@ -141,11 +142,10 @@ Lays claim to all -by.el, and -wy.el files." (fname (progn (string-match ".*/\\(.+\\.el\\)" package) (match-string 1 package))) (src (ede-expand-filename obj fname)) - (csrc (concat (file-name-sans-extension src) ".elc"))) - (with-no-warnings - (if (eq (byte-recompile-file src nil 0) t) - (setq comp (1+ comp)) - (setq utd (1+ utd))))))) + ;; (csrc (concat (file-name-sans-extension src) ".elc")) + ) + (cl-incf (if (eq (byte-recompile-file src nil 0) t) + comp utd))))) (oref obj source)) (message "All Semantic Grammar sources are up to date in %s" (eieio-object-name obj)) (cons comp utd))) diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el index 4594d7f6969..0cca156454b 100644 --- a/lisp/cedet/semantic/edit.el +++ b/lisp/cedet/semantic/edit.el @@ -1,4 +1,4 @@ -;;; semantic/edit.el --- Edit Management for Semantic +;;; semantic/edit.el --- Edit Management for Semantic -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2021 Free Software Foundation, Inc. @@ -157,7 +157,7 @@ Optional argument BUFFER is the buffer to search for changes in." (sort ret #'(lambda (a b) (< (overlay-start a) (overlay-start b))))))) -(defun semantic-edits-change-function-handle-changes (start end length) +(defun semantic-edits-change-function-handle-changes (start end _length) "Run whenever a buffer controlled by `semantic-mode' change. Tracks when and how the buffer is re-parsed. Argument START, END, and LENGTH specify the bounds of the change." @@ -356,7 +356,7 @@ See `semantic-edits-change-leaf-tag' for details on parents." start end))) (parent nil) (overlapped-tags nil) - inner-start inner-end + inner-end ;; inner-start (list-to-search nil)) ;; By the time this is already called, we know that it is ;; not a leaf change, nor a between tag change. That leaves @@ -370,7 +370,7 @@ See `semantic-edits-change-leaf-tag' for details on parents." (progn ;; We encompass one whole change. (setq overlapped-tags (list (car tags)) - inner-start (semantic-tag-start (car tags)) + ;; inner-start (semantic-tag-start (car tags)) inner-end (semantic-tag-end (car tags)) tags (cdr tags)) ;; Keep looping while tags are inside the change. @@ -386,13 +386,14 @@ See `semantic-edits-change-leaf-tag' for details on parents." ;; This is a parent. Drop the children found ;; so far. (setq overlapped-tags (list (car tags)) - inner-start (semantic-tag-start (car tags)) + ;; inner-start (semantic-tag-start (car tags)) inner-end (semantic-tag-end (car tags)) ) ;; It is not a parent encompassing tag (setq overlapped-tags (cons (car tags) overlapped-tags) - inner-start (semantic-tag-start (car tags)))) + ;; inner-start (semantic-tag-start (car tags)) + )) (setq tags (cdr tags))) (if (not tags) ;; There are no tags left, and all tags originally @@ -533,6 +534,7 @@ This function is for internal use by `semantic-edits-incremental-parser'." ;query this when debugging to find ;source of bugs. ) + (ignore last-cond) ;; Don't warn about the var not being used. (or changes ;; If we were called, and there are no changes, then we ;; don't know what to do. Force a full reparse. diff --git a/lisp/cedet/semantic/find.el b/lisp/cedet/semantic/find.el index 706892b4861..17fb20fa0a0 100644 --- a/lisp/cedet/semantic/find.el +++ b/lisp/cedet/semantic/find.el @@ -1,4 +1,4 @@ -;;; semantic/find.el --- Search routines for Semantic +;;; semantic/find.el --- Search routines for Semantic -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2005, 2008-2021 Free Software Foundation, Inc. @@ -583,7 +583,7 @@ Optional argument SEARCH-PARTS and SEARCH-INCLUDES are passed to ) (defun semantic-brute-find-tag-by-function - (function streamorbuffer &optional search-parts search-includes) + (function streamorbuffer &optional search-parts _search-includes) "Find all tags for which FUNCTION's value is non-nil within STREAMORBUFFER. FUNCTION must return non-nil if an element of STREAM will be included in the new list. @@ -620,7 +620,7 @@ This parameter hasn't be active for a while and is obsolete." nl)) (defun semantic-brute-find-first-tag-by-function - (function streamorbuffer &optional search-parts search-includes) + (function streamorbuffer &optional _search-parts _search-includes) "Find the first tag which FUNCTION match within STREAMORBUFFER. FUNCTION must return non-nil if an element of STREAM will be included in the new list. diff --git a/lisp/cedet/semantic/format.el b/lisp/cedet/semantic/format.el index 8927ccde843..a68ef8064d1 100644 --- a/lisp/cedet/semantic/format.el +++ b/lisp/cedet/semantic/format.el @@ -1,4 +1,4 @@ -;;; semantic/format.el --- Routines for formatting tags +;;; semantic/format.el --- Routines for formatting tags -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc. @@ -162,7 +162,7 @@ COLOR specifies if color should be used." (car args) nil color 'variable)) out) (setq args (cdr args))) - (mapconcat 'identity (nreverse out) semantic-function-argument-separator) + (mapconcat #'identity (nreverse out) semantic-function-argument-separator) )) ;;; Data Type @@ -200,7 +200,7 @@ Argument COLOR specifies to colorize the text." ;;; Abstract formatting functions ;; -(defun semantic-format-tag-prin1 (tag &optional parent color) +(defun semantic-format-tag-prin1 (tag &optional _parent _color) "Convert TAG to a string that is the print name for TAG. PARENT and COLOR are ignored." (format "%S" tag)) @@ -237,7 +237,7 @@ The name is the shortest possible representation. Optional argument PARENT is the parent type if TAG is a detail. Optional argument COLOR means highlight the prototype with font-lock colors.") -(defun semantic-format-tag-name-default (tag &optional parent color) +(defun semantic-format-tag-name-default (tag &optional _parent color) "Return an abbreviated string describing TAG. Optional argument PARENT is the parent type if TAG is a detail. Optional argument COLOR means highlight the prototype with font-lock colors." @@ -500,7 +500,7 @@ Optional argument COLOR means highlight the prototype with font-lock colors." args (if (eq class 'type) "}" ")")))) (when mods - (setq mods (concat (mapconcat 'identity mods " ") " "))) + (setq mods (concat (mapconcat #'identity mods " ") " "))) (concat (or mods "") (if type (concat type " ")) name diff --git a/lisp/cedet/semantic/fw.el b/lisp/cedet/semantic/fw.el index bdead99d68b..2a3b0f5fb7d 100644 --- a/lisp/cedet/semantic/fw.el +++ b/lisp/cedet/semantic/fw.el @@ -1,6 +1,6 @@ -;;; semantic/fw.el --- Framework for Semantic +;;; semantic/fw.el --- Framework for Semantic -*- lexical-binding: t; -*- -;;; Copyright (C) 1999-2021 Free Software Foundation, Inc. +;; Copyright (C) 1999-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> @@ -34,29 +34,29 @@ ;;; Compatibility ;; -(define-obsolete-function-alias 'semantic-overlay-live-p 'overlay-buffer "27.1") -(define-obsolete-function-alias 'semantic-make-overlay 'make-overlay "27.1") -(define-obsolete-function-alias 'semantic-overlay-put 'overlay-put "27.1") -(define-obsolete-function-alias 'semantic-overlay-get 'overlay-get "27.1") +(define-obsolete-function-alias 'semantic-overlay-live-p #'overlay-buffer "27.1") +(define-obsolete-function-alias 'semantic-make-overlay #'make-overlay "27.1") +(define-obsolete-function-alias 'semantic-overlay-put #'overlay-put "27.1") +(define-obsolete-function-alias 'semantic-overlay-get #'overlay-get "27.1") (define-obsolete-function-alias 'semantic-overlay-properties - 'overlay-properties "27.1") -(define-obsolete-function-alias 'semantic-overlay-move 'move-overlay "27.1") -(define-obsolete-function-alias 'semantic-overlay-delete 'delete-overlay "27.1") -(define-obsolete-function-alias 'semantic-overlays-at 'overlays-at "27.1") -(define-obsolete-function-alias 'semantic-overlays-in 'overlays-in "27.1") -(define-obsolete-function-alias 'semantic-overlay-buffer 'overlay-buffer "27.1") -(define-obsolete-function-alias 'semantic-overlay-start 'overlay-start "27.1") -(define-obsolete-function-alias 'semantic-overlay-end 'overlay-end "27.1") + #'overlay-properties "27.1") +(define-obsolete-function-alias 'semantic-overlay-move #'move-overlay "27.1") +(define-obsolete-function-alias 'semantic-overlay-delete #'delete-overlay "27.1") +(define-obsolete-function-alias 'semantic-overlays-at #'overlays-at "27.1") +(define-obsolete-function-alias 'semantic-overlays-in #'overlays-in "27.1") +(define-obsolete-function-alias 'semantic-overlay-buffer #'overlay-buffer "27.1") +(define-obsolete-function-alias 'semantic-overlay-start #'overlay-start "27.1") +(define-obsolete-function-alias 'semantic-overlay-end #'overlay-end "27.1") (define-obsolete-function-alias 'semantic-overlay-next-change - 'next-overlay-change "27.1") + #'next-overlay-change "27.1") (define-obsolete-function-alias 'semantic-overlay-previous-change - 'previous-overlay-change "27.1") -(define-obsolete-function-alias 'semantic-overlay-lists 'overlay-lists "27.1") -(define-obsolete-function-alias 'semantic-overlay-p 'overlayp "27.1") -(define-obsolete-function-alias 'semantic-read-event 'read-event "27.1") -(define-obsolete-function-alias 'semantic-popup-menu 'popup-menu "27.1") + #'previous-overlay-change "27.1") +(define-obsolete-function-alias 'semantic-overlay-lists #'overlay-lists "27.1") +(define-obsolete-function-alias 'semantic-overlay-p #'overlayp "27.1") +(define-obsolete-function-alias 'semantic-read-event #'read-event "27.1") +(define-obsolete-function-alias 'semantic-popup-menu #'popup-menu "27.1") (define-obsolete-function-alias 'semantic-buffer-local-value - 'buffer-local-value "27.1") + #'buffer-local-value "27.1") (defun semantic-event-window (event) "Extract the window from EVENT." @@ -68,11 +68,11 @@ ;; Since Emacs 22 major mode functions should use `run-mode-hooks' to ;; run major mode hooks. -(define-obsolete-function-alias 'semantic-run-mode-hooks 'run-mode-hooks "28.1") +(define-obsolete-function-alias 'semantic-run-mode-hooks #'run-mode-hooks "28.1") ;; Fancy compat usage now handled in cedet-compat (define-obsolete-function-alias 'semantic-subst-char-in-string - 'subst-char-in-string "28.1") + #'subst-char-in-string "28.1") (defun semantic-delete-overlay-maybe (overlay) "Delete OVERLAY if it is a semantic token overlay." @@ -111,7 +111,7 @@ Possible Lifespans are: (setq semantic-cache-data-overlays (cons o semantic-cache-data-overlays)) ;;(message "Adding to cache: %s" o) - (add-hook 'post-command-hook 'semantic-cache-data-post-command-hook) + (add-hook 'post-command-hook #'semantic-cache-data-post-command-hook) )) (defun semantic-cache-data-post-command-hook () @@ -137,7 +137,7 @@ Remove self from `post-command-hook' if it is empty." ;; Remove ourselves if we have removed all overlays. (unless semantic-cache-data-overlays (remove-hook 'post-command-hook - 'semantic-cache-data-post-command-hook))) + #'semantic-cache-data-post-command-hook))) (defun semantic-get-cache-data (name &optional point) "Get cached data with NAME from optional POINT." @@ -254,7 +254,7 @@ FUNCTION does not have arguments. When FUNCTION is entered `current-buffer' is a selected Semantic enabled buffer." (mode-local-map-file-buffers function #'semantic-active-p)) -(defalias 'semantic-map-mode-buffers 'mode-local-map-mode-buffers) +(defalias 'semantic-map-mode-buffers #'mode-local-map-mode-buffers) (defun semantic-install-function-overrides (overrides &optional transient) "Install the function OVERRIDES in the specified environment. @@ -318,6 +318,12 @@ calling this one." ;;; Special versions of Find File ;; +(defvar recentf-exclude) +(defvar semantic-init-hook) +(defvar ede-auto-add-method) +(defvar flymake-start-syntax-check-on-find-file) +(defvar auto-insert) + (defun semantic-find-file-noselect (file &optional nowarn rawfile wildcards) "Call `find-file-noselect' with various features turned off. Use this when referencing a file that will be soon deleted. diff --git a/lisp/cedet/semantic/html.el b/lisp/cedet/semantic/html.el index 658d218a4a3..ad5d2c798fb 100644 --- a/lisp/cedet/semantic/html.el +++ b/lisp/cedet/semantic/html.el @@ -1,4 +1,4 @@ -;;; semantic/html.el --- Semantic details for html files +;;; semantic/html.el --- Semantic details for html files -*- lexical-binding: t; -*- ;; Copyright (C) 2004-2005, 2007-2021 Free Software Foundation, Inc. @@ -59,14 +59,14 @@ "Alist of sectioning commands and their relative level.") (define-mode-local-override semantic-parse-region - html-mode (&rest ignore) + html-mode (&rest _ignore) "Parse the current html buffer for semantic tags. IGNORE any arguments. Always parse the whole buffer. Each tag returned is of the form: (\"NAME\" section (:members CHILDREN)) or (\"NAME\" anchor)" - (mapcar 'semantic-html-expand-tag + (mapcar #'semantic-html-expand-tag (semantic-html-parse-headings))) (define-mode-local-override semantic-parse-changes @@ -79,7 +79,7 @@ or (let ((chil (semantic-html-components tag))) (if chil (semantic-tag-put-attribute - tag :members (mapcar 'semantic-html-expand-tag chil))) + tag :members (mapcar #'semantic-html-expand-tag chil))) (car (semantic--tag-expand tag)))) (defun semantic-html-components (tag) @@ -233,7 +233,7 @@ tag with greater section value than LEVEL is found." ;; This will use our parser. (setq semantic-parser-name "HTML" semantic--parse-table t - imenu-create-index-function 'semantic-create-imenu-index + imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character ">" semantic-type-relation-separator-character '(":") semantic-symbol->name-assoc-list '((section . "Section") diff --git a/lisp/cedet/semantic/ia-sb.el b/lisp/cedet/semantic/ia-sb.el index b132d41cd4a..12a2f1db92a 100644 --- a/lisp/cedet/semantic/ia-sb.el +++ b/lisp/cedet/semantic/ia-sb.el @@ -1,7 +1,6 @@ -;;; semantic/ia-sb.el --- Speedbar analysis display interactor +;;; semantic/ia-sb.el --- Speedbar analysis display interactor -*- lexical-binding: t; -*- -;;; Copyright (C) 2002-2004, 2006, 2008-2021 Free Software Foundation, -;;; Inc. +;; Copyright (C) 2002-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: syntax @@ -30,18 +29,14 @@ (require 'speedbar) ;;; Code: -(defvar semantic-ia-sb-key-map nil +(defvar semantic-ia-sb-key-map + (let ((map (speedbar-make-specialized-keymap))) + ;; Basic features. + (define-key map "\C-m" #'speedbar-edit-line) + (define-key map "I" #'semantic-ia-sb-show-tag-info) + map) "Keymap used when in semantic analysis display mode.") -(if semantic-ia-sb-key-map - nil - (setq semantic-ia-sb-key-map (speedbar-make-specialized-keymap)) - - ;; Basic features. - (define-key semantic-ia-sb-key-map "\C-m" 'speedbar-edit-line) - (define-key semantic-ia-sb-key-map "I" 'semantic-ia-sb-show-tag-info) - ) - (defvar semantic-ia-sb-easymenu-definition '( "---" ; [ "Expand" speedbar-expand-line nil ] @@ -75,7 +70,7 @@ list of possible completions." (speedbar-change-initial-expansion-list "Analyze") ) -(defun semantic-ia-speedbar (directory zero) +(defun semantic-ia-speedbar (_directory _zero) "Create buttons in speedbar which define the current analysis at POINT. DIRECTORY is the current directory, which is ignored, and ZERO is 0." (let ((analysis nil) @@ -195,7 +190,7 @@ DIRECTORY is the current directory, which is ignored, and ZERO is 0." ;; An index for the argument the prefix is in: (let ((arg (oref context argument)) (args (semantic-tag-function-arguments (car func))) - (idx 0) + ;; (idx 0) ) (speedbar-insert-separator (format "Argument #%d" (oref context index))) @@ -275,7 +270,7 @@ See `semantic-ia-sb-tag-info' for more." (setq tok (get-text-property (point) 'speedbar-token))) (semantic-ia-sb-tag-info nil tok 0))) -(defun semantic-ia-sb-tag-info (text tag indent) +(defun semantic-ia-sb-tag-info (_text tag _indent) "Display as much information as we can about tag. Show the information in a shrunk split-buffer and expand out as many details as possible. @@ -322,16 +317,15 @@ TEXT, TAG, and INDENT are speedbar function arguments." (get-buffer-window "*Tag Information*"))) (select-frame speedbar-frame)))) -(defun semantic-ia-sb-line-path (&optional depth) +(defun semantic-ia-sb-line-path (&optional _depth) "Return the file name associated with DEPTH." (save-match-data (let* ((tok (speedbar-line-token)) - (buff (if (semantic-tag-buffer tok) - (semantic-tag-buffer tok) - (current-buffer)))) + (buff (or (semantic-tag-buffer tok) + (current-buffer)))) (buffer-file-name buff)))) -(defun semantic-ia-sb-complete (text tag indent) +(defun semantic-ia-sb-complete (_text tag _indent) "At point in the attached buffer, complete the symbol clicked on. TEXT TAG and INDENT are the details." ;; Find the specified bounds from the current analysis. diff --git a/lisp/cedet/semantic/ia.el b/lisp/cedet/semantic/ia.el index 6d3ec7570b5..e75bc918e0b 100644 --- a/lisp/cedet/semantic/ia.el +++ b/lisp/cedet/semantic/ia.el @@ -1,6 +1,6 @@ -;;; semantic/ia.el --- Interactive Analysis functions +;;; semantic/ia.el --- Interactive Analysis functions -*- lexical-binding: t; -*- -;;; Copyright (C) 2000-2021 Free Software Foundation, Inc. +;; Copyright (C) 2000-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: syntax @@ -79,11 +79,11 @@ (insert "(")) (t nil)))) -(defalias 'semantic-ia-get-completions 'semantic-ia-get-completions-deprecated) +(defalias 'semantic-ia-get-completions #'semantic-ia-get-completions-deprecated) (make-obsolete 'semantic-ia-get-completions #'semantic-analyze-possible-completions "28.1") -(defun semantic-ia-get-completions-deprecated (context point) +(defun semantic-ia-get-completions-deprecated (context _point) "A function to help transition away from `semantic-ia-get-completions'. Return completions based on CONTEXT at POINT." (declare (obsolete semantic-analyze-possible-completions "28.1")) diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el index 9df97780433..b6633d7ee5c 100644 --- a/lisp/cedet/semantic/idle.el +++ b/lisp/cedet/semantic/idle.el @@ -1038,21 +1038,20 @@ be called." (popup-menu semantic-idle-breadcrumbs-popup-menu) (select-window old-window))) -(defmacro semantic-idle-breadcrumbs--tag-function (function) +(defun semantic-idle-breadcrumbs--tag-function (function) "Return lambda expression calling FUNCTION when called from a popup." - `(lambda (event) - (interactive "e") - (let* ((old-window (selected-window)) - (window (semantic-event-window event)) - (column (car (nth 6 (nth 1 event)))) ;; TODO semantic-event-column? - (tag (progn - (select-window window t) - (plist-get - (text-properties-at column header-line-format) - 'tag)))) - (,function tag) - (select-window old-window))) - ) + (lambda (event) + (interactive "e") + (let* ((old-window (selected-window)) + (window (semantic-event-window event)) + (column (car (nth 6 (nth 1 event)))) ;; TODO semantic-event-column? + (tag (progn + (select-window window t) + (plist-get + (text-properties-at column header-line-format) + 'tag)))) + (funcall function tag) + (select-window old-window)))) ;; TODO does this work for mode-line case? (defvar semantic-idle-breadcrumbs-popup-map @@ -1060,8 +1059,7 @@ be called." ;; mouse-1 goes to clicked tag (define-key map [ header-line mouse-1 ] - (semantic-idle-breadcrumbs--tag-function - semantic-go-to-tag)) + (semantic-idle-breadcrumbs--tag-function #'semantic-go-to-tag)) ;; mouse-3 pops up a context menu (define-key map [ header-line mouse-3 ] @@ -1077,8 +1075,7 @@ be called." "Breadcrumb Tag" (vector "Go to Tag" - (semantic-idle-breadcrumbs--tag-function - semantic-go-to-tag) + (semantic-idle-breadcrumbs--tag-function #'semantic-go-to-tag) :active t :help "Jump to this tag") ;; TODO these entries need minor changes (optional tag argument) in @@ -1086,37 +1083,32 @@ be called." ;; (semantic-menu-item ;; (vector ;; "Copy Tag" - ;; (semantic-idle-breadcrumbs--tag-function - ;; senator-copy-tag) + ;; (semantic-idle-breadcrumbs--tag-function #'senator-copy-tag) ;; :active t ;; :help "Copy this tag")) ;; (semantic-menu-item ;; (vector ;; "Kill Tag" - ;; (semantic-idle-breadcrumbs--tag-function - ;; senator-kill-tag) + ;; (semantic-idle-breadcrumbs--tag-function #'senator-kill-tag) ;; :active t ;; :help "Kill tag text to the kill ring, and copy the tag to ;; the tag ring")) ;; (semantic-menu-item ;; (vector ;; "Copy Tag to Register" - ;; (semantic-idle-breadcrumbs--tag-function - ;; senator-copy-tag-to-register) + ;; (semantic-idle-breadcrumbs--tag-function #'senator-copy-tag-to-register) ;; :active t ;; :help "Copy this tag")) ;; (semantic-menu-item ;; (vector ;; "Narrow to Tag" - ;; (semantic-idle-breadcrumbs--tag-function - ;; senator-narrow-to-defun) + ;; (semantic-idle-breadcrumbs--tag-function #'senator-narrow-to-defun) ;; :active t ;; :help "Narrow to the bounds of the current tag")) ;; (semantic-menu-item ;; (vector ;; "Fold Tag" - ;; (semantic-idle-breadcrumbs--tag-function - ;; senator-fold-tag-toggle) + ;; (semantic-idle-breadcrumbs--tag-function #'senator-fold-tag-toggle) ;; :active t ;; :style 'toggle ;; :selected '(let ((tag (semantic-current-tag))) diff --git a/lisp/cedet/semantic/imenu.el b/lisp/cedet/semantic/imenu.el index 4c13959ba1d..2c5f10a2c35 100644 --- a/lisp/cedet/semantic/imenu.el +++ b/lisp/cedet/semantic/imenu.el @@ -1,4 +1,4 @@ -;;; semantic/imenu.el --- Use Semantic as an imenu tag generator +;;; semantic/imenu.el --- Use Semantic as an imenu tag generator -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2005, 2007-2008, 2010-2021 Free Software ;; Foundation, Inc. @@ -57,14 +57,12 @@ (defcustom semantic-imenu-summary-function 'semantic-format-tag-abbreviate "Function to use when creating items in Imenu. Some useful functions are found in `semantic-format-tag-functions'." - :group 'semantic-imenu :type semantic-format-tag-custom-list) (make-variable-buffer-local 'semantic-imenu-summary-function) ;;;###autoload (defcustom semantic-imenu-bucketize-file t "Non-nil if tags in a file are to be grouped into buckets." - :group 'semantic-imenu :type 'boolean) (make-variable-buffer-local 'semantic-imenu-bucketize-file) @@ -72,20 +70,17 @@ Some useful functions are found in `semantic-format-tag-functions'." "Non-nil if types in a file should adopt externally defined members. C++ and CLOS can define methods that are not in the body of a class definition." - :group 'semantic-imenu :type 'boolean) (defcustom semantic-imenu-buckets-to-submenu t "Non-nil if buckets of tags are to be turned into submenus. This option is ignored if `semantic-imenu-bucketize-file' is nil." - :group 'semantic-imenu :type 'boolean) (make-variable-buffer-local 'semantic-imenu-buckets-to-submenu) ;;;###autoload (defcustom semantic-imenu-expand-type-members t "Non-nil if types should have submenus with members in them." - :group 'semantic-imenu :type 'boolean) (make-variable-buffer-local 'semantic-imenu-expand-type-members) @@ -93,7 +88,6 @@ This option is ignored if `semantic-imenu-bucketize-file' is nil." "Non-nil if members of a type should be grouped into buckets. A nil value means to keep them in the same order. Overridden to nil if `semantic-imenu-bucketize-file' is nil." - :group 'semantic-imenu :type 'boolean) (make-variable-buffer-local 'semantic-imenu-bucketize-type-members) @@ -101,7 +95,6 @@ Overridden to nil if `semantic-imenu-bucketize-file' is nil." "Function to use when sorting tags in the buckets of functions. See `semantic-bucketize' and the FILTER argument for more details on this function." - :group 'semantic-imenu :type '(radio (const :tag "No Sorting" nil) (const semantic-sort-tags-by-name-increasing) (const semantic-sort-tags-by-name-decreasing) @@ -119,14 +112,12 @@ on this function." Doesn't actually parse the entire directory, but displays tags for all files currently listed in the current Semantic database. This variable has no meaning if semanticdb is not active." - :group 'semantic-imenu :type 'boolean) (defcustom semantic-imenu-auto-rebuild-directory-indexes nil "If non-nil automatically rebuild directory index imenus. That is when a directory index imenu is updated, automatically rebuild other buffer local ones based on the same semanticdb." - :group 'semantic-imenu :type 'boolean) (defvar semantic-imenu-directory-current-file nil @@ -206,7 +197,7 @@ Optional argument REST is some extra stuff." (setq imenu--index-alist nil))))) )) -(defun semantic-imenu-flush-fcn (&optional ignore) +(defun semantic-imenu-flush-fcn (&optional _ignore) "This function is called as a hook to clear the imenu cache. It is cleared after any parsing. IGNORE arguments." @@ -214,9 +205,9 @@ IGNORE arguments." (setq imenu--index-alist nil imenu-menubar-modified-tick 0)) (remove-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-imenu-flush-fcn t) + #'semantic-imenu-flush-fcn t) (remove-hook 'semantic-after-partial-cache-change-hook - 'semantic-imenu-flush-fcn t) + #'semantic-imenu-flush-fcn t) ) ;;;###autoload @@ -224,7 +215,7 @@ IGNORE arguments." "Create an imenu index for any buffer which supports Semantic. Uses the output of the Semantic parser to create the index. Optional argument STREAM is an optional stream of tags used to create menus." - (setq imenu-default-goto-function 'semantic-imenu-goto-function) + (setq imenu-default-goto-function #'semantic-imenu-goto-function) (prog1 (if (and semantic-imenu-index-directory (featurep 'semantic/db) @@ -234,9 +225,9 @@ Optional argument STREAM is an optional stream of tags used to create menus." (semantic-create-imenu-index-1 (or stream (semantic-fetch-tags-fast)) nil)) (add-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-imenu-flush-fcn nil t) + #'semantic-imenu-flush-fcn nil t) (add-hook 'semantic-after-partial-cache-change-hook - 'semantic-imenu-flush-fcn nil t))) + #'semantic-imenu-flush-fcn nil t))) (defun semantic-create-imenu-directory-index (&optional stream) "Create an imenu tag index based on all files active in semanticdb. @@ -445,7 +436,7 @@ Clears all imenu menus that may be depending on the database." ;; Clear imenu cache to redraw the imenu. (semantic-imenu-flush-fcn)))) -(add-hook 'semanticdb-mode-hook 'semantic-imenu-semanticdb-hook) +(add-hook 'semanticdb-mode-hook #'semantic-imenu-semanticdb-hook) ;;; Interactive Utilities ;; @@ -484,7 +475,6 @@ Clears all imenu menus that may be depending on the database." (defcustom semantic-which-function-use-color nil "Use color when displaying the current function with `which-function'." - :group 'semantic-imenu :type 'boolean) (defun semantic-default-which-function (taglist) diff --git a/lisp/cedet/semantic/java.el b/lisp/cedet/semantic/java.el index f60f6e87ab7..8cadffa09b6 100644 --- a/lisp/cedet/semantic/java.el +++ b/lisp/cedet/semantic/java.el @@ -1,6 +1,6 @@ -;;; semantic/java.el --- Semantic functions for Java +;;; semantic/java.el --- Semantic functions for Java -*- lexical-binding: t; -*- -;;; Copyright (C) 1999-2021 Free Software Foundation, Inc. +;; Copyright (C) 1999-2021 Free Software Foundation, Inc. ;; Author: David Ponce <david@dponce.com> @@ -148,7 +148,7 @@ corresponding compound declaration." (let* ((name (semantic-tag-name tag)) (rsplit (nreverse (split-string name "\\." t))) (newclassname (car rsplit)) - (newpkg (mapconcat 'identity (reverse (cdr rsplit)) "."))) + (newpkg (mapconcat #'identity (reverse (cdr rsplit)) "."))) (semantic-tag-set-name tag newclassname) (setq xpand (list tag @@ -169,7 +169,7 @@ corresponding compound declaration." (define-mode-local-override semantic-ctxt-scoped-types java-mode (&optional point) "Return a list of type names currently in scope at POINT." - (mapcar 'semantic-tag-name + (mapcar #'semantic-tag-name (semantic-find-tags-by-class 'type (semantic-find-tag-by-overlay point)))) @@ -184,7 +184,7 @@ Override function for `semantic-tag-protection'." ;; Prototype handler ;; -(defun semantic-java-prototype-function (tag &optional parent color) +(defun semantic-java-prototype-function (tag &optional _parent color) "Return a function (method) prototype for TAG. Optional argument PARENT is a parent (containing) item. Optional argument COLOR indicates that color should be mixed in. @@ -212,7 +212,7 @@ See also `semantic-format-tag-prototype'." (or type "") (if type " " "") name "(" argp ")"))) -(defun semantic-java-prototype-variable (tag &optional parent color) +(defun semantic-java-prototype-variable (tag &optional _parent color) "Return a variable (field) prototype for TAG. Optional argument PARENT is a parent (containing) item. Optional argument COLOR indicates that color should be mixed in. @@ -227,7 +227,7 @@ See also `semantic-format-tag-prototype'." (semantic--format-colorize-text name 'variable) name)))) -(defun semantic-java-prototype-type (tag &optional parent color) +(defun semantic-java-prototype-type (tag &optional _parent color) "Return a type (class/interface) prototype for TAG. Optional argument PARENT is a parent (containing) item. Optional argument COLOR indicates that color should be mixed in. @@ -260,7 +260,7 @@ Optional argument COLOR indicates that color should be mixed in." (define-mode-local-override semantic-tag-include-filename java-mode (tag) "Return a suitable path for (some) Java imports." (let ((name (semantic-tag-name tag))) - (concat (mapconcat 'identity (split-string name "\\.") "/") ".java"))) + (concat (mapconcat #'identity (split-string name "\\.") "/") ".java"))) ;; Documentation handler ;; @@ -417,15 +417,13 @@ removed from the result list." (or semantic-java-doc-with-name-tags (setq semantic-java-doc-with-name-tags (semantic-java-doc-keywords-map - #'(lambda (k p) - k) + #'(lambda (k _p) k) 'with-name))) (or semantic-java-doc-with-ref-tags (setq semantic-java-doc-with-ref-tags (semantic-java-doc-keywords-map - #'(lambda (k p) - k) + #'(lambda (k _p) k) 'with-ref))) (or semantic-java-doc-extra-type-tags diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el index 5675b9f3e37..0b24bd2dc4c 100644 --- a/lisp/cedet/semantic/lex-spp.el +++ b/lisp/cedet/semantic/lex-spp.el @@ -850,7 +850,7 @@ Argument BEG and END specify the bounds of SYM in the buffer." )) (define-obsolete-function-alias 'semantic-lex-spp-anlyzer-do-replace - 'semantic-lex-spp-analyzer-do-replace "25.1") + #'semantic-lex-spp-analyzer-do-replace "25.1") (defvar semantic-lex-spp-replacements-enabled t "Non-nil means do replacements when finding keywords. @@ -1070,7 +1070,7 @@ and variable state from the current buffer." (semantic-lex-init) (semantic-clear-toplevel-cache) (remove-hook 'semantic-lex-reset-functions - 'semantic-lex-spp-reset-hook t) + #'semantic-lex-spp-reset-hook t) )) ;; Second Cheat: copy key variables regarding macro state from the diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el index 29d8e29ae67..121e5c333f6 100644 --- a/lisp/cedet/semantic/lex.el +++ b/lisp/cedet/semantic/lex.el @@ -469,7 +469,7 @@ PROPERTY set." ;;; Lexical Analyzer framework settings ;; -(defvar-local semantic-lex-analyzer 'semantic-lex +(defvar-local semantic-lex-analyzer #'semantic-lex "The lexical analyzer used for a given buffer. See `semantic-lex' for documentation.") diff --git a/lisp/cedet/semantic/mru-bookmark.el b/lisp/cedet/semantic/mru-bookmark.el index 956eb681f2c..2e77e6b75fb 100644 --- a/lisp/cedet/semantic/mru-bookmark.el +++ b/lisp/cedet/semantic/mru-bookmark.el @@ -1,4 +1,4 @@ -;;; semantic/mru-bookmark.el --- Automatic bookmark tracking +;;; semantic/mru-bookmark.el --- Automatic bookmark tracking -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -85,7 +85,7 @@ Nice values include the following: ) "A single bookmark.") -(cl-defmethod initialize-instance :after ((sbm semantic-bookmark) &rest fields) +(cl-defmethod initialize-instance :after ((sbm semantic-bookmark) &rest _fields) "Initialize the bookmark SBM with details about :tag." (condition-case nil (save-excursion @@ -216,7 +216,7 @@ Cause tags in the ring to become unlinked." (setq idx (1+ idx))))) (add-hook 'semantic-before-toplevel-cache-flush-hook - 'semantic-mrub-cache-flush-fcn) + #'semantic-mrub-cache-flush-fcn) ;;; EDIT tracker ;; @@ -246,8 +246,8 @@ been edited, and you can re-visit them with \\[semantic-mrub-switch-tags]." :group 'semantic-modes :type 'boolean :require 'semantic/util-modes - :initialize 'custom-initialize-default - :set (lambda (sym val) + :initialize #'custom-initialize-default + :set (lambda (_sym val) (global-semantic-mru-bookmark-mode (if val 1 -1)))) ;;;###autoload @@ -266,7 +266,7 @@ been edited, and you can re-visit them with \\[semantic-mrub-switch-tags]." (defvar semantic-mru-bookmark-mode-map (let ((km (make-sparse-keymap))) - (define-key km "\C-xB" 'semantic-mrub-switch-tags) + (define-key km "\C-xB" #'semantic-mrub-switch-tags) km) "Keymap for mru-bookmark minor mode.") @@ -289,14 +289,14 @@ non-nil if the minor mode is enabled." (error "Buffer %s was not set up for parsing" (buffer-name))) (add-hook 'semantic-edits-new-change-functions - 'semantic-mru-bookmark-change-hook-fcn nil t) + #'semantic-mru-bookmark-change-hook-fcn nil t) (add-hook 'semantic-edits-move-change-hooks - 'semantic-mru-bookmark-change-hook-fcn nil t)) + #'semantic-mru-bookmark-change-hook-fcn nil t)) ;; Remove hooks (remove-hook 'semantic-edits-new-change-functions - 'semantic-mru-bookmark-change-hook-fcn t) + #'semantic-mru-bookmark-change-hook-fcn t) (remove-hook 'semantic-edits-move-change-hooks - 'semantic-mru-bookmark-change-hook-fcn t))) + #'semantic-mru-bookmark-change-hook-fcn t))) (semantic-add-minor-mode 'semantic-mru-bookmark-mode "k") diff --git a/lisp/cedet/semantic/senator.el b/lisp/cedet/semantic/senator.el index f33356a170c..19530094fbe 100644 --- a/lisp/cedet/semantic/senator.el +++ b/lisp/cedet/semantic/senator.el @@ -1,4 +1,4 @@ -;;; semantic/senator.el --- SEmantic NAvigaTOR +;;; semantic/senator.el --- SEmantic NAvigaTOR -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2021 Free Software Foundation, Inc. @@ -60,7 +60,6 @@ A tag class is a symbol, such as `variable', `function', or `type'. As a special exception, if the value is nil, Senator's navigation commands recognize all tag classes." - :group 'senator :type '(repeat (symbol))) ;;;###autoload (make-variable-buffer-local 'senator-step-at-tag-classes) @@ -78,7 +77,6 @@ commands stop at the beginning of every tag. If t, the navigation commands stop at the start and end of any tag, where possible." - :group 'senator :type '(choice :tag "Identifiers" (repeat :menu-tag "Symbols" (symbol)) (const :tag "All" t))) @@ -87,7 +85,6 @@ tag, where possible." (defcustom senator-highlight-found nil "If non-nil, Senator commands momentarily highlight found tags." - :group 'senator :type 'boolean) (make-variable-buffer-local 'senator-highlight-found) @@ -193,7 +190,6 @@ source." '(code block) "List of ignored tag classes. Tags of those classes are excluded from search." - :group 'senator :type '(repeat (symbol :tag "class"))) (defun senator-search-default-tag-filter (tag) @@ -461,7 +457,7 @@ filters in `senator-search-tag-filter-functions' remain active." ((symbolp classes) (list classes)) ((stringp classes) - (mapcar 'read (split-string classes))) + (mapcar #'read (split-string classes))) (t (signal 'wrong-type-argument (list classes))) )) @@ -470,11 +466,10 @@ filters in `senator-search-tag-filter-functions' remain active." senator--search-filter t) (kill-local-variable 'senator--search-filter) (if classes - (let ((tag (make-symbol "tag")) - (names (mapconcat 'symbol-name classes "', `"))) + (let ((names (mapconcat #'symbol-name classes "', `"))) (setq-local senator--search-filter - `(lambda (,tag) - (memq (semantic-tag-class ,tag) ',classes))) + (lambda (tag) + (memq (semantic-tag-class tag) classes))) (add-hook 'senator-search-tag-filter-functions senator--search-filter nil t) (message "Limit search to `%s' tags" names)) @@ -605,7 +600,7 @@ Makes C/C++ language like assumptions." "Non-nil if isearch does semantic search. This is a buffer local variable.") -(defun senator-beginning-of-defun (&optional arg) +(defun senator-beginning-of-defun (&optional _arg) "Move backward to the beginning of a defun. Use semantic tags to navigate. ARG is the number of tags to navigate (not yet implemented)." @@ -620,7 +615,7 @@ ARG is the number of tags to navigate (not yet implemented)." (goto-char (semantic-tag-start tag))) (beginning-of-line)))) -(defun senator-end-of-defun (&optional arg) +(defun senator-end-of-defun (&optional _arg) "Move forward to next end of defun. Use semantic tags to navigate. ARG is the number of tags to navigate (not yet implemented)." @@ -859,7 +854,7 @@ Use a senator search function when semantic isearch mode is enabled." (setq-local senator-old-isearch-search-fun isearch-search-fun-function)) (setq-local isearch-search-fun-function - 'senator-isearch-search-fun)) + #'senator-isearch-search-fun)) ;; When `senator-isearch-semantic-mode' is off restore the ;; previous `isearch-search-fun-function'. (when (eq isearch-search-fun-function 'senator-isearch-search-fun) diff --git a/lisp/cedet/semantic/sort.el b/lisp/cedet/semantic/sort.el index 19f46ff7f15..b4b09dc02c8 100644 --- a/lisp/cedet/semantic/sort.el +++ b/lisp/cedet/semantic/sort.el @@ -1,6 +1,6 @@ -;;; semantic/sort.el --- Utilities for sorting and re-arranging tag tables. +;;; semantic/sort.el --- Utilities for sorting and re-arranging tag tables. -*- lexical-binding: t; -*- -;;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 1999-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: syntax @@ -233,8 +233,7 @@ unmodified as components of their parent tags." (semantic-flatten-tags-table components) lists))))) table) - (apply 'append (nreverse lists)) - )) + (apply #'append (nreverse lists)))) ;;; Buckets: @@ -520,12 +519,11 @@ See `semantic-tag-external-member-children' for details." (semantic-tag-name tag) tag))) (if m (apply #'append (mapcar #'cdr m)))) (semantic--find-tags-by-function - `(lambda (tok) - ;; This bit of annoying backquote forces the contents of - ;; tag into the generated lambda. - (semantic-tag-external-member-p ',tag tok)) - (current-buffer)) - )) + (lambda (tok) + ;; This bit of annoying backquote forces the contents of + ;; tag into the generated lambda. + (semantic-tag-external-member-p tag tok)) + (current-buffer)))) (define-overloadable-function semantic-tag-external-class (tag) "Return a list of real tags that faux TAG might represent. @@ -540,6 +538,8 @@ likely derived, then this function is needed." (:override) ) +(defvar semanticdb-search-system-databases) + (defun semantic-tag-external-class-default (tag) "Return a list of real tags that faux TAG might represent. See `semantic-tag-external-class' for details." diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el index d7f91573d3d..701f9ad3e03 100644 --- a/lisp/cedet/semantic/symref.el +++ b/lisp/cedet/semantic/symref.el @@ -1,4 +1,4 @@ -;;; semantic/symref.el --- Symbol Reference API +;;; semantic/symref.el --- Symbol Reference API -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -144,7 +144,7 @@ ARGS are the initialization arguments to pass to the created class." ) (when (not (class-p class)) (error "Unknown symref tool %s" semantic-symref-tool)) - (setq inst (apply 'make-instance class args)) + (setq inst (apply #'make-instance class args)) inst)) (defvar semantic-symref-last-result nil @@ -427,7 +427,7 @@ until the next command is executed." (kill-buffer buff))) semantic-symref-recently-opened-buffers) (setq semantic-symref-recently-opened-buffers nil) - (remove-hook 'post-command-hook 'semantic-symref-cleanup-recent-buffers-fcn) + (remove-hook 'post-command-hook #'semantic-symref-cleanup-recent-buffers-fcn) ) (cl-defmethod semantic-symref-result-get-tags ((result semantic-symref-result) @@ -453,7 +453,7 @@ already." lines))) ;; Kill off dead buffers, unless we were requested to leave them open. (if (not open-buffers) - (add-hook 'post-command-hook 'semantic-symref-cleanup-recent-buffers-fcn) + (add-hook 'post-command-hook #'semantic-symref-cleanup-recent-buffers-fcn) ;; Else, just clear the saved buffers so they aren't deleted later. (setq semantic-symref-recently-opened-buffers nil) ) diff --git a/lisp/cedet/semantic/symref/list.el b/lisp/cedet/semantic/symref/list.el index 50d2e2b1c3e..2e447bbc582 100644 --- a/lisp/cedet/semantic/symref/list.el +++ b/lisp/cedet/semantic/symref/list.el @@ -108,20 +108,20 @@ Display the references in `semantic-symref-results-mode'." (defvar semantic-symref-results-mode-map (let ((km (make-sparse-keymap))) (suppress-keymap km) - (define-key km "\C-i" 'forward-button) - (define-key km "\M-C-i" 'backward-button) - (define-key km " " 'push-button) - (define-key km "-" 'semantic-symref-list-toggle-showing) - (define-key km "=" 'semantic-symref-list-toggle-showing) - (define-key km "+" 'semantic-symref-list-toggle-showing) - (define-key km "n" 'semantic-symref-list-next-line) - (define-key km "p" 'semantic-symref-list-prev-line) - (define-key km "q" 'quit-window) - (define-key km "\C-c\C-e" 'semantic-symref-list-expand-all) - (define-key km "\C-c\C-r" 'semantic-symref-list-contract-all) - (define-key km "R" 'semantic-symref-list-rename-open-hits) - (define-key km "(" 'semantic-symref-list-create-macro-on-open-hit) - (define-key km "E" 'semantic-symref-list-call-macro-on-open-hits) + (define-key km "\C-i" #'forward-button) + (define-key km "\M-C-i" #'backward-button) + (define-key km " " #'push-button) + (define-key km "-" #'semantic-symref-list-toggle-showing) + (define-key km "=" #'semantic-symref-list-toggle-showing) + (define-key km "+" #'semantic-symref-list-toggle-showing) + (define-key km "n" #'semantic-symref-list-next-line) + (define-key km "p" #'semantic-symref-list-prev-line) + (define-key km "q" #'quit-window) + (define-key km "\C-c\C-e" #'semantic-symref-list-expand-all) + (define-key km "\C-c\C-r" #'semantic-symref-list-contract-all) + (define-key km "R" #'semantic-symref-list-rename-open-hits) + (define-key km "(" #'semantic-symref-list-create-macro-on-open-hit) + (define-key km "E" #'semantic-symref-list-call-macro-on-open-hits) km) "Keymap used in `semantic-symref-results-mode'.") diff --git a/lisp/cedet/semantic/tag-file.el b/lisp/cedet/semantic/tag-file.el index fc5c27752a0..06dd274b323 100644 --- a/lisp/cedet/semantic/tag-file.el +++ b/lisp/cedet/semantic/tag-file.el @@ -1,4 +1,4 @@ -;;; semantic/tag-file.el --- Routines that find files based on tags. +;;; semantic/tag-file.el --- Routines that find files based on tags. -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc. diff --git a/lisp/cedet/semantic/tag-ls.el b/lisp/cedet/semantic/tag-ls.el index 6cef603af35..3aa1a62901c 100644 --- a/lisp/cedet/semantic/tag-ls.el +++ b/lisp/cedet/semantic/tag-ls.el @@ -1,4 +1,4 @@ -;;; semantic/tag-ls.el --- Language Specific override functions for tags +;;; semantic/tag-ls.el --- Language Specific override functions for tags -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2004, 2006-2021 Free Software Foundation, Inc. @@ -97,7 +97,7 @@ Modes that override this function can call `semantic--tag-attribute-similar-p-default' to do the default equality tests if ATTR is not special for that mode.") -(defun semantic--tag-attribute-similar-p-default (attr value1 value2 ignorable-attributes) +(defun semantic--tag-attribute-similar-p-default (_attr value1 value2 ignorable-attributes) "For ATTR, VALUE1, VALUE2 and IGNORABLE-ATTRIBUTES, test for similarity." (cond ;; Tag sublists require special testing. @@ -109,7 +109,7 @@ ATTR is not special for that mode.") (when (not (eq (length taglist1) (length taglist2))) (setq ans nil)) (while (and ans taglist1 taglist2) - (setq ans (apply 'semantic-tag-similar-p + (setq ans (apply #'semantic-tag-similar-p (car taglist1) (car taglist2) ignorable-attributes) taglist1 (cdr taglist1) @@ -205,7 +205,7 @@ stream for a tag of class `package', and return that." (or stream-or-buffer tag)))) (:override-with-args (tag stream)))) -(defun semantic-tag-full-package-default (tag stream) +(defun semantic-tag-full-package-default (_tag stream) "Default method for `semantic-tag-full-package' for TAG. Return the name of the first tag of class `package' in STREAM." (let ((pack (car-safe (semantic-find-tags-by-class 'package stream)))) @@ -285,7 +285,7 @@ is to return a symbol based on type modifiers." (setq parent (semantic-tag-calculate-parent tag))) (:override)) -(defun semantic-tag-protection-default (tag &optional parent) +(defun semantic-tag-protection-default (tag &optional _parent) "Return the protection of TAG as a child of PARENT default action. See `semantic-tag-protection'." (let ((mods (semantic-tag-modifiers tag)) @@ -295,9 +295,7 @@ See `semantic-tag-protection'." (let ((s (car mods))) (setq prot ;; A few silly defaults to get things started. - (cond ((or (string= s "public") - (string= s "extern") - (string= s "export")) + (cond ((member s '("public" "extern" "export")) 'public) ((string= s "private") 'private) @@ -372,15 +370,14 @@ in how methods are overridden. In UML, abstract methods are italicized. The default behavior (if not overridden with `tag-abstract-p' is to return true if `abstract' is in the type modifiers.") -(defun semantic-tag-abstract-p-default (tag &optional parent) +(defun semantic-tag-abstract-p-default (tag &optional _parent) "Return non-nil if TAG is abstract as a child of PARENT default action. See `semantic-tag-abstract-p'." (let ((mods (semantic-tag-modifiers tag)) (abs nil)) (while (and (not abs) mods) (if (stringp (car mods)) - (setq abs (or (string= (car mods) "abstract") - (string= (car mods) "virtual")))) + (setq abs (member (car mods) '("abstract" "virtual")))) (setq mods (cdr mods))) abs)) @@ -392,7 +389,7 @@ In UML, leaf methods and classes have special meaning and behavior. The default behavior (if not overridden with `tag-leaf-p' is to return true if `leaf' is in the type modifiers.") -(defun semantic-tag-leaf-p-default (tag &optional parent) +(defun semantic-tag-leaf-p-default (tag &optional _parent) "Return non-nil if TAG is leaf as a child of PARENT default action. See `semantic-tag-leaf-p'." (let ((mods (semantic-tag-modifiers tag)) @@ -412,7 +409,7 @@ In UML, static methods and attributes mean that they are allocated in the parent class, and are not instance specific. UML notation specifies that STATIC entries are underlined.") -(defun semantic-tag-static-p-default (tag &optional parent) +(defun semantic-tag-static-p-default (tag &optional _parent) "Return non-nil if TAG is static as a child of PARENT default action. See `semantic-tag-static-p'." (let ((mods (semantic-tag-modifiers tag)) diff --git a/lisp/cedet/semantic/tag-write.el b/lisp/cedet/semantic/tag-write.el index f705c89c904..9d5aeea098b 100644 --- a/lisp/cedet/semantic/tag-write.el +++ b/lisp/cedet/semantic/tag-write.el @@ -1,4 +1,4 @@ -;;; semantic/tag-write.el --- Write tags to a text stream +;;; semantic/tag-write.el --- Write tags to a text stream -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -88,7 +88,7 @@ INDENT is the amount of indentation to use for this tag." (if (semantic-tag-with-position-p tag) (let ((bounds (semantic-tag-bounds tag))) (princ " ") - (prin1 (apply 'vector bounds)) + (prin1 (apply #'vector bounds)) ) (princ " nil")) ;; End it. diff --git a/lisp/cedet/semantic/tag.el b/lisp/cedet/semantic/tag.el index a99e2ab279b..b6386d71db0 100644 --- a/lisp/cedet/semantic/tag.el +++ b/lisp/cedet/semantic/tag.el @@ -478,7 +478,7 @@ TYPE is a string or semantic tag representing the type of this variable. Optional DEFAULT-VALUE is a string representing the default value of this variable. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'variable + (apply #'semantic-tag name 'variable :type type :default-value default-value attributes)) @@ -490,7 +490,7 @@ TYPE is a string or semantic tag representing the type of this function. ARG-LIST is a list of strings or semantic tags representing the arguments of this function. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'function + (apply #'semantic-tag name 'function :type type :arguments arg-list attributes)) @@ -513,7 +513,7 @@ This slot can be interesting because the form: is a valid parent where there is no explicit parent, and only an interface. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'type + (apply #'semantic-tag name 'type :type type :members members :superclasses (car parents) @@ -526,7 +526,7 @@ NAME is the name of this include. SYSTEM-FLAG represents that we were able to identify this include as belonging to the system, as opposed to belonging to the local project. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'include + (apply #'semantic-tag name 'include :system-flag system-flag attributes)) @@ -536,7 +536,7 @@ NAME is the name of this package. DETAIL is extra information about this package, such as a location where it can be found. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'package + (apply #'semantic-tag name 'package :detail detail attributes)) @@ -545,7 +545,7 @@ ATTRIBUTES is a list of additional attributes belonging to this tag." NAME is a name for this code. DETAIL is extra information about the code. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'code + (apply #'semantic-tag name 'code :detail detail attributes)) @@ -685,7 +685,7 @@ FILTER takes TAG as an argument, and should return a `semantic-tag'. It is safe for FILTER to modify the input tag and return it." (when (not filter) (setq filter 'identity)) (when (not (semantic-tag-p tag)) - (signal 'wrong-type-argument (list tag 'semantic-tag-p))) + (signal 'wrong-type-argument (list tag #'semantic-tag-p))) (let ((ol (semantic-tag-overlay tag)) (fn (semantic-tag-file-name tag))) (funcall filter (list (semantic-tag-name tag) @@ -937,7 +937,7 @@ NAME is a name for this alias. META-TAG-CLASS is the class of the tag this tag is an alias. VALUE is the aliased definition. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'alias + (apply #'semantic-tag name 'alias :aliasclass meta-tag-class :definition value attributes)) @@ -1093,7 +1093,7 @@ For any given situation, additional ARGS may be passed." (condition-case err ;; If a hook bombs, ignore it! Usually this is tied into ;; some sort of critical system. - (apply 'run-hook-with-args 'semantic--tag-hook-value arglist) + (apply #'run-hook-with-args 'semantic--tag-hook-value arglist) (error (message "Error: %S" err))))) ;;; Tags and Overlays @@ -1104,7 +1104,7 @@ For any given situation, additional ARGS may be passed." (defsubst semantic--tag-unlink-list-from-buffer (tags) "Convert TAGS from using an overlay to using an overlay proxy. This function is for internal use only." - (mapcar 'semantic--tag-unlink-from-buffer tags)) + (mapcar #'semantic--tag-unlink-from-buffer tags)) (defun semantic--tag-unlink-from-buffer (tag) "Convert TAG from using an overlay to using an overlay proxy. @@ -1125,7 +1125,7 @@ This function is for internal use only." (defsubst semantic--tag-link-list-to-buffer (tags) "Convert TAGS from using an overlay proxy to using an overlay. This function is for internal use only." - (mapc 'semantic--tag-link-to-buffer tags)) + (mapc #'semantic--tag-link-to-buffer tags)) (defun semantic--tag-link-to-buffer (tag) "Convert TAG from using an overlay proxy to using an overlay. diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el index 377cec5455d..5a38280d2a2 100644 --- a/lisp/cedet/semantic/texi.el +++ b/lisp/cedet/semantic/texi.el @@ -1,4 +1,4 @@ -;;; semantic/texi.el --- Semantic details for Texinfo files +;;; semantic/texi.el --- Semantic details for Texinfo files -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2005, 2007-2021 Free Software Foundation, Inc. @@ -55,7 +55,7 @@ The field position is the field number (based at 1) where the name of this section is.") ;;; Code: -(defun semantic-texi-parse-region (&rest ignore) +(defun semantic-texi-parse-region (&rest _ignore) "Parse the current texinfo buffer for semantic tags. IGNORE any arguments, always parse the whole buffer. Each tag returned is of the form: @@ -79,7 +79,7 @@ function `semantic-install-function-overrides'." (let ((chil (semantic-tag-components tag))) (if chil (semantic-tag-put-attribute - tag :members (mapcar 'semantic-texi-expand-tag chil))) + tag :members (mapcar #'semantic-texi-expand-tag chil))) (car (semantic--tag-expand tag)))) (defun semantic-texi-parse-headings () @@ -297,7 +297,7 @@ can handle the @menu environment.") nil)) (define-mode-local-override semantic-ctxt-current-class-list - texinfo-mode (&optional point) + texinfo-mode (&optional _point) "Determine the class of tags that can be used at POINT. For texinfo, there two possibilities returned. 1) `function' - for a call to a texinfo function @@ -368,7 +368,7 @@ Optional argument POINT is where to look for the environment." (declare-function semantic-analyze-context "semantic/analyze") (define-mode-local-override semantic-analyze-current-context - texinfo-mode (point) + texinfo-mode (_point) "Analysis context makes no sense for texinfo. Return nil." (let* ((prefixandbounds (semantic-ctxt-current-symbol-and-bounds (point))) (prefix (car prefixandbounds)) @@ -408,7 +408,7 @@ Optional argument POINT is where to look for the environment." "List of commands that we might bother completing.") (define-mode-local-override semantic-analyze-possible-completions - texinfo-mode (context &rest flags) + texinfo-mode (context &rest _flags) "List smart completions at point. Since texinfo is not a programming language the default version is not useful. Instead, look at the current symbol. If it is a command @@ -451,7 +451,7 @@ that start with that symbol." (setq semantic-parser-name "TEXI" ;; Setup a dummy parser table to enable parsing! semantic--parse-table t - imenu-create-index-function 'semantic-create-imenu-index + imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character "@" semantic-type-relation-separator-character '(":") semantic-symbol->name-assoc-list '((section . "Section") @@ -466,7 +466,7 @@ that start with that symbol." ;; (local-set-key [(f9)] 'semantic-texi-update-doc-from-texi) ) -(add-hook 'texinfo-mode-hook 'semantic-default-texi-setup) +(add-hook 'texinfo-mode-hook #'semantic-default-texi-setup) ;;; Special features of Texinfo tag streams @@ -500,7 +500,7 @@ that start with that symbol." ;; Turns out this might not be useful. ;; Delete later if that is true. -(defun semantic-texi-find-documentation (name &optional type) +(defun semantic-texi-find-documentation (name &optional _type) "Find the function or variable NAME of TYPE in the texinfo source. NAME is a string representing some functional symbol. TYPE is a string, such as \"variable\" or \"Command\" used to find diff --git a/lisp/cedet/semantic/util-modes.el b/lisp/cedet/semantic/util-modes.el index 0de66d29e3e..a02d5667ef3 100644 --- a/lisp/cedet/semantic/util-modes.el +++ b/lisp/cedet/semantic/util-modes.el @@ -1,4 +1,4 @@ -;;; semantic/util-modes.el --- Semantic minor modes +;;; semantic/util-modes.el --- Semantic minor modes -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2005, 2007-2021 Free Software Foundation, Inc. @@ -48,7 +48,7 @@ line." :group 'semantic :type 'boolean :require 'semantic/util-modes - :initialize 'custom-initialize-default + :initialize #'custom-initialize-default :set (lambda (sym val) (set-default sym val) ;; Update status of all Semantic enabled buffers @@ -60,7 +60,7 @@ line." :group 'semantic :type 'string :require 'semantic/util-modes - :initialize 'custom-initialize-default) + :initialize #'custom-initialize-default) (defvar semantic-minor-modes-format nil "Mode line format showing Semantic minor modes which are locally enabled. @@ -93,7 +93,7 @@ Only minor modes that are locally enabled are shown in the mode line." (match-string 1 semantic-mode-line-prefix) "S"))) (setq semantic-minor-modes-format - `((:eval (if (or ,@(mapcar 'car locals)) + `((:eval (if (or ,@(mapcar #'car locals)) ,(concat " " prefix))))) ;; It would be easier to just put `locals' inside ;; semantic-minor-modes-format, but then things like @@ -111,7 +111,7 @@ Only minor modes that are locally enabled are shown in the mode line." (cons elem minor-mode-alist))))) (setcdr tail (nconc locals (cdr tail))))))))) -(defun semantic-desktop-ignore-this-minor-mode (buffer) +(defun semantic-desktop-ignore-this-minor-mode (_buffer) "Installed as a minor-mode initializer for Desktop mode. BUFFER is the buffer to not initialize a Semantic minor mode in." nil) @@ -221,10 +221,10 @@ non-nil if the minor mode is enabled." (error "Buffer %s was not set up for parsing" (buffer-name))) (add-hook 'semantic-edits-new-change-functions - 'semantic-highlight-edits-new-change-hook-fcn nil t)) + #'semantic-highlight-edits-new-change-hook-fcn nil t)) ;; Remove hooks (remove-hook 'semantic-edits-new-change-functions - 'semantic-highlight-edits-new-change-hook-fcn t))) + #'semantic-highlight-edits-new-change-hook-fcn t))) (semantic-add-minor-mode 'semantic-highlight-edits-mode "e") @@ -345,7 +345,7 @@ Do not search past BOUND if non-nil." (defvar semantic-show-unmatched-syntax-mode-map (let ((km (make-sparse-keymap))) - (define-key km "\C-c,`" 'semantic-show-unmatched-syntax-next) + (define-key km "\C-c,`" #'semantic-show-unmatched-syntax-next) km) "Keymap for command `semantic-show-unmatched-syntax-mode'.") @@ -372,18 +372,18 @@ non-nil if the minor mode is enabled. (buffer-name))) ;; Add hooks (add-hook 'semantic-unmatched-syntax-hook - 'semantic-show-unmatched-syntax nil t) + #'semantic-show-unmatched-syntax nil t) (add-hook 'semantic-pre-clean-token-hooks - 'semantic-clean-token-of-unmatched-syntax nil t) + #'semantic-clean-token-of-unmatched-syntax nil t) ;; Show unmatched syntax elements (if (not (semantic--umatched-syntax-needs-refresh-p)) (semantic-show-unmatched-syntax (semantic-unmatched-syntax-tokens)))) ;; Remove hooks (remove-hook 'semantic-unmatched-syntax-hook - 'semantic-show-unmatched-syntax t) + #'semantic-show-unmatched-syntax t) (remove-hook 'semantic-pre-clean-token-hooks - 'semantic-clean-token-of-unmatched-syntax t) + #'semantic-clean-token-of-unmatched-syntax t) ;; Cleanup unmatched-syntax highlighting (semantic-clean-unmatched-syntax-in-buffer))) @@ -454,46 +454,46 @@ non-nil if the minor mode is enabled." '(semantic-show-parser-state-string)))) ;; Add hooks (add-hook 'semantic-edits-new-change-functions - 'semantic-show-parser-state-marker nil t) + #'semantic-show-parser-state-marker nil t) (add-hook 'semantic-edits-incremental-reparse-failed-hook - 'semantic-show-parser-state-marker nil t) + #'semantic-show-parser-state-marker nil t) (add-hook 'semantic-after-partial-cache-change-hook - 'semantic-show-parser-state-marker nil t) + #'semantic-show-parser-state-marker nil t) (add-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-show-parser-state-marker nil t) + #'semantic-show-parser-state-marker nil t) (semantic-show-parser-state-marker) (add-hook 'semantic-before-auto-parse-hooks - 'semantic-show-parser-state-auto-marker nil t) + #'semantic-show-parser-state-auto-marker nil t) (add-hook 'semantic-after-auto-parse-hooks - 'semantic-show-parser-state-marker nil t) + #'semantic-show-parser-state-marker nil t) (add-hook 'semantic-before-idle-scheduler-reparse-hook - 'semantic-show-parser-state-auto-marker nil t) + #'semantic-show-parser-state-auto-marker nil t) (add-hook 'semantic-after-idle-scheduler-reparse-hook - 'semantic-show-parser-state-marker nil t)) + #'semantic-show-parser-state-marker nil t)) ;; Remove parts of mode line (setq mode-line-modified (delq 'semantic-show-parser-state-string mode-line-modified)) ;; Remove hooks (remove-hook 'semantic-edits-new-change-functions - 'semantic-show-parser-state-marker t) + #'semantic-show-parser-state-marker t) (remove-hook 'semantic-edits-incremental-reparse-failed-hook - 'semantic-show-parser-state-marker t) + #'semantic-show-parser-state-marker t) (remove-hook 'semantic-after-partial-cache-change-hook - 'semantic-show-parser-state-marker t) + #'semantic-show-parser-state-marker t) (remove-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-show-parser-state-marker t) + #'semantic-show-parser-state-marker t) (remove-hook 'semantic-before-auto-parse-hooks - 'semantic-show-parser-state-auto-marker t) + #'semantic-show-parser-state-auto-marker t) (remove-hook 'semantic-after-auto-parse-hooks - 'semantic-show-parser-state-marker t) + #'semantic-show-parser-state-marker t) (remove-hook 'semantic-before-idle-scheduler-reparse-hook - 'semantic-show-parser-state-auto-marker t) + #'semantic-show-parser-state-auto-marker t) (remove-hook 'semantic-after-idle-scheduler-reparse-hook - 'semantic-show-parser-state-marker t))) + #'semantic-show-parser-state-marker t))) (semantic-add-minor-mode 'semantic-show-parser-state-mode "") @@ -502,7 +502,7 @@ non-nil if the minor mode is enabled." "String showing the parser state for this buffer. See `semantic-show-parser-state-marker' for details.") -(defun semantic-show-parser-state-marker (&rest ignore) +(defun semantic-show-parser-state-marker (&rest _ignore) "Set `semantic-show-parser-state-string' to indicate parser state. This marker is one of the following: `-' -> The cache is up to date. @@ -555,7 +555,7 @@ to indicate a parse in progress." (defvar semantic-stickyfunc-mode-map (let ((km (make-sparse-keymap))) - (define-key km [ header-line down-mouse-1 ] 'semantic-stickyfunc-menu) + (define-key km [ header-line down-mouse-1 ] #'semantic-stickyfunc-menu) km) "Keymap for stickyfunc minor mode.") @@ -826,7 +826,7 @@ Argument EVENT describes the event that caused this function to be called." (defvar semantic-highlight-func-mode-map (let ((km (make-sparse-keymap))) - (define-key km [mouse-3] 'semantic-highlight-func-menu) + (define-key km [mouse-3] #'semantic-highlight-func-menu) km) "Keymap for highlight-func minor mode.") @@ -916,10 +916,10 @@ non-nil if the minor mode is enabled." (error "Buffer %s was not set up for parsing" (buffer-name))) ;; Setup our hook (add-hook 'post-command-hook - 'semantic-highlight-func-highlight-current-tag nil t)) + #'semantic-highlight-func-highlight-current-tag nil t)) ;; Disable highlight func mode (remove-hook 'post-command-hook - 'semantic-highlight-func-highlight-current-tag t) + #'semantic-highlight-func-highlight-current-tag t) (semantic-highlight-func-highlight-current-tag t))) (defun semantic-highlight-func-highlight-current-tag (&optional disable) diff --git a/lisp/cedet/semantic/util.el b/lisp/cedet/semantic/util.el index 8c487e14ed5..bfc923c75b4 100644 --- a/lisp/cedet/semantic/util.el +++ b/lisp/cedet/semantic/util.el @@ -1,6 +1,6 @@ -;;; semantic/util.el --- Utilities for use with semantic tag tables +;;; semantic/util.el --- Utilities for use with semantic tag tables -*- lexical-binding: t; -*- -;;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 1999-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: syntax @@ -114,7 +114,10 @@ buffer, or a filename. If SOMETHING is nil return nil." ((and (featurep 'semantic/db) (require 'semantic/db-mode) (semanticdb-minor-mode-p) - (cl-typep something 'semanticdb-abstract-table)) + (progn + (declare-function semanticdb-abstract-table--eieio-childp + "semantic/db") + (cl-typep something 'semanticdb-abstract-table))) (semanticdb-refresh-table something) (semanticdb-get-tags something)) ;; Semanticdb find-results @@ -427,7 +430,7 @@ determining which symbols are considered." (setq completion (try-completion pattern collection predicate)) (if (string= pattern completion) (let ((list (all-completions pattern collection predicate))) - (setq list (sort list 'string<)) + (setq list (sort list #'string<)) (if (> (length list) 1) (with-output-to-temp-buffer "*Completions*" (display-completion-list diff --git a/lisp/cedet/semantic/wisent/comp.el b/lisp/cedet/semantic/wisent/comp.el index ae0823e669a..6addc134edb 100644 --- a/lisp/cedet/semantic/wisent/comp.el +++ b/lisp/cedet/semantic/wisent/comp.el @@ -3450,7 +3450,7 @@ Automatically called by the Emacs Lisp byte compiler as a `byte-compile' handler." (byte-compile-form (macroexpand-all - (wisent-automaton-lisp-form (eval form))))) + (wisent-automaton-lisp-form (eval form t))))) (defun wisent-compile-grammar (grammar &optional start-list) ;; This is kept for compatibility with FOO-wy.el files generated diff --git a/lisp/cedet/semantic/wisent/java-tags.el b/lisp/cedet/semantic/wisent/java-tags.el index adb9a30894e..b4a87be62a0 100644 --- a/lisp/cedet/semantic/wisent/java-tags.el +++ b/lisp/cedet/semantic/wisent/java-tags.el @@ -111,12 +111,12 @@ Use the alternate LALR(1) parser." (setq ;; Lexical analysis semantic-lex-number-expression semantic-java-number-regexp - semantic-lex-analyzer 'wisent-java-tags-lexer + semantic-lex-analyzer #'wisent-java-tags-lexer ;; Parsing - semantic-tag-expand-function 'semantic-java-expand-tag + semantic-tag-expand-function #'semantic-java-expand-tag ;; Environment - semantic-imenu-summary-function 'semantic-format-tag-prototype - imenu-create-index-function 'semantic-create-imenu-index + semantic-imenu-summary-function #'semantic-format-tag-prototype + imenu-create-index-function #'semantic-create-imenu-index semantic-type-relation-separator-character '(".") semantic-command-separation-character ";" ;; speedbar and imenu buckets name diff --git a/lisp/cedet/semantic/wisent/javascript.el b/lisp/cedet/semantic/wisent/javascript.el index 9db51ad36b6..1932f205ee0 100644 --- a/lisp/cedet/semantic/wisent/javascript.el +++ b/lisp/cedet/semantic/wisent/javascript.el @@ -128,14 +128,14 @@ This is currently needed for the mozrepl omniscient database." (wisent-javascript-jv-wy--install-parser) (setq ;; Lexical Analysis - semantic-lex-analyzer 'javascript-lexer-jv + semantic-lex-analyzer #'javascript-lexer-jv semantic-lex-number-expression semantic-java-number-regexp ;; semantic-lex-depth nil ;; Full lexical analysis ;; Parsing - semantic-tag-expand-function 'wisent-javascript-jv-expand-tag + semantic-tag-expand-function #'wisent-javascript-jv-expand-tag ;; Environment - semantic-imenu-summary-function 'semantic-format-tag-name - imenu-create-index-function 'semantic-create-imenu-index + semantic-imenu-summary-function #'semantic-format-tag-name + imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character ";" )) diff --git a/lisp/cedet/semantic/wisent/python.el b/lisp/cedet/semantic/wisent/python.el index 8732b2e975c..7a5761ce8c8 100644 --- a/lisp/cedet/semantic/wisent/python.el +++ b/lisp/cedet/semantic/wisent/python.el @@ -512,12 +512,12 @@ Shortens `code' tags, but passes through for others." semantic-type-relation-separator-character '(".") semantic-command-separation-character ";" ;; Parsing - semantic-tag-expand-function 'semantic-python-expand-tag + semantic-tag-expand-function #'semantic-python-expand-tag ;; Semantic to take over from the one provided by python. ;; The python one, if it uses the senator advice, will hang ;; Emacs unrecoverably. - imenu-create-index-function 'semantic-create-imenu-index + imenu-create-index-function #'semantic-create-imenu-index ;; I need a python guru to update this list: semantic-symbol->name-assoc-list-for-type-parts '((variable . "Variables") diff --git a/lisp/cedet/semantic/wisent/wisent.el b/lisp/cedet/semantic/wisent/wisent.el index df1fd73e29e..d205c0e6043 100644 --- a/lisp/cedet/semantic/wisent/wisent.el +++ b/lisp/cedet/semantic/wisent/wisent.el @@ -1,6 +1,6 @@ ;;; semantic/wisent/wisent.el --- GNU Bison for Emacs - Runtime -*- lexical-binding: t; -*- -;;; Copyright (C) 2002-2007, 2009-2021 Free Software Foundation, Inc. +;; Copyright (C) 2002-2021 Free Software Foundation, Inc. ;; Author: David Ponce <david@dponce.com> ;; Created: 30 January 2002 diff --git a/lisp/cedet/srecode.el b/lisp/cedet/srecode.el index aa4aa812e02..83e9754a608 100644 --- a/lisp/cedet/srecode.el +++ b/lisp/cedet/srecode.el @@ -1,6 +1,6 @@ ;;; srecode.el --- Semantic buffer evaluator. -*- lexical-binding: t -*- -;;; Copyright (C) 2005, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 2005-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: codegeneration diff --git a/lisp/cedet/srecode/cpp.el b/lisp/cedet/srecode/cpp.el index 3f66898c9cc..dc5e8da5cdb 100644 --- a/lisp/cedet/srecode/cpp.el +++ b/lisp/cedet/srecode/cpp.el @@ -164,7 +164,7 @@ specified in a C file." ;; when they make sense. My best bet would be ;; (semantic-tag-function-parent tag), but it is not there, when ;; the function is defined in the scope of a class. - (let ((member t) + (let (;; (member t) (templates (semantic-tag-get-attribute tag :template)) (modifiers (semantic-tag-modifiers tag))) @@ -185,7 +185,7 @@ specified in a C file." ;; When the function is a member function, it can have ;; additional modifiers. - (when member + (when t ;; member ;; For member functions, constness is called ;; 'methodconst-flag'. diff --git a/lisp/cedet/srecode/mode.el b/lisp/cedet/srecode/mode.el index 022a5db8f2b..9b1c8491a12 100644 --- a/lisp/cedet/srecode/mode.el +++ b/lisp/cedet/srecode/mode.el @@ -224,13 +224,11 @@ MENU-DEF is the menu to bind this into." (if bind (concat name " (" bind ")") name) - `(lambda () (interactive) - (srecode-insert (concat ,ctxt ":" ,name))) + (lambda () (interactive) + (srecode-insert (concat ctxt ":" name))) t))) - (setcdr ctxtcons (cons - new - (cdr ctxtcons))))) + (push new (cdr ctxtcons)))) (setq ltab (cdr ltab)))) (setq subtab (cdr subtab))) diff --git a/lisp/cedet/srecode/template.el b/lisp/cedet/srecode/template.el index 4f7eaffeb47..1f6f0d345da 100644 --- a/lisp/cedet/srecode/template.el +++ b/lisp/cedet/srecode/template.el @@ -49,11 +49,11 @@ (setq ;; Lexical Analysis - semantic-lex-analyzer 'wisent-srecode-template-lexer + semantic-lex-analyzer #'wisent-srecode-template-lexer ;; Parsing ;; Environment - semantic-imenu-summary-function 'semantic-format-tag-name - imenu-create-index-function 'semantic-create-imenu-index + semantic-imenu-summary-function #'semantic-format-tag-name + imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character "\n" semantic-lex-comment-regex ";;" ;; Speedbar diff --git a/lisp/comint.el b/lisp/comint.el index 5c307febe2a..65072b01376 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -366,13 +366,15 @@ This variable is buffer-local." ;; OpenBSD doas prints "doas (user@host) password:". ;; See ert test `comint-test-password-regexp'. (defcustom comint-password-prompt-regexp + ;; When extending this, please also add a corresponding test where + ;; possible (see `comint-testsuite-password-strings'). (concat "\\(^ *\\|" (regexp-opt '("Enter" "enter" "Enter same" "enter same" "Enter the" "enter the" "Enter Auth" "enter auth" "Old" "old" "New" "new" "'s" "login" "Kerberos" "CVS" "UNIX" " SMB" "LDAP" "PEM" "SUDO" - "[sudo]" "doas" "Repeat" "Bad" "Retype") + "[sudo]" "doas" "Repeat" "Bad" "Retype" "Verify") t) ;; Allow for user name to precede password equivalent (Bug#31075). " +.*\\)" @@ -382,7 +384,7 @@ This variable is buffer-local." "\\(?: [[:alpha:]]+ .+\\)?[[:blank:]]*[::៖][[:space:]]*\\'") "Regexp matching prompts for passwords in the inferior process. This is used by `comint-watch-for-password-prompt'." - :version "27.1" + :version "28.1" :type 'regexp :group 'comint) diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el index 2a3efbe5a1b..439d3bd363e 100644 --- a/lisp/emacs-lisp/benchmark.el +++ b/lisp/emacs-lisp/benchmark.el @@ -31,6 +31,8 @@ ;;; Code: +(eval-when-compile (require 'subr-x)) ;For `named-let'. + (defmacro benchmark-elapse (&rest forms) "Return the time in seconds elapsed for execution of FORMS." (declare (indent 0) (debug t)) @@ -41,6 +43,61 @@ (float-time (time-since ,t1))))) ;;;###autoload +(defun benchmark-call (func &optional repetitions) + "Measure the run time of calling FUNC a number REPETITIONS of times. +The result is a list (TIME GC GCTIME) +where TIME is the total time it took, in seconds. +GCTIME is the amount of time that was spent in the GC +and GC is the number of times the GC was called. + +REPETITIONS can also be a floating point number, in which case it +specifies a minimum number of seconds that the benchmark execution +should take. In that case the return value is prepended with the +number of repetitions actually used." + (if (floatp repetitions) + (benchmark--adaptive func repetitions) + (unless repetitions (setq repetitions 1)) + (let ((gc gc-elapsed) + (gcs gcs-done) + (empty-func (lambda () 'empty-func))) + (list + (if (> repetitions 1) + (- (benchmark-elapse (dotimes (_ repetitions) (funcall func))) + (benchmark-elapse (dotimes (_ repetitions) (funcall empty-func)))) + (- (benchmark-elapse (funcall func)) + (benchmark-elapse (funcall empty-func)))) + (- gcs-done gcs) + (- gc-elapsed gc))))) + +(defun benchmark--adaptive (func time) + "Measure the run time of FUNC, calling it enough times to last TIME seconds. +Result is (REPETITIONS . DATA) where DATA is as returned by `branchmark-call'." + (named-let loop ((repetitions 1) + (data (let ((x (list 0))) (setcdr x x) x))) + ;; (message "Running %d iteration" repetitions) + (let ((newdata (benchmark-call func repetitions))) + (if (<= (car newdata) 0) + ;; This can happen if we're unlucky, e.g. the process got preempted + ;; (or the GC ran) just during the empty-func loop. + ;; Just try again, hopefully this won't repeat itself. + (progn + ;; (message "Ignoring the %d iterations" repetitions) + (loop (* 2 repetitions) data)) + (let* ((sum (cl-mapcar #'+ data (cons repetitions newdata))) + (totaltime (nth 1 sum))) + (if (>= totaltime time) + sum + (let* ((iter-time (/ totaltime (car sum))) + (missing-time (- time totaltime)) + (missing-iter (/ missing-time iter-time))) + ;; `iter-time' is approximate because of effects like the GC, + ;; so multiply at most by 10, in case we are wildly off the mark. + (loop (max repetitions + (min (ceiling missing-iter) + (* 10 repetitions))) + sum)))))))) + +;;;###autoload (defmacro benchmark-run (&optional repetitions &rest forms) "Time execution of FORMS. If REPETITIONS is supplied as a number, run FORMS that many times, @@ -53,20 +110,7 @@ See also `benchmark-run-compiled'." (unless (or (natnump repetitions) (and repetitions (symbolp repetitions))) (setq forms (cons repetitions forms) repetitions 1)) - (let ((i (make-symbol "i")) - (gcs (make-symbol "gcs")) - (gc (make-symbol "gc"))) - `(let ((,gc gc-elapsed) - (,gcs gcs-done)) - (list ,(if (or (symbolp repetitions) (> repetitions 1)) - ;; Take account of the loop overhead. - `(- (benchmark-elapse (dotimes (,i ,repetitions) - ,@forms)) - (benchmark-elapse (dotimes (,i ,repetitions) - nil))) - `(benchmark-elapse ,@forms)) - (- gcs-done ,gcs) - (- gc-elapsed ,gc))))) + `(benchmark-call (lambda () ,@forms) ,repetitions)) ;;;###autoload (defmacro benchmark-run-compiled (&optional repetitions &rest forms) @@ -78,21 +122,7 @@ result. The overhead of the `lambda's is accounted for." (unless (or (natnump repetitions) (and repetitions (symbolp repetitions))) (setq forms (cons repetitions forms) repetitions 1)) - (let ((i (make-symbol "i")) - (gcs (make-symbol "gcs")) - (gc (make-symbol "gc")) - (code (byte-compile `(lambda () ,@forms))) - (lambda-code (byte-compile '(lambda ())))) - `(let ((,gc gc-elapsed) - (,gcs gcs-done)) - (list ,(if (or (symbolp repetitions) (> repetitions 1)) - ;; Take account of the loop overhead. - `(- (benchmark-elapse (dotimes (,i ,repetitions) - (funcall ,code))) - (benchmark-elapse (dotimes (,i ,repetitions) - (funcall ,lambda-code)))) - `(benchmark-elapse (funcall ,code))) - (- gcs-done ,gcs) (- gc-elapsed ,gc))))) + `(benchmark-call (byte-compile '(lambda () ,@forms)) ,repetitions)) ;;;###autoload (defun benchmark (repetitions form) @@ -100,9 +130,15 @@ result. The overhead of the `lambda's is accounted for." Interactively, REPETITIONS is taken from the prefix arg, and the command prompts for the form to benchmark. For non-interactive use see also `benchmark-run' and -`benchmark-run-compiled'." +`benchmark-run-compiled'. +FORM can also be a function in which case we measure the time it takes +to call it without any argument." (interactive "p\nxForm: ") - (let ((result (eval `(benchmark-run ,repetitions ,form) t))) + (let ((result (benchmark-call (eval (pcase form + ((or `#',_ `(lambda . ,_)) form) + (_ `(lambda () ,form))) + t) + repetitions))) (if (zerop (nth 1 result)) (message "Elapsed time: %fs" (car result)) (message "Elapsed time: %fs (%fs in %d GCs)" (car result) diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 40c17b916f9..5afc6d3bde3 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -89,33 +89,39 @@ Useful if new Emacs is used on B&W display.") (declare-function x-display-color-cells "xfns.c" (&optional terminal)) -(defvar chart-face-list - (if (display-color-p) - (let ((cl chart-face-color-list) - (pl chart-face-pixmap-list) - (faces ()) - nf) - (while cl - (setq nf (make-face - (intern (concat "chart-" (car cl) "-" (car pl))))) - (set-face-background nf (if (condition-case nil - (> (x-display-color-cells) 4) - (error t)) - (car cl) - "white")) - (set-face-foreground nf "black") - (if (and chart-face-use-pixmaps pl) - (condition-case nil - (set-face-background-pixmap nf (car pl)) - (error (message "Cannot set background pixmap %s" (car pl))))) - (push nf faces) - (setq cl (cdr cl) - pl (cdr pl))) - faces)) +(defvar chart-face-list #'chart--face-list "Faces used to colorize charts. +This should either be a list of faces, or a function that returns +a list of faces. + List is limited currently, which is ok since you really can't display too much in text characters anyways.") +(defun chart--face-list () + (and + (display-color-p) + (let ((cl chart-face-color-list) + (pl chart-face-pixmap-list) + (faces ()) + nf) + (while cl + (setq nf (make-face + (intern (concat "chart-" (car cl) "-" (car pl))))) + (set-face-background nf (if (condition-case nil + (> (x-display-color-cells) 4) + (error t)) + (car cl) + "white")) + (set-face-foreground nf "black") + (if (and chart-face-use-pixmaps pl) + (condition-case nil + (set-face-background-pixmap nf (car pl)) + (error (message "Cannot set background pixmap %s" (car pl))))) + (push nf faces) + (setq cl (cdr cl) + pl (cdr pl))) + faces))) + (define-derived-mode chart-mode special-mode "Chart" "Define a mode in Emacs for displaying a chart." (buffer-disable-undo) @@ -374,7 +380,10 @@ of the drawing." (let* ((data (oref c sequences)) (dir (oref c direction)) (odir (if (eq dir 'vertical) 'horizontal 'vertical)) - ) + (faces + (if (functionp chart-face-list) + (funcall chart-face-list) + chart-face-list))) (while data (if (stringp (car (oref (car data) data))) ;; skip string lists... @@ -390,10 +399,9 @@ of the drawing." (zp (if (eq dir 'vertical) (chart-translate-ypos c 0) (chart-translate-xpos c 0))) - (fc (if chart-face-list - (nth (% i (length chart-face-list)) chart-face-list) - 'default)) - ) + (fc (if faces + (nth (% i (length faces)) faces) + 'default))) (if (< dp zp) (progn (chart-draw-line dir (car rng) dp zp) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index b7ffd25d62c..55c7e67daa6 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2068,6 +2068,8 @@ Like `cl-flet' but the definitions can refer to previous ones. ;; even handle mutually recursive functions. (letrec ((done nil) ;; Non-nil if some TCO happened. + ;; This var always holds the value `nil' until (just before) we + ;; exit the loop. (retvar (make-symbol "retval")) (ofargs (mapcar (lambda (s) (if (memq s cl--lambda-list-keywords) s (make-symbol (symbol-name s)))) @@ -2100,6 +2102,12 @@ Like `cl-flet' but the definitions can refer to previous ones. (`(progn . ,exps) `(progn . ,(funcall opt-exps exps))) (`(if ,cond ,then . ,else) `(if ,cond ,(funcall opt then) . ,(funcall opt-exps else))) + (`(and . ,exps) `(and . ,(funcall opt-exps exps))) + (`(or ,arg) (funcall opt arg)) + (`(or ,arg . ,args) + (let ((val (make-symbol "val"))) + `(let ((,val ,arg)) + (if ,val ,(funcall opt val) ,(funcall opt `(or . ,args)))))) (`(cond . ,conds) (let ((cs '())) (while conds @@ -2109,14 +2117,18 @@ Like `cl-flet' but the definitions can refer to previous ones. ;; This returns the value of `exp' but it's ;; only in tail position if it's the ;; last condition. + ;; Note: This may set the var before we + ;; actually exit the loop, but luckily it's + ;; only the case if we set the var to nil, + ;; so it does preserve the invariant that + ;; the var is nil until we exit the loop. `((setq ,retvar ,exp) nil) `(,(funcall opt exp))) cs)) (exps (push (funcall opt-exps exps) cs)))) - (if (eq t (caar cs)) - `(cond . ,(nreverse cs)) - `(cond ,@(nreverse cs) (t (setq ,retvar nil)))))) + ;; No need to set `retvar' to return nil. + `(cond . ,(nreverse cs)))) ((and `(,(or 'let 'let*) ,bindings . ,exps) (guard ;; Note: it's OK for this `let' to shadow any @@ -2128,8 +2140,8 @@ Like `cl-flet' but the definitions can refer to previous ones. ;; tail-called any more. (not (memq var shadowings))))) `(,(car exp) ,bindings . ,(funcall opt-exps exps))) - (_ - `(progn (setq ,retvar ,exp) nil)))))) + ('nil nil) ;No need to set `retvar' to return nil. + (_ `(progn (setq ,retvar ,exp) nil)))))) (let ((optimized-body (funcall opt-exps body))) (if (not done) @@ -2275,7 +2287,7 @@ of `cl-symbol-macrolet' to additionally expand symbol macros." ;; on this behavior (haven't found any yet). ;; Such code should explicitly use `cl-letf' instead, I think. ;; - ;; (`(,(or `let `let*) . ,(or `(,bindings . ,body) dontcare)) + ;; (`(,(or `let `let*) . ,(or `(,bindings . ,body) pcase--dontcare)) ;; (let ((letf nil) (found nil) (nbs ())) ;; (dolist (binding bindings) ;; (let* ((var (if (symbolp binding) binding (car binding))) diff --git a/lisp/emacs-lisp/generator.el b/lisp/emacs-lisp/generator.el index e45260c32ac..4ae20ba4205 100644 --- a/lisp/emacs-lisp/generator.el +++ b/lisp/emacs-lisp/generator.el @@ -1,6 +1,6 @@ ;;; generator.el --- generators -*- lexical-binding: t -*- -;;; Copyright (C) 2015-2021 Free Software Foundation, Inc. +;; Copyright (C) 2015-2021 Free Software Foundation, Inc. ;; Author: Daniel Colascione <dancol@dancol.org> ;; Keywords: extensions, elisp diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index 3d8054950c1..ce48e578e0b 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -324,8 +324,7 @@ The return value is the last VAL in the list. (gv-letplace (getter setter) place (funcall do `(edebug-after ,before ,index ,getter) (lambda (store) - `(progn (edebug-after ,before ,index ,getter) - ,(funcall setter store))))))) + `(edebug-after ,before ,index ,(funcall setter store))))))) ;;; The common generalized variables. diff --git a/lisp/emacs-lisp/memory-report.el b/lisp/emacs-lisp/memory-report.el index 3d6ca957e63..ecbca280e59 100644 --- a/lisp/emacs-lisp/memory-report.el +++ b/lisp/emacs-lisp/memory-report.el @@ -295,7 +295,7 @@ by counted more than once." (- (position-bytes (point-min))) (gap-size))) (seq-reduce #'+ (mapcar (lambda (elem) - (if (cdr elem) + (if (and (consp elem) (cdr elem)) (memory-report--object-size (make-hash-table :test #'eq) (cdr elem)) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 059eda602c3..f1022f08f1b 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2223,10 +2223,13 @@ directory." (package-install-from-buffer))) ;;;###autoload -(defun package-install-selected-packages () +(defun package-install-selected-packages (&optional noconfirm) "Ensure packages in `package-selected-packages' are installed. -If some packages are not installed propose to install them." +If some packages are not installed, propose to install them. +If optional argument NOCONFIRM is non-nil, don't ask for +confirmation to install packages." (interactive) + (package--archives-initialize) ;; We don't need to populate `package-selected-packages' before ;; using here, because the outcome is the same either way (nothing ;; gets installed). @@ -2237,10 +2240,11 @@ If some packages are not installed propose to install them." (difference (- (length not-installed) (length available)))) (cond (available - (when (y-or-n-p - (format "Packages to install: %d (%s), proceed? " - (length available) - (mapconcat #'symbol-name available " "))) + (when (or noconfirm + (y-or-n-p + (format "Packages to install: %d (%s), proceed? " + (length available) + (mapconcat #'symbol-name available " ")))) (mapc (lambda (p) (package-install p 'dont-select)) available))) ((> difference 0) (message "Packages that are not available: %d (the rest is already installed), maybe you need to `M-x package-refresh-contents'" diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el index a0085662e22..1a13aa95cd2 100644 --- a/lisp/erc/erc-autoaway.el +++ b/lisp/erc/erc-autoaway.el @@ -1,4 +1,4 @@ -;;; erc-autoaway.el --- Provides autoaway for ERC +;;; erc-autoaway.el --- Provides autoaway for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc. @@ -58,7 +58,7 @@ function each time you change `erc-autoaway-idle-seconds'." (setq erc-autoaway-idletimer (run-with-idle-timer erc-autoaway-idle-seconds t - 'erc-autoaway-set-away + #'erc-autoaway-set-away erc-autoaway-idle-seconds))) (defun erc-autoaway-some-server-buffer () @@ -66,21 +66,21 @@ function each time you change `erc-autoaway-idle-seconds'." If none is found, return nil." (car (erc-buffer-list #'erc-open-server-buffer-p))) -(defun erc-autoaway-insinuate-maybe (&optional server &rest ignored) +(defun erc-autoaway-insinuate-maybe (&optional server &rest _ignored) "Add autoaway reset function to `post-command-hook' if at least one ERC process is alive. This is used when `erc-autoaway-idle-method' is `user'." (when (or server (erc-autoaway-some-server-buffer)) - (add-hook 'post-command-hook 'erc-autoaway-reset-idle-user))) + (add-hook 'post-command-hook #'erc-autoaway-reset-idle-user))) -(defun erc-autoaway-remove-maybe (&rest ignored) +(defun erc-autoaway-remove-maybe (&rest _ignored) "Remove the autoaway reset function from `post-command-hook' if no ERC process is alive. This is used when `erc-autoaway-idle-method' is `user'." (unless (erc-autoaway-some-server-buffer) - (remove-hook 'post-command-hook 'erc-autoaway-reset-idle-user))) + (remove-hook 'post-command-hook #'erc-autoaway-reset-idle-user))) ;;;###autoload(autoload 'erc-autoaway-mode "erc-autoaway") (define-erc-module autoaway nil @@ -107,36 +107,36 @@ set you no longer away. Related variables: `erc-public-away-p' and `erc-away-nickname'." ;; Enable: ((when (boundp 'erc-autoaway-idle-method) - (add-hook 'erc-connect-pre-hook 'erc-autoaway-reset-indicators) + (add-hook 'erc-connect-pre-hook #'erc-autoaway-reset-indicators) (setq erc-autoaway-last-sent-time (erc-current-time)) (cond ((eq erc-autoaway-idle-method 'irc) - (add-hook 'erc-send-completed-hook 'erc-autoaway-reset-idle-irc) - (add-hook 'erc-server-001-functions 'erc-autoaway-reset-idle-irc)) + (add-hook 'erc-send-completed-hook #'erc-autoaway-reset-idle-irc) + (add-hook 'erc-server-001-functions #'erc-autoaway-reset-idle-irc)) ((eq erc-autoaway-idle-method 'user) - (add-hook 'erc-after-connect 'erc-autoaway-insinuate-maybe) - (add-hook 'erc-disconnected-hook 'erc-autoaway-remove-maybe) + (add-hook 'erc-after-connect #'erc-autoaway-insinuate-maybe) + (add-hook 'erc-disconnected-hook #'erc-autoaway-remove-maybe) (erc-autoaway-insinuate-maybe)) ((eq erc-autoaway-idle-method 'emacs) (erc-autoaway-reestablish-idletimer))) - (add-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away) - (add-hook 'erc-server-305-functions 'erc-autoaway-reset-indicators))) + (add-hook 'erc-timer-hook #'erc-autoaway-possibly-set-away) + (add-hook 'erc-server-305-functions #'erc-autoaway-reset-indicators))) ;; Disable: ((when (boundp 'erc-autoaway-idle-method) - (remove-hook 'erc-connect-pre-hook 'erc-autoaway-reset-indicators) + (remove-hook 'erc-connect-pre-hook #'erc-autoaway-reset-indicators) (cond ((eq erc-autoaway-idle-method 'irc) - (remove-hook 'erc-send-completed-hook 'erc-autoaway-reset-idle-irc) - (remove-hook 'erc-server-001-functions 'erc-autoaway-reset-idle-irc)) + (remove-hook 'erc-send-completed-hook #'erc-autoaway-reset-idle-irc) + (remove-hook 'erc-server-001-functions #'erc-autoaway-reset-idle-irc)) ((eq erc-autoaway-idle-method 'user) - (remove-hook 'post-command-hook 'erc-autoaway-reset-idle-user) - (remove-hook 'erc-after-connect 'erc-autoaway-insinuate-maybe) - (remove-hook 'erc-disconnected-hook 'erc-autoaway-remove-maybe)) + (remove-hook 'post-command-hook #'erc-autoaway-reset-idle-user) + (remove-hook 'erc-after-connect #'erc-autoaway-insinuate-maybe) + (remove-hook 'erc-disconnected-hook #'erc-autoaway-remove-maybe)) ((eq erc-autoaway-idle-method 'emacs) (cancel-timer erc-autoaway-idletimer) (setq erc-autoaway-idletimer nil))) - (remove-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away) - (remove-hook 'erc-server-305-functions 'erc-autoaway-reset-indicators)))) + (remove-hook 'erc-timer-hook #'erc-autoaway-possibly-set-away) + (remove-hook 'erc-server-305-functions #'erc-autoaway-reset-indicators)))) (defcustom erc-autoaway-idle-method 'user "The method used to determine how long you have been idle. @@ -148,7 +148,6 @@ The time itself is specified by `erc-autoaway-idle-seconds'. See `erc-autoaway-mode' for more information on the various definitions of being idle." - :group 'erc-autoaway :type '(choice (const :tag "User idle time" user) (const :tag "Emacs idle time" emacs) (const :tag "Last IRC action" irc)) @@ -166,7 +165,6 @@ ERC autoaway mode can set you away when you idle, and set you no longer away when you type something. This variable controls whether you will be set away when you idle. See `erc-auto-discard-away' for the other half." - :group 'erc-autoaway :type 'boolean) (defcustom erc-auto-discard-away t @@ -176,20 +174,17 @@ longer away when you type something. This variable controls whether you will be set no longer away when you type something. See `erc-auto-set-away' for the other half. See also `erc-autoaway-no-auto-discard-regexp'." - :group 'erc-autoaway :type 'boolean) (defcustom erc-autoaway-no-auto-discard-regexp "^/g?away.*$" "Input that matches this will not automatically discard away status. See `erc-auto-discard-away'." - :group 'erc-autoaway :type 'regexp) (defcustom erc-autoaway-idle-seconds 1800 "Number of seconds after which ERC will set you automatically away. If you are changing this variable using lisp instead of customizing it, you have to run `erc-autoaway-reestablish-idletimer' afterwards." - :group 'erc-autoaway :set (lambda (sym val) (set-default sym val) (when (eq erc-autoaway-idle-method 'emacs) @@ -201,10 +196,9 @@ you have to run `erc-autoaway-reestablish-idletimer' afterwards." "Message ERC will use when setting you automatically away. It is used as a `format' string with the argument of the idletime in seconds." - :group 'erc-autoaway :type 'string) -(defun erc-autoaway-reset-idle-user (&rest stuff) +(defun erc-autoaway-reset-idle-user (&rest _stuff) "Reset the stored user idle time. This is one global variable since a user talking on one net can talk on another net too." @@ -212,7 +206,7 @@ talk on another net too." (erc-autoaway-set-back #'erc-autoaway-remove-maybe)) (setq erc-autoaway-last-sent-time (erc-current-time))) -(defun erc-autoaway-reset-idle-irc (line &rest stuff) +(defun erc-autoaway-reset-idle-irc (line &rest _stuff) "Reset the stored IRC idle time. This is one global variable since a user talking on one net can talk on another net too." @@ -272,7 +266,7 @@ active server buffer available." (setq erc-autoaway-caused-away t) (erc-cmd-GAWAY (format-message erc-autoaway-message idle-time)))) -(defun erc-autoaway-reset-indicators (&rest stuff) +(defun erc-autoaway-reset-indicators (&rest _stuff) "Reset indicators used by the erc-autoaway module." (setq erc-autoaway-last-sent-time (erc-current-time)) (setq erc-autoaway-caused-away nil)) diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 73c2b56b02e..b1f97aea069 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -268,7 +268,6 @@ protection algorithm.") "Non-nil means that ERC will attempt to reestablish broken connections. Reconnection will happen automatically for any unexpected disconnection." - :group 'erc-server :type 'boolean) (defcustom erc-server-reconnect-attempts 2 @@ -276,7 +275,6 @@ Reconnection will happen automatically for any unexpected disconnection." broken connection, or t to always attempt to reconnect. This only has an effect if `erc-server-auto-reconnect' is non-nil." - :group 'erc-server :type '(choice (const :tag "Always reconnect" t) integer)) @@ -285,7 +283,6 @@ This only has an effect if `erc-server-auto-reconnect' is non-nil." successive reconnect attempts. If a key is pressed while ERC is waiting, it will stop waiting." - :group 'erc-server :type 'number) (defcustom erc-split-line-length 440 @@ -299,14 +296,12 @@ And a typical message looks like this: You can limit here the maximum length of the \"Hello!\" part. Good luck." - :type 'integer - :group 'erc-server) + :type 'integer) (defcustom erc-coding-system-precedence '(utf-8 undecided) "List of coding systems to be preferred when receiving a string from the server. This will only be consulted if the coding system in `erc-server-coding-system' is `undecided'." - :group 'erc-server :version "24.1" :type '(repeat coding-system)) @@ -331,7 +326,6 @@ If you need to send non-ASCII text to people not using a client that does decoding on its own, you must tell ERC what encoding to use. Emacs cannot guess it, since it does not know what the people on the other end of the line are using." - :group 'erc-server :type '(choice (const :tag "None" nil) coding-system (cons (coding-system :tag "encoding" :value utf-8) @@ -346,37 +340,32 @@ current target as returned by `erc-default-target'. Example: If you know that the channel #linux-ru uses the coding-system `cyrillic-koi8', then add (\"#linux-ru\" . cyrillic-koi8) to the alist." - :group 'erc-server :type '(repeat (cons (regexp :tag "Target") coding-system))) (defcustom erc-server-connect-function #'erc-open-network-stream "Function used to initiate a connection. It should take same arguments as `open-network-stream' does." - :group 'erc-server :type 'function) (defcustom erc-server-prevent-duplicates '("301") "Either nil or a list of strings. Each string is a IRC message type, like PRIVMSG or NOTICE. All Message types in that list of subjected to duplicate prevention." - :type '(choice (const nil) (list string)) - :group 'erc-server) + :type '(choice (const nil) (list string))) (defcustom erc-server-duplicate-timeout 60 "The time allowed in seconds between duplicate messages. If two identical messages arrive within this value of one another, the second isn't displayed." - :type 'integer - :group 'erc-server) + :type 'integer) (defcustom erc-server-timestamp-format "%Y-%m-%d %T" "Timestamp format used with server response messages. This string is processed using `format-time-string'." :version "24.3" - :type 'string - :group 'erc-server) + :type 'string) ;;; Flood-related @@ -395,22 +384,19 @@ detailed in RFC 2813, section 5.8 \"Flood control of clients\". time, send a message, and increase `erc-server-flood-last-message' by `erc-server-flood-penalty' for each message." - :type 'integer - :group 'erc-server) + :type 'integer) (defcustom erc-server-flood-penalty 3 "How much we penalize a message. See `erc-server-flood-margin' for an explanation of the flood protection algorithm." - :type 'integer - :group 'erc-server) + :type 'integer) ;; Ping handling (defcustom erc-server-send-ping-interval 30 "Interval of sending pings to the server, in seconds. If this is set to nil, pinging the server is disabled." - :group 'erc-server :type '(choice (const :tag "Disabled" nil) (integer :tag "Seconds"))) @@ -422,7 +408,6 @@ This must be greater than or equal to the value for `erc-server-send-ping-interval'. If this is set to nil, never try to reconnect." - :group 'erc-server :type '(choice (const :tag "Disabled" nil) (integer :tag "Seconds"))) @@ -1082,9 +1067,6 @@ Finds hooks by looking in the `erc-server-responses' hash table." (cl-defmacro define-erc-response-handler ((name &rest aliases) &optional extra-fn-doc extra-var-doc &rest fn-body) - (declare (debug (&define [&name "erc-response-handler@" - (symbolp &rest symbolp)] - &optional sexp sexp def-body))) "Define an ERC handler hook/function pair. NAME is the response name as sent by the server (see the IRC RFC for meanings). @@ -1164,6 +1146,9 @@ Would expand to: See also `erc-server-311'.\")) \(fn (NAME &rest ALIASES) &optional EXTRA-FN-DOC EXTRA-VAR-DOC &rest FN-BODY)" + (declare (debug (&define [&name "erc-response-handler@" + (symbolp &rest symbolp)] + &optional sexp sexp def-body))) (if (numberp name) (setq name (intern (format "%03i" name)))) (setq aliases (mapcar (lambda (a) (if (numberp a) @@ -1226,8 +1211,8 @@ add things to `%s' instead." ,@(cl-loop for fn in fn-alternates for var in var-alternates for a in aliases - nconc (list `(defalias ',fn ',fn-name) - `(defvar ,var ',fn-name ,(format hook-doc a)) + nconc (list `(defalias ',fn #',fn-name) + `(defvar ,var #',fn-name ,(format hook-doc a)) `(put ',var 'definition-name ',hook-name)))))) (define-erc-response-handler (ERROR) diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index 0a81da38974..8b13d1cf49c 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -52,14 +52,14 @@ ;;;###autoload(autoload 'erc-button-mode "erc-button" nil t) (define-erc-module button nil "This mode buttonizes all messages according to `erc-button-alist'." - ((add-hook 'erc-insert-modify-hook 'erc-button-add-buttons 'append) - (add-hook 'erc-send-modify-hook 'erc-button-add-buttons 'append) - (add-hook 'erc-complete-functions 'erc-button-next-function) - (add-hook 'erc-mode-hook 'erc-button-setup)) - ((remove-hook 'erc-insert-modify-hook 'erc-button-add-buttons) - (remove-hook 'erc-send-modify-hook 'erc-button-add-buttons) - (remove-hook 'erc-complete-functions 'erc-button-next-function) - (remove-hook 'erc-mode-hook 'erc-button-setup))) + ((add-hook 'erc-insert-modify-hook #'erc-button-add-buttons 'append) + (add-hook 'erc-send-modify-hook #'erc-button-add-buttons 'append) + (add-hook 'erc-complete-functions #'erc-button-next-function) + (add-hook 'erc-mode-hook #'erc-button-setup)) + ((remove-hook 'erc-insert-modify-hook #'erc-button-add-buttons) + (remove-hook 'erc-send-modify-hook #'erc-button-add-buttons) + (remove-hook 'erc-complete-functions #'erc-button-next-function) + (remove-hook 'erc-mode-hook #'erc-button-setup))) ;;; Variables @@ -91,7 +91,6 @@ above them." (defcustom erc-button-url-regexp browse-url-button-regexp "Regular expression that matches URLs." :version "27.1" - :group 'erc-button :type 'regexp) (defcustom erc-button-wrap-long-urls nil @@ -100,18 +99,15 @@ above them." If this variable is a number, consider URLs longer than its value to be \"long\". If t, URLs will be considered \"long\" if they are longer than `erc-fill-column'." - :group 'erc-button :type '(choice integer boolean)) (defcustom erc-button-buttonize-nicks t "Flag indicating whether nicks should be buttonized or not." - :group 'erc-button :type 'boolean) (defcustom erc-button-rfc-url "http://www.faqs.org/rfcs/rfc%s.html" "URL used to browse rfc references. %s is replaced by the number." - :group 'erc-button :type 'string) (define-obsolete-variable-alias 'erc-button-google-url @@ -121,7 +117,6 @@ longer than `erc-fill-column'." "URL used to search for a term. %s is replaced by the search string." :version "27.1" - :group 'erc-button :type 'string) (defcustom erc-button-alist @@ -179,7 +174,6 @@ PAR is a number of a regexp grouping whose text will be passed to CALLBACK. There can be several PAR arguments. If REGEXP is \\='nicknames, these are ignored, and CALLBACK will be called with the nickname matched as the argument." - :group 'erc-button :version "24.1" ; remove finger (bug#4443) :type '(repeat (list :tag "Button" @@ -200,20 +194,18 @@ PAR is a number of a regexp grouping whose text will be passed to (defcustom erc-emacswiki-url "https://www.emacswiki.org/cgi-bin/wiki.pl?" "URL of the EmacsWiki Homepage." - :group 'erc-button :type 'string) (defcustom erc-emacswiki-lisp-url "https://www.emacswiki.org/elisp/" "URL of the EmacsWiki ELisp area." - :group 'erc-button :type 'string) (defvar erc-button-keymap (let ((map (make-sparse-keymap))) - (define-key map (kbd "RET") 'erc-button-press-button) - (define-key map (kbd "<mouse-2>") 'erc-button-click-button) - (define-key map (kbd "TAB") 'erc-button-next) - (define-key map (kbd "<backtab>") 'erc-button-previous) + (define-key map (kbd "RET") #'erc-button-press-button) + (define-key map (kbd "<mouse-2>") #'erc-button-click-button) + (define-key map (kbd "TAB") #'erc-button-next) + (define-key map (kbd "<backtab>") #'erc-button-previous) (define-key map [follow-link] 'mouse-face) (set-keymap-parent map erc-mode-map) map) @@ -244,7 +236,7 @@ global-level ERC button keys yet.") "Add ERC mode-level button movement keys. This is only done once." ;; Add keys. (unless erc-button-keys-added - (define-key erc-mode-map (kbd "<backtab>") 'erc-button-previous) + (define-key erc-mode-map (kbd "<backtab>") #'erc-button-previous) (setq erc-button-keys-added t))) (defun erc-button-add-buttons () @@ -287,7 +279,7 @@ specified by `erc-button-alist'." (fun (nth 3 entry)) bounds word) (when (or (eq t form) - (eval form)) + (eval form t)) (goto-char (point-min)) (while (erc-forward-word) (when (setq bounds (erc-bounds-of-word-at-point)) @@ -306,9 +298,9 @@ specified by `erc-button-alist'." (end (match-end (nth 1 entry))) (form (nth 2 entry)) (fun (nth 3 entry)) - (data (mapcar 'match-string (nthcdr 4 entry)))) + (data (mapcar #'match-string (nthcdr 4 entry)))) (when (or (eq t form) - (eval form)) + (eval form t)) (erc-button-add-button start end fun nil data regexp))))) (defun erc-button-remove-old-buttons () @@ -483,7 +475,6 @@ Examples: (format \"ldapsearch -x -P 2 -h db.debian.org -b dc=debian,dc=org ircnick=%s\" nick)))" - :group 'erc-button :type '(repeat (cons (string :tag "Op") sexp))) diff --git a/lisp/erc/erc-capab.el b/lisp/erc/erc-capab.el index 4e4d012545a..2028917da0c 100644 --- a/lisp/erc/erc-capab.el +++ b/lisp/erc/erc-capab.el @@ -1,4 +1,4 @@ -;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB +;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB -*- lexical-binding: t; -*- ;; Copyright (C) 2006-2021 Free Software Foundation, Inc. @@ -80,12 +80,10 @@ If you change this from the default \"*\", be sure to use a character not found in IRC nicknames to avoid confusion." - :group 'erc-capab :type '(choice string (const nil))) (defface erc-capab-identify-unidentified '((t)) ; same as `erc-default-face' "Face to use for `erc-capab-identify-prefix'." - :group 'erc-capab :group 'erc-faces) ;;; Define module: @@ -94,22 +92,22 @@ character not found in IRC nicknames to avoid confusion." (define-erc-module capab-identify nil "Handle dancer-ircd's CAPAB IDENTIFY-MSG and IDENTIFY-CTCP." ;; append so that `erc-server-parameters' is already set by `erc-server-005' - ((add-hook 'erc-server-005-functions 'erc-capab-identify-setup t) - (add-hook 'erc-server-290-functions 'erc-capab-identify-activate) + ((add-hook 'erc-server-005-functions #'erc-capab-identify-setup t) + (add-hook 'erc-server-290-functions #'erc-capab-identify-activate) (add-hook 'erc-server-PRIVMSG-functions - 'erc-capab-identify-remove/set-identified-flag) + #'erc-capab-identify-remove/set-identified-flag) (add-hook 'erc-server-NOTICE-functions - 'erc-capab-identify-remove/set-identified-flag) - (add-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix t) + #'erc-capab-identify-remove/set-identified-flag) + (add-hook 'erc-insert-modify-hook #'erc-capab-identify-add-prefix t) (mapc (lambda (buffer) (when buffer (with-current-buffer buffer (erc-capab-identify-setup)))) - (erc-buffer-list 'erc-open-server-buffer-p))) - ((remove-hook 'erc-server-005-functions 'erc-capab-identify-setup) - (remove-hook 'erc-server-290-functions 'erc-capab-identify-activate) + (erc-buffer-list #'erc-open-server-buffer-p))) + ((remove-hook 'erc-server-005-functions #'erc-capab-identify-setup) + (remove-hook 'erc-server-290-functions #'erc-capab-identify-activate) ;; we don't remove the `erc-capab-identify-remove/set-identified-flag' hooks ;; because there doesn't seem to be a way to tell the server to turn it off - (remove-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix))) + (remove-hook 'erc-insert-modify-hook #'erc-capab-identify-add-prefix))) ;;; Variables: @@ -121,7 +119,7 @@ character not found in IRC nicknames to avoid confusion." ;;; Functions: -(defun erc-capab-identify-setup (&optional proc parsed) +(defun erc-capab-identify-setup (&optional _proc _parsed) "Set up CAPAB IDENTIFY on the current server. Optional argument PROC is the current server's process. @@ -146,19 +144,19 @@ These arguments are sent to this function when called as a hook in (setq erc-capab-identify-sent t))) -(defun erc-capab-identify-activate (proc parsed) +(defun erc-capab-identify-activate (_proc parsed) "Set `erc-capab-identify-activated' and display an activation message. PROC is the current server's process. PARSED is an `erc-parsed' response struct." - (when (or (string= "IDENTIFY-MSG" (erc-response.contents parsed)) - (string= "IDENTIFY-CTCP" (erc-response.contents parsed))) + (when (member (erc-response.contents parsed) + '("IDENTIFY-MSG" "IDENTIFY-CTCP")) (setq erc-capab-identify-activated t) (erc-display-message parsed 'notice 'active (format "%s activated" (erc-response.contents parsed))))) -(defun erc-capab-identify-remove/set-identified-flag (proc parsed) +(defun erc-capab-identify-remove/set-identified-flag (_proc parsed) "Remove PARSED message's id flag and add the `erc-identified' text property. PROC is the current server's process. diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index e72d8fbe3db..234b4b5a71d 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -1,4 +1,4 @@ -;;; erc-dcc.el --- CTCP DCC module for ERC +;;; erc-dcc.el --- CTCP DCC module for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 1993-1995, 1998, 2002-2004, 2006-2021 Free Software ;; Foundation, Inc. @@ -55,12 +55,6 @@ ;; Require at run-time too to silence compiler. (require 'pcomplete) -;;;###autoload(autoload 'erc-dcc-mode "erc-dcc") -(define-erc-module dcc nil - "Provide Direct Client-to-Client support for ERC." - ((add-hook 'erc-server-401-functions 'erc-dcc-no-such-nick)) - ((remove-hook 'erc-server-401-functions 'erc-dcc-no-such-nick))) - (defgroup erc-dcc nil "DCC stands for Direct Client Communication, where you and your friend's client programs connect directly to each other, @@ -71,9 +65,14 @@ Using DCC get and send, you can transfer files directly from and to other IRC users." :group 'erc) +;;;###autoload(autoload 'erc-dcc-mode "erc-dcc") +(define-erc-module dcc nil + "Provide Direct Client-to-Client support for ERC." + ((add-hook 'erc-server-401-functions #'erc-dcc-no-such-nick)) + ((remove-hook 'erc-server-401-functions #'erc-dcc-no-such-nick))) + (defcustom erc-dcc-verbose nil "If non-nil, be verbose about DCC activity reporting." - :group 'erc-dcc :type 'boolean) (defconst erc-dcc-connection-types @@ -120,7 +119,8 @@ All values of the list must be uppercase strings.") ;; more: the entry data from erc-dcc-list for this particular process. (defvar erc-dcc-connect-function 'erc-dcc-open-network-stream) -(defun erc-dcc-open-network-stream (procname buffer addr port entry) +(defun erc-dcc-open-network-stream (procname buffer addr port _entry) + ;; FIXME: Time to try activating this again!? (if nil; (fboundp 'open-network-stream-nowait) ;; this currently crashes ;; cvs emacs (open-network-stream-nowait procname buffer addr port) @@ -286,7 +286,6 @@ The result is also a string." "IP address to listen on when offering files. Should be set to a string or nil. If nil, automatic detection of the host interface to use will be attempted." - :group 'erc-dcc :type (list 'choice (list 'const :tag "Auto-detect" nil) (list 'string :tag "IP-address" :valid-regexp erc-dcc-ipv4-regexp))) @@ -295,7 +294,6 @@ the host interface to use will be attempted." "IP address to use for outgoing DCC offers. Should be set to a string or nil. If nil, use the value of `erc-dcc-listen-host'." - :group 'erc-dcc :type (list 'choice (list 'const :tag "Same as erc-dcc-listen-host" nil) (list 'string :tag "IP-address" :valid-regexp erc-dcc-ipv4-regexp))) @@ -306,7 +304,6 @@ Should be set to a string or nil. If nil, use the value of You might want to set `erc-dcc-auto-masks' for this. `auto' - Automatically accept the request and begin downloading the file `ignore' - Ignore incoming DCC Send requests completely." - :group 'erc-dcc :type '(choice (const ask) (const auto) (const ignore))) (defun erc-dcc-get-host (proc) @@ -323,7 +320,6 @@ If variable `erc-dcc-host' is non-nil, use it. Otherwise call (defcustom erc-dcc-port-range nil "If nil, any available user port is used for outgoing DCC connections. If set to a cons, it specifies a range of ports to use in the form (min . max)" - :group 'erc-dcc :type '(choice (const :tag "Any port" nil) (cons :tag "Port range" @@ -335,7 +331,6 @@ If set to a cons, it specifies a range of ports to use in the form (min . max)" accepted automatically. A user identifier has the form \"nick!login@host\". For instance, to accept all incoming DCC send offers automatically, add the string \".*!.*@.*\" to this list." - :group 'erc-dcc :type '(repeat regexp)) (defun erc-dcc-server (name filter sentinel) @@ -391,7 +386,6 @@ the accepted connection." (defcustom erc-dcc-get-default-directory nil "Default directory for incoming DCC file transfers. If this is nil, then the current value of `default-directory' is used." - :group 'erc-dcc :type '(choice (const nil :tag "Default directory") directory)) ;;;###autoload @@ -468,7 +462,7 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc." 'dcc-chat-offer ?n nick) t)))) -(defun erc-dcc-do-CLOSE-command (proc &optional type nick) +(defun erc-dcc-do-CLOSE-command (_proc &optional type nick) "Close a connection. Usage: /dcc close type nick. At least one of TYPE and NICK must be provided." ;; disambiguate type and nick if only one is provided @@ -540,7 +534,7 @@ PROC is the server process." (defvar-local erc-dcc-byte-count nil) -(defun erc-dcc-do-LIST-command (proc) +(defun erc-dcc-do-LIST-command (_proc) "This is the handler for the /dcc list command. It lists the current state of `erc-dcc-list' in an easy to read manner." (let ((alist erc-dcc-list) @@ -703,7 +697,6 @@ the matching regexp, or nil if none found." `ask' - Report the Chat request, and wait for the user to manually accept it `auto' - Automatically accept the request and open a new chat window `ignore' - Ignore incoming DCC chat requests completely." - :group 'erc-dcc :type '(choice (const ask) (const auto) (const ignore))) (defun erc-dcc-handle-ctcp-chat (proc query nick login host to) @@ -757,13 +750,11 @@ the matching regexp, or nil if none found." (defcustom erc-dcc-block-size 1024 "Block size to use for DCC SEND sessions." - :group 'erc-dcc :type 'integer) (defcustom erc-dcc-pump-bytes nil "If set to an integer, keep sending until that number of bytes are unconfirmed." - :group 'erc-dcc :type '(choice (const nil) integer)) (define-inline erc-dcc-get-parent (proc) @@ -837,7 +828,6 @@ bytes sent." '(erc-dcc-display-send erc-dcc-send-block) "Hook run whenever the remote end of a DCC SEND offer connected to your listening port." - :group 'erc-dcc :type 'hook) (defun erc-dcc-nick (plist) @@ -900,7 +890,6 @@ other client." (defcustom erc-dcc-receive-cache (* 1024 512) "Number of bytes to let the receive buffer grow before flushing it." - :group 'erc-dcc :type 'integer) (defvar-local erc-dcc-file-name nil) @@ -942,12 +931,12 @@ and making the connection." (set-process-coding-system proc 'binary 'binary) (set-buffer-file-coding-system 'binary t) - (set-process-filter proc 'erc-dcc-get-filter) - (set-process-sentinel proc 'erc-dcc-get-sentinel) + (set-process-filter proc #'erc-dcc-get-filter) + (set-process-sentinel proc #'erc-dcc-get-sentinel) (setq entry (plist-put entry :start-time (erc-current-time))) (setq entry (plist-put entry :peer proc))))) -(defun erc-dcc-append-contents (buffer file) +(defun erc-dcc-append-contents (buffer _file) "Append the contents of BUFFER to FILE. The contents of the BUFFER will then be erased." (with-current-buffer buffer @@ -1000,7 +989,7 @@ rather than every 1024 byte block, but nobody seems to care." proc (erc-pack-int received-bytes))))))) -(defun erc-dcc-get-sentinel (proc event) +(defun erc-dcc-get-sentinel (proc _event) "This is the process sentinel for CTCP DCC SEND connections. It shuts down the connection and notifies the user that the transfer is complete." @@ -1025,25 +1014,21 @@ transfer is complete." (defcustom erc-dcc-chat-buffer-name-format "DCC-CHAT-%s" "Format to use for DCC Chat buffer names." - :group 'erc-dcc :type 'string) (defcustom erc-dcc-chat-mode-hook nil "Hook calls when `erc-dcc-chat-mode' finished setting up the buffer." - :group 'erc-dcc :type 'hook) (defcustom erc-dcc-chat-connect-hook nil "" - :group 'erc-dcc :type 'hook) (defcustom erc-dcc-chat-exit-hook nil "" - :group 'erc-dcc :type 'hook) -(defun erc-cmd-CREQ (line &optional force) +(defun erc-cmd-CREQ (line &optional _force) "Set or get the DCC chat request flag. Possible values are: ask, auto, ignore." (when (string-match "^\\s-*\\(auto\\|ask\\|ignore\\)?$" line) @@ -1058,7 +1043,7 @@ Possible values are: ask, auto, ignore." erc-dcc-chat-request))) t))) -(defun erc-cmd-SREQ (line &optional force) +(defun erc-cmd-SREQ (line &optional _force) "Set or get the DCC send request flag. Possible values are: ask, auto, ignore." (when (string-match "^\\s-*\\(auto\\|ask\\|ignore\\)?$" line) @@ -1075,7 +1060,7 @@ Possible values are: ask, auto, ignore." (defun pcomplete/erc-mode/CREQ () (pcomplete-here '("auto" "ask" "ignore"))) -(defalias 'pcomplete/erc-mode/SREQ 'pcomplete/erc-mode/CREQ) +(defalias 'pcomplete/erc-mode/SREQ #'pcomplete/erc-mode/CREQ) (define-obsolete-variable-alias 'erc-dcc-chat-filter-hook 'erc-dcc-chat-filter-functions "24.3") @@ -1087,19 +1072,19 @@ the unprocessed output.") (defvar erc-dcc-chat-mode-map (let ((map (make-sparse-keymap))) - (define-key map (kbd "RET") 'erc-send-current-line) - (define-key map "\t" 'completion-at-point) + (define-key map (kbd "RET") #'erc-send-current-line) + (define-key map "\t" #'completion-at-point) map) "Keymap for `erc-dcc-mode'.") (define-derived-mode erc-dcc-chat-mode fundamental-mode "DCC-Chat" "Major mode for wasting time via DCC chat." (setq mode-line-process '(":%s") - erc-send-input-line-function 'erc-dcc-chat-send-input-line + erc-send-input-line-function #'erc-dcc-chat-send-input-line erc-default-recipients '(dcc)) - (add-hook 'completion-at-point-functions 'erc-complete-word-at-point nil t)) + (add-hook 'completion-at-point-functions #'erc-complete-word-at-point nil t)) -(defun erc-dcc-chat-send-input-line (recipient line &optional force) +(defun erc-dcc-chat-send-input-line (recipient line &optional _force) "Send LINE to the remote end. Argument RECIPIENT should always be the symbol dcc, and force is ignored." @@ -1150,14 +1135,14 @@ other client." (setq erc-input-marker (make-marker)) (erc-display-prompt buffer (point-max)) (set-process-buffer proc buffer) - (add-hook 'kill-buffer-hook 'erc-dcc-chat-buffer-killed nil t) + (add-hook 'kill-buffer-hook #'erc-dcc-chat-buffer-killed nil t) (run-hook-with-args 'erc-dcc-chat-connect-hook proc) buffer)) (defun erc-dcc-chat-accept (entry parent-proc) "Accept an incoming DCC connection and open a DCC window." - (let* ((nick (erc-extract-nick (plist-get entry :nick))) - buffer proc) + (let* (;; (nick (erc-extract-nick (plist-get entry :nick))) + proc) ;; buffer (setq proc (funcall erc-dcc-connect-function "dcc-chat" nil @@ -1167,9 +1152,10 @@ other client." ;; XXX: connected, should we kill the ip/port properties? (setq entry (plist-put entry :peer proc)) (setq entry (plist-put entry :parent parent-proc)) - (set-process-filter proc 'erc-dcc-chat-filter) - (set-process-sentinel proc 'erc-dcc-chat-sentinel) - (setq buffer (erc-dcc-chat-setup entry)))) + (set-process-filter proc #'erc-dcc-chat-filter) + (set-process-sentinel proc #'erc-dcc-chat-sentinel) + ;; (setq buffer + (erc-dcc-chat-setup entry))) ;; ) (defun erc-dcc-chat-filter (proc str) (let ((orig-buffer (current-buffer))) diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el index 056fb23777f..990f013cd2a 100644 --- a/lisp/erc/erc-desktop-notifications.el +++ b/lisp/erc/erc-desktop-notifications.el @@ -45,13 +45,11 @@ (defcustom erc-notifications-icon nil "Icon to use for notification." - :group 'erc-notifications :type '(choice (const :tag "No icon" nil) file)) (defcustom erc-notifications-bus :session "D-Bus bus to use for notification." :version "25.1" - :group 'erc-notifications :type '(choice (const :tag "Session bus" :session) string)) (defvar dbus-debug) ; used in the macroexpansion of dbus-ignore-errors @@ -99,11 +97,11 @@ This will replace the last notification sent with this function." (define-erc-module notifications nil "Send notifications on private message reception and mentions." ;; Enable - ((add-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG) - (add-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match)) + ((add-hook 'erc-server-PRIVMSG-functions #'erc-notifications-PRIVMSG) + (add-hook 'erc-text-matched-hook #'erc-notifications-notify-on-match)) ;; Disable - ((remove-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG) - (remove-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match))) + ((remove-hook 'erc-server-PRIVMSG-functions #'erc-notifications-PRIVMSG) + (remove-hook 'erc-text-matched-hook #'erc-notifications-notify-on-match))) (provide 'erc-desktop-notifications) diff --git a/lisp/erc/erc-ezbounce.el b/lisp/erc/erc-ezbounce.el index 8378ff53742..331d29a7b5b 100644 --- a/lisp/erc/erc-ezbounce.el +++ b/lisp/erc/erc-ezbounce.el @@ -1,4 +1,4 @@ -;;; erc-ezbounce.el --- Handle EZBounce bouncer commands +;;; erc-ezbounce.el --- Handle EZBounce bouncer commands -*- lexical-binding: t; -*- ;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc. @@ -33,7 +33,6 @@ (defcustom erc-ezb-regexp "^ezbounce!srv$" "Regexp used by the EZBouncer to identify itself to the user." - :group 'erc-ezbounce :type 'regexp) (defcustom erc-ezb-login-alist '() @@ -44,7 +43,6 @@ The alist's format is as follows: (((server . port) . (username . password)) ((server . port) . (username . password)) ...)" - :group 'erc-ezbounce :type '(repeat (cons (cons :tag "Server" string @@ -68,7 +66,7 @@ The alist's format is as follows: "Indicate whether current notices are expected to be EZB session listings.") ;;;###autoload -(defun erc-cmd-ezb (line &optional force) +(defun erc-cmd-ezb (line &optional _force) "Send EZB commands to the EZBouncer verbatim." (erc-server-send (concat "EZB " line))) (put 'erc-cmd-EZB 'do-not-parse-args t) @@ -102,7 +100,7 @@ in the alist is nil, prompt for the appropriate values." found)) ;;;###autoload -(defun erc-ezb-notice-autodetect (proc parsed) +(defun erc-ezb-notice-autodetect (_proc parsed) "React on an EZBounce NOTICE request." (let* ((sender (erc-response.sender parsed)) (message (erc-response.contents parsed)) @@ -113,7 +111,7 @@ in the alist is nil, prompt for the appropriate values." nil) ;;;###autoload -(defun erc-ezb-identify (message) +(defun erc-ezb-identify (_message) "Identify to the EZBouncer server." (let ((login (erc-ezb-get-login erc-session-server (erc-port-to-string erc-session-port)))) (unless (null login) @@ -122,13 +120,13 @@ in the alist is nil, prompt for the appropriate values." (erc-server-send (concat "LOGIN " username " " pass)))))) ;;;###autoload -(defun erc-ezb-init-session-list (message) +(defun erc-ezb-init-session-list (_message) "Reset the EZBounce session list to nil." (setq erc-ezb-session-list nil) (setq erc-ezb-inside-session-listing t)) ;;;###autoload -(defun erc-ezb-end-of-session-list (message) +(defun erc-ezb-end-of-session-list (_message) "Indicate the end of the EZBounce session listing." (setq erc-ezb-inside-session-listing nil)) @@ -143,7 +141,7 @@ in the alist is nil, prompt for the appropriate values." (add-to-list 'erc-ezb-session-list (list id nick to))))) ;;;###autoload -(defun erc-ezb-select (message) +(defun erc-ezb-select (_message) "Select an IRC server to use by EZBounce, in ERC style." (unless (and erc-ezb-session-list (erc-ezb-select-session)) @@ -169,7 +167,7 @@ in the alist is nil, prompt for the appropriate values." ;;;###autoload (defun erc-ezb-initialize () "Add EZBouncer convenience functions to ERC." - (add-hook 'erc-server-NOTICE-functions 'erc-ezb-notice-autodetect)) + (add-hook 'erc-server-NOTICE-functions #'erc-ezb-notice-autodetect)) (provide 'erc-ezbounce) diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el index 83ef5f93fa7..0312d221ece 100644 --- a/lisp/erc/erc-fill.el +++ b/lisp/erc/erc-fill.el @@ -1,4 +1,4 @@ -;;; erc-fill.el --- Filling IRC messages in various ways +;;; erc-fill.el --- Filling IRC messages in various ways -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc. @@ -47,7 +47,7 @@ the mode if ARG is omitted or nil. ERC fill mode is a global minor mode. When enabled, messages in the channel buffers are filled." nil nil nil - :global t :group 'erc-fill + :global t (if erc-fill-mode (erc-fill-enable) (erc-fill-disable))) @@ -55,19 +55,18 @@ the channel buffers are filled." (defun erc-fill-enable () "Setup hooks for `erc-fill-mode'." (interactive) - (add-hook 'erc-insert-modify-hook 'erc-fill) - (add-hook 'erc-send-modify-hook 'erc-fill)) + (add-hook 'erc-insert-modify-hook #'erc-fill) + (add-hook 'erc-send-modify-hook #'erc-fill)) (defun erc-fill-disable () "Cleanup hooks, disable `erc-fill-mode'." (interactive) - (remove-hook 'erc-insert-modify-hook 'erc-fill) - (remove-hook 'erc-send-modify-hook 'erc-fill)) + (remove-hook 'erc-insert-modify-hook #'erc-fill) + (remove-hook 'erc-send-modify-hook #'erc-fill)) (defcustom erc-fill-prefix nil "Values used as `fill-prefix' for `erc-fill-variable'. nil means fill with space, a string means fill with this string." - :group 'erc-fill :type '(choice (const nil) string)) (defcustom erc-fill-function 'erc-fill-variable @@ -94,7 +93,6 @@ These two styles are implemented using `erc-fill-variable' and `erc-fill-static'. You can, of course, define your own filling function. Narrowing to the region in question is in effect while your function is called." - :group 'erc-fill :type '(choice (const :tag "Variable Filling" erc-fill-variable) (const :tag "Static Filling" erc-fill-static) function)) @@ -104,18 +102,15 @@ function is called." centered. This column denotes the point where the ` ' character between <nickname> and the entered text will be put, thus aligning nick names right and text left." - :group 'erc-fill :type 'integer) (defcustom erc-fill-variable-maximum-indentation 17 "If we indent a line after a long nick, don't indent more then this characters. Set to nil to disable." - :group 'erc-fill :type 'integer) (defcustom erc-fill-column 78 "The column at which a filled paragraph is broken." - :group 'erc-fill :type 'integer) ;;;###autoload diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index aef68810dfa..1143faa1e26 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el @@ -1,4 +1,4 @@ -;; erc-goodies.el --- Collection of ERC modules +;; erc-goodies.el --- Collection of ERC modules -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2021 Free Software Foundation, Inc. @@ -37,7 +37,7 @@ "Setup Imenu support in an ERC buffer." (setq-local imenu-create-index-function #'erc-create-imenu-index)) -(add-hook 'erc-mode-hook 'erc-imenu-setup) +(add-hook 'erc-mode-hook #'erc-imenu-setup) (autoload 'erc-create-imenu-index "erc-imenu" "Imenu index creation function") ;;; Automatically scroll to bottom @@ -53,16 +53,16 @@ argument to `recenter'." (define-erc-module scrolltobottom nil "This mode causes the prompt to stay at the end of the window." - ((add-hook 'erc-mode-hook 'erc-add-scroll-to-bottom) - (add-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom) + ((add-hook 'erc-mode-hook #'erc-add-scroll-to-bottom) + (add-hook 'erc-insert-done-hook #'erc-possibly-scroll-to-bottom) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer (erc-add-scroll-to-bottom)))) - ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom) - (remove-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom) + ((remove-hook 'erc-mode-hook #'erc-add-scroll-to-bottom) + (remove-hook 'erc-insert-done-hook #'erc-possibly-scroll-to-bottom) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer - (remove-hook 'post-command-hook 'erc-scroll-to-bottom t))))) + (remove-hook 'post-command-hook #'erc-scroll-to-bottom t))))) (defun erc-possibly-scroll-to-bottom () "Like `erc-add-scroll-to-bottom', but only if window is selected." @@ -77,7 +77,7 @@ the value of `erc-input-line-position'. This works whenever scrolling happens, so it's added to `window-scroll-functions' rather than `erc-insert-post-hook'." - (add-hook 'post-command-hook 'erc-scroll-to-bottom nil t)) + (add-hook 'post-command-hook #'erc-scroll-to-bottom nil t)) (defun erc-scroll-to-bottom () "Recenter WINDOW so that `point' is on the last line. @@ -104,10 +104,10 @@ variable `erc-input-line-position'." ;;; Make read only (define-erc-module readonly nil "This mode causes all inserted text to be read-only." - ((add-hook 'erc-insert-post-hook 'erc-make-read-only) - (add-hook 'erc-send-post-hook 'erc-make-read-only)) - ((remove-hook 'erc-insert-post-hook 'erc-make-read-only) - (remove-hook 'erc-send-post-hook 'erc-make-read-only))) + ((add-hook 'erc-insert-post-hook #'erc-make-read-only) + (add-hook 'erc-send-post-hook #'erc-make-read-only)) + ((remove-hook 'erc-insert-post-hook #'erc-make-read-only) + (remove-hook 'erc-send-post-hook #'erc-make-read-only))) (defun erc-make-read-only () "Make all the text in the current buffer read-only. @@ -119,14 +119,14 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'." ;;; Move to prompt when typing text (define-erc-module move-to-prompt nil "This mode causes the point to be moved to the prompt when typing text." - ((add-hook 'erc-mode-hook 'erc-move-to-prompt-setup) + ((add-hook 'erc-mode-hook #'erc-move-to-prompt-setup) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer (erc-move-to-prompt-setup)))) - ((remove-hook 'erc-mode-hook 'erc-move-to-prompt-setup) + ((remove-hook 'erc-mode-hook #'erc-move-to-prompt-setup) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer - (remove-hook 'pre-command-hook 'erc-move-to-prompt t))))) + (remove-hook 'pre-command-hook #'erc-move-to-prompt t))))) (defun erc-move-to-prompt () "Move the point to the ERC prompt if this is a self-inserting command." @@ -138,15 +138,15 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'." (defun erc-move-to-prompt-setup () "Initialize the move-to-prompt module for XEmacs." - (add-hook 'pre-command-hook 'erc-move-to-prompt nil t)) + (add-hook 'pre-command-hook #'erc-move-to-prompt nil t)) ;;; Keep place in unvisited channels (define-erc-module keep-place nil "Leave point above un-viewed text in other channels." - ((add-hook 'erc-insert-pre-hook 'erc-keep-place)) - ((remove-hook 'erc-insert-pre-hook 'erc-keep-place))) + ((add-hook 'erc-insert-pre-hook #'erc-keep-place)) + ((remove-hook 'erc-insert-pre-hook #'erc-keep-place))) -(defun erc-keep-place (ignored) +(defun erc-keep-place (_ignored) "Move point away from the last line in a non-selected ERC buffer." (when (and (not (eq (window-buffer (selected-window)) (current-buffer))) @@ -183,8 +183,8 @@ does not appear in the ERC buffer after the user presses ENTER.") "This mode distinguishes non-commands. Commands listed in `erc-insert-this' know how to display themselves." - ((add-hook 'erc-pre-send-functions 'erc-send-distinguish-noncommands)) - ((remove-hook 'erc-pre-send-functions 'erc-send-distinguish-noncommands))) + ((add-hook 'erc-pre-send-functions #'erc-send-distinguish-noncommands)) + ((remove-hook 'erc-pre-send-functions #'erc-send-distinguish-noncommands))) (defun erc-send-distinguish-noncommands (state) "If STR is an ERC non-command, set `insertp' in STATE to nil." @@ -211,20 +211,17 @@ highlighting effects. When this variable is non-nil, it can cause Emacs to run slowly on systems lacking sufficient CPU speed. In chatty channels, or in an emergency (message flood) it can be turned off to save processing time. See `erc-toggle-interpret-controls'." - :group 'erc-control-characters :type '(choice (const :tag "Highlight control characters" t) (const :tag "Remove control characters" remove) (const :tag "Display raw control characters" nil))) (defcustom erc-interpret-mirc-color nil "If non-nil, ERC will interpret mIRC color codes." - :group 'erc-control-characters :type 'boolean) (defcustom erc-beep-p nil "Beep if C-g is in the server message. The value `erc-interpret-controls-p' must also be t for this to work." - :group 'erc-control-characters :type 'boolean) (defface erc-bold-face '((t :weight bold)) @@ -372,10 +369,10 @@ The value `erc-interpret-controls-p' must also be t for this to work." (define-erc-module irccontrols nil "This mode enables the interpretation of IRC control chars." - ((add-hook 'erc-insert-modify-hook 'erc-controls-highlight) - (add-hook 'erc-send-modify-hook 'erc-controls-highlight)) - ((remove-hook 'erc-insert-modify-hook 'erc-controls-highlight) - (remove-hook 'erc-send-modify-hook 'erc-controls-highlight))) + ((add-hook 'erc-insert-modify-hook #'erc-controls-highlight) + (add-hook 'erc-send-modify-hook #'erc-controls-highlight)) + ((remove-hook 'erc-insert-modify-hook #'erc-controls-highlight) + (remove-hook 'erc-send-modify-hook #'erc-controls-highlight))) (defun erc-controls-interpret (str) "Return a copy of STR after dealing with IRC control characters. @@ -546,10 +543,10 @@ Else interpretation is turned off." "This mode translates text-smileys such as :-) into pictures. This requires the function `smiley-region', which is defined in smiley.el, which is part of Gnus." - ((add-hook 'erc-insert-modify-hook 'erc-smiley) - (add-hook 'erc-send-modify-hook 'erc-smiley)) - ((remove-hook 'erc-insert-modify-hook 'erc-smiley) - (remove-hook 'erc-send-modify-hook 'erc-smiley))) + ((add-hook 'erc-insert-modify-hook #'erc-smiley) + (add-hook 'erc-send-modify-hook #'erc-smiley)) + ((remove-hook 'erc-insert-modify-hook #'erc-smiley) + (remove-hook 'erc-send-modify-hook #'erc-smiley))) (defun erc-smiley () "Smilify a region. @@ -560,8 +557,8 @@ This function should be used with `erc-insert-modify-hook'." ;; Unmorse (define-erc-module unmorse nil "This mode causes morse code in the current channel to be unmorsed." - ((add-hook 'erc-insert-modify-hook 'erc-unmorse)) - ((remove-hook 'erc-insert-modify-hook 'erc-unmorse))) + ((add-hook 'erc-insert-modify-hook #'erc-unmorse)) + ((remove-hook 'erc-insert-modify-hook #'erc-unmorse))) (defun erc-unmorse () "Unmorse some text. diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el index 5a002ccae3e..22336ede219 100644 --- a/lisp/erc/erc-ibuffer.el +++ b/lisp/erc/erc-ibuffer.el @@ -1,4 +1,4 @@ -;;; erc-ibuffer.el --- ibuffer integration with ERC +;;; erc-ibuffer.el --- ibuffer integration with ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc. @@ -39,20 +39,16 @@ (defcustom erc-ibuffer-keyword-char ?k "Char used to indicate a channel which had keyword traffic lately (hidden)." - :group 'erc-ibuffer :type 'character) (defcustom erc-ibuffer-pal-char ?p "Char used to indicate a channel which had pal traffic lately (hidden)." - :group 'erc-ibuffer :type 'character) (defcustom erc-ibuffer-fool-char ?f "Char used to indicate a channel which had fool traffic lately (hidden)." - :group 'erc-ibuffer :type 'character) (defcustom erc-ibuffer-dangerous-host-char ?d "Char used to indicate a channel which had dangerous-host traffic lately \(hidden)." - :group 'erc-ibuffer :type 'character) (define-ibuffer-filter erc-server @@ -153,7 +149,7 @@ (if (and (eq major-mode 'erc-mode) (or (> (length erc-channel-modes) 0) erc-channel-user-limit)) - (concat (apply 'concat + (concat (apply #'concat "(+" erc-channel-modes) (if erc-channel-user-limit (format "l %d" erc-channel-user-limit) @@ -181,6 +177,7 @@ (defvar erc-ibuffer-limit-map nil "Prefix keymap to use for ERC related limiting.") (define-prefix-command 'erc-ibuffer-limit-map) +;; FIXME: Where is `ibuffer-limit-by-erc-server' defined? (define-key 'erc-ibuffer-limit-map (kbd "s") 'ibuffer-limit-by-erc-server) (define-key ibuffer-mode-map (kbd "/ \C-e") 'erc-ibuffer-limit-map) diff --git a/lisp/erc/erc-identd.el b/lisp/erc/erc-identd.el index 1f68272ebb1..3821e298cda 100644 --- a/lisp/erc/erc-identd.el +++ b/lisp/erc/erc-identd.el @@ -1,4 +1,4 @@ -;;; erc-identd.el --- RFC1413 (identd authentication protocol) server +;;; erc-identd.el --- RFC1413 (identd authentication protocol) server -*- lexical-binding: t; -*- ;; Copyright (C) 2003, 2006-2021 Free Software Foundation, Inc. @@ -50,7 +50,6 @@ `erc-identd-start'. This can be either a string or a number." - :group 'erc-identd :type '(choice (const :tag "None" nil) (integer :tag "Port number") (string :tag "Port string"))) @@ -58,10 +57,10 @@ This can be either a string or a number." ;;;###autoload(autoload 'erc-identd-mode "erc-identd") (define-erc-module identd nil "This mode launches an identd server on port 8113." - ((add-hook 'erc-connect-pre-hook 'erc-identd-quickstart) - (add-hook 'erc-disconnected-hook 'erc-identd-stop)) - ((remove-hook 'erc-connect-pre-hook 'erc-identd-quickstart) - (remove-hook 'erc-disconnected-hook 'erc-identd-stop))) + ((add-hook 'erc-connect-pre-hook #'erc-identd-quickstart) + (add-hook 'erc-disconnected-hook #'erc-identd-stop)) + ((remove-hook 'erc-connect-pre-hook #'erc-identd-quickstart) + (remove-hook 'erc-disconnected-hook #'erc-identd-stop))) (defun erc-identd-filter (proc string) "This filter implements RFC1413 (identd authentication protocol)." @@ -95,16 +94,16 @@ system." :buffer nil :host 'local :service port :server t :noquery t :nowait t - :filter 'erc-identd-filter)) + :filter #'erc-identd-filter)) (set-process-query-on-exit-flag erc-identd-process nil)) -(defun erc-identd-quickstart (&rest ignored) +(defun erc-identd-quickstart (&rest _ignored) "Start the identd server with the default port. The default port is specified by `erc-identd-port'." (erc-identd-start)) ;;;###autoload -(defun erc-identd-stop (&rest ignore) +(defun erc-identd-stop (&rest _ignore) (interactive) (when erc-identd-process (delete-process erc-identd-process) diff --git a/lisp/erc/erc-imenu.el b/lisp/erc/erc-imenu.el index ecdfc2a04b5..b2a2dc588e5 100644 --- a/lisp/erc/erc-imenu.el +++ b/lisp/erc/erc-imenu.el @@ -1,4 +1,4 @@ -;;; erc-imenu.el -- Imenu support for ERC +;;; erc-imenu.el -- Imenu support for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2002, 2004, 2006-2021 Free Software Foundation, ;; Inc. @@ -71,7 +71,7 @@ Don't rely on this function, read it first!" (message-alist '()) (mode-change-alist '()) (topic-change-alist '()) - prev-pos) + ) ;; prev-pos (goto-char (point-max)) (while (if (bolp) (> (forward-line -1) @@ -106,7 +106,8 @@ Don't rely on this function, read it first!" "^\\(\\S-+\\) (.+) has set the topic for \\S-+: \\(.*\\)$" notice-text) (push (cons (concat (match-string 1 notice-text) ": " - (match-string 2 notice-text)) pos) + (match-string 2 notice-text)) + pos) topic-change-alist))))) (when (looking-at "<\\(\\S-+\\)> \\(.+\\)$") (let ((from (match-string 1)) diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el index 1707e714cc1..2ad9c8bd941 100644 --- a/lisp/erc/erc-join.el +++ b/lisp/erc/erc-join.el @@ -1,4 +1,4 @@ -;;; erc-join.el --- autojoin channels on connect and reconnects +;;; erc-join.el --- autojoin channels on connect and reconnects -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc. @@ -42,14 +42,14 @@ ;;;###autoload(autoload 'erc-autojoin-mode "erc-join" nil t) (define-erc-module autojoin nil "Makes ERC autojoin on connects and reconnects." - ((add-hook 'erc-after-connect 'erc-autojoin-channels) - (add-hook 'erc-nickserv-identified-hook 'erc-autojoin-after-ident) - (add-hook 'erc-server-JOIN-functions 'erc-autojoin-add) - (add-hook 'erc-server-PART-functions 'erc-autojoin-remove)) - ((remove-hook 'erc-after-connect 'erc-autojoin-channels) - (remove-hook 'erc-nickserv-identified-hook 'erc-autojoin-after-ident) - (remove-hook 'erc-server-JOIN-functions 'erc-autojoin-add) - (remove-hook 'erc-server-PART-functions 'erc-autojoin-remove))) + ((add-hook 'erc-after-connect #'erc-autojoin-channels) + (add-hook 'erc-nickserv-identified-hook #'erc-autojoin-after-ident) + (add-hook 'erc-server-JOIN-functions #'erc-autojoin-add) + (add-hook 'erc-server-PART-functions #'erc-autojoin-remove)) + ((remove-hook 'erc-after-connect #'erc-autojoin-channels) + (remove-hook 'erc-nickserv-identified-hook #'erc-autojoin-after-ident) + (remove-hook 'erc-server-JOIN-functions #'erc-autojoin-add) + (remove-hook 'erc-server-PART-functions #'erc-autojoin-remove))) (defcustom erc-autojoin-channels-alist nil "Alist of channels to autojoin on IRC networks. @@ -70,7 +70,6 @@ keeps track of what channels you are on, and will join them again when you get disconnected. When you restart Emacs, however, those changes are lost, and the customization you saved the last time is used again." - :group 'erc-autojoin :type '(repeat (cons :tag "Server" (regexp :tag "Name") (repeat :tag "Channels" @@ -82,7 +81,6 @@ If the value is `connect', autojoin immediately on connecting. If the value is `ident', autojoin after successful NickServ identification, or after `erc-autojoin-delay' seconds. Any other value means the same as `connect'." - :group 'erc-autojoin :version "24.1" :type '(choice (const :tag "On Connection" connect) (const :tag "When Identified" ident))) @@ -92,7 +90,6 @@ Any other value means the same as `connect'." This only takes effect if `erc-autojoin-timing' is `ident'. If NickServ identification occurs before this delay expires, ERC autojoins immediately at that time." - :group 'erc-autojoin :version "24.1" :type 'integer) @@ -102,7 +99,6 @@ If non-nil, and a channel on the server a.b.c is joined, then only b.c is used as the server for `erc-autojoin-channels-alist'. This is important for networks that redirect you to other servers, presumably in the same domain." - :group 'erc-autojoin :type 'boolean) (defvar-local erc--autojoin-timer nil) @@ -121,7 +117,7 @@ This is called from a timer set up by `erc-autojoin-channels'." (erc-log "Delayed autojoin started (no ident success detected yet)") (erc-autojoin-channels server nick)))) -(defun erc-autojoin-after-ident (network nick) +(defun erc-autojoin-after-ident (_network _nick) "Autojoin channels in `erc-autojoin-channels-alist'. This function is run from `erc-nickserv-identified-hook'." (if erc--autojoin-timer @@ -149,7 +145,7 @@ This function is run from `erc-nickserv-identified-hook'." (when (> erc-autojoin-delay 0) (setq erc--autojoin-timer (run-with-timer erc-autojoin-delay nil - 'erc-autojoin-channels-delayed + #'erc-autojoin-channels-delayed server nick (current-buffer)))) ;; `erc-autojoin-timing' is `connect': (let ((server (or erc-session-server erc-server-announced-name))) diff --git a/lisp/erc/erc-lang.el b/lisp/erc/erc-lang.el index 4163e5a08d0..136131ca36b 100644 --- a/lisp/erc/erc-lang.el +++ b/lisp/erc/erc-lang.el @@ -1,4 +1,4 @@ -;;; erc-lang.el --- provide the LANG command to ERC +;;; erc-lang.el --- provide the LANG command to ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc. diff --git a/lisp/erc/erc-list.el b/lisp/erc/erc-list.el index cf150e74ab5..31693a7b77a 100644 --- a/lisp/erc/erc-list.el +++ b/lisp/erc/erc-list.el @@ -59,13 +59,13 @@ ;;;###autoload(autoload 'erc-list-mode "erc-list") (define-erc-module list nil "List channels nicely in a separate buffer." - ((remove-hook 'erc-server-321-functions 'erc-server-321-message) - (remove-hook 'erc-server-322-functions 'erc-server-322-message)) + ((remove-hook 'erc-server-321-functions #'erc-server-321-message) + (remove-hook 'erc-server-322-functions #'erc-server-322-message)) ((erc-with-all-buffers-of-server nil #'erc-open-server-buffer-p - (remove-hook 'erc-server-322-functions 'erc-list-handle-322 t)) - (add-hook 'erc-server-321-functions 'erc-server-321-message t) - (add-hook 'erc-server-322-functions 'erc-server-322-message t))) + (remove-hook 'erc-server-322-functions #'erc-list-handle-322 t)) + (add-hook 'erc-server-321-functions #'erc-server-321-message t) + (add-hook 'erc-server-322-functions #'erc-server-322-message t))) ;; Format a record for display. (defun erc-list-make-string (channel users topic) @@ -126,17 +126,17 @@ (defvar erc-list-menu-mode-map (let ((map (make-keymap))) (set-keymap-parent map special-mode-map) - (define-key map "k" 'erc-list-kill) - (define-key map "j" 'erc-list-join) - (define-key map "g" 'erc-list-revert) - (define-key map "n" 'next-line) - (define-key map "p" 'previous-line) + (define-key map "k" #'erc-list-kill) + (define-key map "j" #'erc-list-join) + (define-key map "g" #'erc-list-revert) + (define-key map "n" #'next-line) + (define-key map "p" #'previous-line) map) "Local keymap for `erc-list-mode' buffers.") (defvar erc-list-menu-sort-button-map (let ((map (make-sparse-keymap))) - (define-key map [header-line mouse-1] 'erc-list-menu-sort-by-column) + (define-key map [header-line mouse-1] #'erc-list-menu-sort-by-column) (define-key map [follow-link] 'mouse-face) map) "Local keymap for ERC list menu mode sorting buttons.") @@ -181,12 +181,12 @@ (defun erc-list-install-322-handler (server-buffer) (with-current-buffer server-buffer ;; Arrange for 322 responses to insert into our buffer. - (add-hook 'erc-server-322-functions 'erc-list-handle-322 t t) + (add-hook 'erc-server-322-functions #'erc-list-handle-322 t t) ;; Arrange for 323 (end of list) to end this. (erc-once-with-server-event 323 (lambda (_proc _parsed) - (remove-hook 'erc-server-322-functions 'erc-list-handle-322 t))) + (remove-hook 'erc-server-322-functions #'erc-list-handle-322 t))) ;; Find the list buffer, empty it, and display it. (setq-local erc-list-buffer (get-buffer-create (concat "*Channels of " diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el index 22fd3d27136..ddd00afd73b 100644 --- a/lisp/erc/erc-log.el +++ b/lisp/erc/erc-log.el @@ -1,4 +1,4 @@ -;;; erc-log.el --- Logging facilities for ERC. +;;; erc-log.el --- Logging facilities for ERC. -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2021 Free Software Foundation, Inc. @@ -112,7 +112,6 @@ SERVER and PORT are the parameters that were used to connect to BUFFERs If you want to write logs into different directories, make a custom function which returns the directory part and set `erc-log-channels-directory' to its name." - :group 'erc-log :type '(choice (const :tag "#channel!nick@server:port.txt" erc-generate-log-file-name-long) (const :tag "#channel!nick@network.txt" @@ -124,7 +123,6 @@ custom function which returns the directory part and set (defcustom erc-truncate-buffer-on-save nil "Erase the contents of any ERC (channel, query, server) buffer when it is saved." - :group 'erc-log :type 'boolean) (defcustom erc-enable-logging t @@ -138,7 +136,6 @@ This variable is buffer local. Setting it via \\[customize] sets the default value. Log files are stored in `erc-log-channels-directory'." - :group 'erc-log :type '(choice boolean function)) (make-variable-buffer-local 'erc-enable-logging) @@ -153,14 +150,12 @@ If this is the name of a function, the function will be called with the buffer, target, nick, server, and port arguments. See `erc-generate-log-file-name-function' for a description of these arguments." - :group 'erc-log :type '(choice directory (function "Function") (const :tag "Disable logging" nil))) (defcustom erc-log-insert-log-on-open nil "Insert log file contents into the buffer if a log file exists." - :group 'erc-log :type 'boolean) (defcustom erc-save-buffer-on-part t @@ -168,7 +163,6 @@ arguments." If you set this to nil, you may want to enable both `erc-log-write-after-send' and `erc-log-write-after-insert'." - :group 'erc-log :type 'boolean) (defcustom erc-save-queries-on-quit t @@ -176,7 +170,6 @@ If you set this to nil, you may want to enable both If you set this to nil, you may want to enable both `erc-log-write-after-send' and `erc-log-write-after-insert'." - :group 'erc-log :type 'boolean) (defcustom erc-log-write-after-send nil @@ -184,7 +177,6 @@ If you set this to nil, you may want to enable both If you set this to nil, you may want to enable both `erc-save-buffer-on-part' and `erc-save-queries-on-quit'." - :group 'erc-log :type 'boolean) (defcustom erc-log-write-after-insert nil @@ -193,7 +185,6 @@ logged ERC buffer. If you set this to nil, you may want to enable both `erc-save-buffer-on-part' and `erc-save-queries-on-quit'." - :group 'erc-log :type 'boolean) (defcustom erc-log-file-coding-system 'emacs-mule @@ -201,15 +192,13 @@ If you set this to nil, you may want to enable both This should ideally, be a \"catch-all\" coding system, like `emacs-mule', or `iso-2022-7bit'." - :type 'coding-system - :group 'erc-log) + :type 'coding-system) (defcustom erc-log-filter-function nil "If non-nil, pass text through the given function before writing it to a log file. The function should take one argument, which is the text to filter." - :group 'erc-log :type '(choice (function "Function") (const :tag "No filtering" nil))) @@ -232,31 +221,31 @@ also be a predicate function. To only log when you are not set away, use: (null (erc-away-time)))))" ;; enable ((when erc-log-write-after-insert - (add-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs)) + (add-hook 'erc-insert-post-hook #'erc-save-buffer-in-logs)) (when erc-log-write-after-send - (add-hook 'erc-send-post-hook 'erc-save-buffer-in-logs)) - (add-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs) - (add-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs) - (add-hook 'kill-emacs-hook 'erc-log-save-all-buffers) - (add-hook 'erc-quit-hook 'erc-conditional-save-queries) - (add-hook 'erc-part-hook 'erc-conditional-save-buffer) + (add-hook 'erc-send-post-hook #'erc-save-buffer-in-logs)) + (add-hook 'erc-kill-buffer-hook #'erc-save-buffer-in-logs) + (add-hook 'erc-kill-channel-hook #'erc-save-buffer-in-logs) + (add-hook 'kill-emacs-hook #'erc-log-save-all-buffers) + (add-hook 'erc-quit-hook #'erc-conditional-save-queries) + (add-hook 'erc-part-hook #'erc-conditional-save-buffer) ;; append, so that 'erc-initialize-log-marker runs first - (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append) + (add-hook 'erc-connect-pre-hook #'erc-log-setup-logging 'append) (dolist (buffer (erc-buffer-list)) (erc-log-setup-logging buffer))) ;; disable - ((remove-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs) - (remove-hook 'erc-send-post-hook 'erc-save-buffer-in-logs) - (remove-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs) - (remove-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs) - (remove-hook 'kill-emacs-hook 'erc-log-save-all-buffers) - (remove-hook 'erc-quit-hook 'erc-conditional-save-queries) - (remove-hook 'erc-part-hook 'erc-conditional-save-buffer) - (remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging) + ((remove-hook 'erc-insert-post-hook #'erc-save-buffer-in-logs) + (remove-hook 'erc-send-post-hook #'erc-save-buffer-in-logs) + (remove-hook 'erc-kill-buffer-hook #'erc-save-buffer-in-logs) + (remove-hook 'erc-kill-channel-hook #'erc-save-buffer-in-logs) + (remove-hook 'kill-emacs-hook #'erc-log-save-all-buffers) + (remove-hook 'erc-quit-hook #'erc-conditional-save-queries) + (remove-hook 'erc-part-hook #'erc-conditional-save-buffer) + (remove-hook 'erc-connect-pre-hook #'erc-log-setup-logging) (dolist (buffer (erc-buffer-list)) (erc-log-disable-logging buffer)))) -(define-key erc-mode-map "\C-c\C-l" 'erc-save-buffer-in-logs) +(define-key erc-mode-map "\C-c\C-l" #'erc-save-buffer-in-logs) ;;; functionality referenced from erc.el (defun erc-log-setup-logging (buffer) @@ -357,13 +346,13 @@ The result is converted to lowercase, as IRC is case-insensitive." buffer target nick server port) erc-log-channels-directory))))) -(defun erc-generate-log-file-name-with-date (buffer &rest ignore) +(defun erc-generate-log-file-name-with-date (buffer &rest _ignore) "This function computes a short log file name. The name of the log file is composed of BUFFER and the current date. This function is a possible value for `erc-generate-log-file-name-function'." (concat (buffer-name buffer) "-" (format-time-string "%Y-%m-%d") ".txt")) -(defun erc-generate-log-file-name-short (buffer &rest ignore) +(defun erc-generate-log-file-name-short (buffer &rest _ignore) "This function computes a short log file name. In fact, it only uses the buffer name of the BUFFER argument, so you can affect that using `rename-buffer' and the-like. This @@ -371,7 +360,7 @@ function is a possible value for `erc-generate-log-file-name-function'." (concat (buffer-name buffer) ".txt")) -(defun erc-generate-log-file-name-long (buffer target nick server port) +(defun erc-generate-log-file-name-long (_buffer target nick server port) "Generates a log-file name in the way ERC always did it. This results in a file name of the form #channel!nick@server:port.txt. This function is a possible value for `erc-generate-log-file-name-function'." @@ -385,7 +374,7 @@ This function is a possible value for `erc-generate-log-file-name-function'." (declare-function erc-network-name "erc-networks" ()) -(defun erc-generate-log-file-name-network (buffer target nick server port) +(defun erc-generate-log-file-name-network (buffer target nick server _port) "Generates a log-file name using the network name rather than server name. This results in a file name of the form #channel!nick@network.txt. This function is a possible value for `erc-generate-log-file-name-function'." diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el index eede15c11af..43fbca3e666 100644 --- a/lisp/erc/erc-match.el +++ b/lisp/erc/erc-match.el @@ -1,4 +1,4 @@ -;;; erc-match.el --- Highlight messages matching certain regexps +;;; erc-match.el --- Highlight messages matching certain regexps -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. @@ -52,19 +52,17 @@ they are hidden or highlighted. This is controlled via the variables `erc-current-nick-highlight-type'. For all these highlighting types, you can decide whether the entire message or only the sending nick is highlighted." - ((add-hook 'erc-insert-modify-hook 'erc-match-message 'append)) - ((remove-hook 'erc-insert-modify-hook 'erc-match-message))) + ((add-hook 'erc-insert-modify-hook #'erc-match-message 'append)) + ((remove-hook 'erc-insert-modify-hook #'erc-match-message))) ;; Remaining customizations (defcustom erc-pals nil "List of pals on IRC." - :group 'erc-match :type '(repeat regexp)) (defcustom erc-fools nil "List of fools on IRC." - :group 'erc-match :type '(repeat regexp)) (defcustom erc-keywords nil @@ -72,14 +70,12 @@ highlighted." Each entry in the list is either a regexp, or a cons cell with the regexp in the car and the face to use in the cdr. If no face is specified, `erc-keyword-face' is used." - :group 'erc-match :type '(repeat (choice regexp (list regexp face)))) (defcustom erc-dangerous-hosts nil "List of regexps for hosts to highlight. Useful to mark nicks from dangerous hosts." - :group 'erc-match :type '(repeat regexp)) (defcustom erc-current-nick-highlight-type 'keyword @@ -99,7 +95,6 @@ The following values are allowed: current nickname occurs Any other value disables highlighting of current nickname altogether." - :group 'erc-match :type '(choice (const nil) (const nick) (const keyword) @@ -120,7 +115,6 @@ The following values are allowed: from pal Any other value disables pal highlighting altogether." - :group 'erc-match :type '(choice (const nil) (const nick) (const message) @@ -139,7 +133,6 @@ The following values are allowed: from fool Any other value disables fool highlighting altogether." - :group 'erc-match :type '(choice (const nil) (const nick) (const message) @@ -157,7 +150,6 @@ The following values are allowed: containing keyword Any other value disables keyword highlighting altogether." - :group 'erc-match :type '(choice (const nil) (const keyword) (const message) @@ -175,7 +167,6 @@ The following values are allowed: from dangerous-host Any other value disables dangerous-host highlighting altogether." - :group 'erc-match :type '(choice (const nil) (const nick) (const message) @@ -193,7 +184,6 @@ Valid match type keys are: The other element of each cons pair in this list is the buffer name to use for the logged message." - :group 'erc-match :type '(repeat (cons (choice :tag "Key" (const keyword) (const pal) @@ -207,7 +197,6 @@ use for the logged message." When nil, don't log any matched messages. When t, log messages. When `away', log messages only when away." - :group 'erc-match :type '(choice (const nil) (const away) (const t))) @@ -222,14 +211,12 @@ will be formatted. The various format specs are: %u Nickname!user@host of sender %c Channel in which this was received %m Message" - :group 'erc-match :type 'string) (defcustom erc-beep-match-types '(current-nick) "Types of matches to beep for when a match occurs. The function `erc-beep-on-match' needs to be added to `erc-text-matched-hook' for beeping to work." - :group 'erc-match :type '(choice (repeat :tag "Beep on match" (choice (const current-nick) (const keyword) @@ -244,14 +231,12 @@ Functions in this hook are passed as arguments: \(match-type nick!user@host message) where MATCH-TYPE is a symbol of: current-nick, keyword, pal, dangerous-host, fool." :options '(erc-log-matches erc-hide-fools erc-beep-on-match) - :group 'erc-match :type 'hook) (defcustom erc-match-exclude-server-buffer nil "If true, don't perform match on the server buffer; this is useful for excluding all the things like MOTDs from the server and other miscellaneous functions." - :group 'erc-match :version "24.3" :type 'boolean) @@ -390,7 +375,7 @@ car is the string." (interactive) (erc-remove-entry-from-list 'erc-dangerous-hosts "Delete dangerous-host: ")) -(defun erc-match-current-nick-p (nickuserhost msg) +(defun erc-match-current-nick-p (_nickuserhost msg) "Check whether the current nickname is in MSG. NICKUSERHOST will be ignored." (with-syntax-table erc-match-syntax-table @@ -400,7 +385,7 @@ NICKUSERHOST will be ignored." "\\b") msg)))) -(defun erc-match-pal-p (nickuserhost msg) +(defun erc-match-pal-p (nickuserhost _msg) "Check whether NICKUSERHOST is in `erc-pals'. MSG will be ignored." (and nickuserhost @@ -412,7 +397,7 @@ MSG will be ignored." (or (erc-list-match erc-fools nickuserhost) (erc-match-directed-at-fool-p msg)))) -(defun erc-match-keyword-p (nickuserhost msg) +(defun erc-match-keyword-p (_nickuserhost msg) "Check whether any keyword of `erc-keywords' matches for MSG. NICKUSERHOST will be ignored." (and msg @@ -424,7 +409,7 @@ NICKUSERHOST will be ignored." erc-keywords) msg))) -(defun erc-match-dangerous-host-p (nickuserhost msg) +(defun erc-match-dangerous-host-p (nickuserhost _msg) "Check whether NICKUSERHOST is in `erc-dangerous-hosts'. MSG will be ignored." (and nickuserhost @@ -457,7 +442,7 @@ Use this defun with `erc-insert-modify-hook'." (nickuserhost (erc-get-parsed-vector-nick vector)) (nickname (and nickuserhost (nth 0 (erc-parse-user nickuserhost)))) - (old-pt (point)) + ;; (old-pt (point)) (nick-beg (and nickname (re-search-forward (regexp-quote nickname) (point-max) t) @@ -484,11 +469,12 @@ Use this defun with `erc-insert-modify-hook'." (goto-char (point-min)) (let* ((match-prefix (concat "erc-" match-type)) (match-pred (intern (concat "erc-match-" match-type "-p"))) - (match-htype (eval (intern (concat match-prefix - "-highlight-type")))) + (match-htype (symbol-value (intern (concat match-prefix + "-highlight-type")))) (match-regex (if (string= match-type "current-nick") (regexp-quote (erc-current-nick)) - (eval (intern (concat match-prefix "s"))))) + (symbol-value + (intern (concat match-prefix "s"))))) (match-face (intern (concat match-prefix "-face")))) (when (funcall match-pred nickuserhost message) (cond @@ -601,7 +587,7 @@ See `erc-log-match-format'." (kill-buffer buffer))))) buffer))) -(defun erc-log-matches-come-back (proc parsed) +(defun erc-log-matches-come-back (_proc _parsed) "Display a notice that messages were logged while away." (when (and (erc-away-time) (eq erc-log-matches-flag 'away)) @@ -629,7 +615,7 @@ See `erc-log-match-format'." nil) ; This handler must be run _before_ erc-process-away is. -(add-hook 'erc-server-305-functions 'erc-log-matches-come-back nil) +(add-hook 'erc-server-305-functions #'erc-log-matches-come-back nil) (defun erc-go-to-log-matches-buffer () "Interactively open an erc-log-matches buffer." @@ -642,9 +628,9 @@ See `erc-log-match-format'." (get-buffer (car buffer-cons)))))) (switch-to-buffer buffer-name))) -(define-key erc-mode-map "\C-c\C-k" 'erc-go-to-log-matches-buffer) +(define-key erc-mode-map "\C-c\C-k" #'erc-go-to-log-matches-buffer) -(defun erc-hide-fools (match-type nickuserhost message) +(defun erc-hide-fools (match-type _nickuserhost _message) "Hide foolish comments. This function should be called from `erc-text-matched-hook'." (when (eq match-type 'fool) @@ -652,7 +638,7 @@ This function should be called from `erc-text-matched-hook'." '(invisible intangible) (current-buffer)))) -(defun erc-beep-on-match (match-type nickuserhost message) +(defun erc-beep-on-match (match-type _nickuserhost _message) "Beep when text matches. This function is meant to be called from `erc-text-matched-hook'." (when (member match-type erc-beep-match-types) diff --git a/lisp/erc/erc-menu.el b/lisp/erc/erc-menu.el index d76e0a345ef..0dc819fbbbe 100644 --- a/lisp/erc/erc-menu.el +++ b/lisp/erc/erc-menu.el @@ -1,4 +1,4 @@ -;; erc-menu.el -- Menu-bar definitions for ERC +;; erc-menu.el -- Menu-bar definitions for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2002, 2004-2021 Free Software Foundation, Inc. diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el index 37fc4cf16c1..9cfb947003c 100644 --- a/lisp/erc/erc-netsplit.el +++ b/lisp/erc/erc-netsplit.el @@ -1,4 +1,4 @@ -;;; erc-netsplit.el --- Reduce JOIN/QUIT messages on netsplits +;;; erc-netsplit.el --- Reduce JOIN/QUIT messages on netsplits -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc. @@ -42,30 +42,27 @@ netsplits, so that it can filter the JOIN messages on a netjoin too." (define-erc-module netsplit nil "This mode hides quit/join messages if a netsplit occurs." ((erc-netsplit-install-message-catalogs) - (add-hook 'erc-server-JOIN-functions 'erc-netsplit-JOIN) - (add-hook 'erc-server-MODE-functions 'erc-netsplit-MODE) - (add-hook 'erc-server-QUIT-functions 'erc-netsplit-QUIT) - (add-hook 'erc-timer-hook 'erc-netsplit-timer)) - ((remove-hook 'erc-server-JOIN-functions 'erc-netsplit-JOIN) - (remove-hook 'erc-server-MODE-functions 'erc-netsplit-MODE) - (remove-hook 'erc-server-QUIT-functions 'erc-netsplit-QUIT) - (remove-hook 'erc-timer-hook 'erc-netsplit-timer))) + (add-hook 'erc-server-JOIN-functions #'erc-netsplit-JOIN) + (add-hook 'erc-server-MODE-functions #'erc-netsplit-MODE) + (add-hook 'erc-server-QUIT-functions #'erc-netsplit-QUIT) + (add-hook 'erc-timer-hook #'erc-netsplit-timer)) + ((remove-hook 'erc-server-JOIN-functions #'erc-netsplit-JOIN) + (remove-hook 'erc-server-MODE-functions #'erc-netsplit-MODE) + (remove-hook 'erc-server-QUIT-functions #'erc-netsplit-QUIT) + (remove-hook 'erc-timer-hook #'erc-netsplit-timer))) (defcustom erc-netsplit-show-server-mode-changes-flag nil "Set to t to enable display of server mode changes." - :group 'erc-netsplit :type 'boolean) (defcustom erc-netsplit-debug nil "If non-nil, debug messages will be shown in the sever buffer." - :group 'erc-netsplit :type 'boolean) (defcustom erc-netsplit-regexp "^[^ @!\"\n]+\\.[^ @!\n]+ [^ @!\n]+\\.[^ @!\"\n]+$" "This regular expression should match quit reasons produced by netsplits." - :group 'erc-netsplit :type 'regexp) (defcustom erc-netsplit-hook nil @@ -190,13 +187,13 @@ join from that split has been detected or not.") (erc-display-message nil 'notice 'active 'netsplit-wholeft ?s (car elt) - ?n (mapconcat 'erc-extract-nick (nthcdr 3 elt) " ") + ?n (mapconcat #'erc-extract-nick (nthcdr 3 elt) " ") ?t (if (nth 2 elt) "(joining)" ""))))) t) -(defalias 'erc-cmd-WL 'erc-cmd-WHOLEFT) +(defalias 'erc-cmd-WL #'erc-cmd-WHOLEFT) (provide 'erc-netsplit) diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el index 9926255e3aa..aed02a9e267 100644 --- a/lisp/erc/erc-networks.el +++ b/lisp/erc/erc-networks.el @@ -1,4 +1,4 @@ -;;; erc-networks.el --- IRC networks +;;; erc-networks.el --- IRC networks -*- lexical-binding: t; -*- ;; Copyright (C) 2002, 2004-2021 Free Software Foundation, Inc. @@ -443,7 +443,6 @@ NET is a symbol indicating to which network from `erc-networks-alist' this server corresponds, HOST is the servers hostname and PORTS is either a number, a list of numbers, or a list of port ranges." - :group 'erc-networks :type '(alist :key-type (string :tag "Name") :value-type (group symbol (string :tag "Hostname") @@ -714,7 +713,6 @@ MATCHER is used to find a corresponding network to a server while connected to it. If it is regexp, it's used to match against `erc-server-announced-name'. It can also be a function (predicate). Then it is executed with the server buffer as current-buffer." - :group 'erc-networks :type '(repeat (list :tag "Network" (symbol :tag "Network name") @@ -762,25 +760,25 @@ Return the name of this server's network as a symbol." "Return the name of the current network as a string." (erc-with-server-buffer (symbol-name erc-network))) -(defun erc-set-network-name (proc parsed) +(defun erc-set-network-name (_proc _parsed) "Set `erc-network' to the value returned by `erc-determine-network'." (unless erc-server-connected (setq erc-network (erc-determine-network))) nil) -(defun erc-unset-network-name (nick ip reason) +(defun erc-unset-network-name (_nick _ip _reason) "Set `erc-network' to nil." (setq erc-network nil) nil) (define-erc-module networks nil "Provide data about IRC networks." - ((add-hook 'erc-server-375-functions 'erc-set-network-name) - (add-hook 'erc-server-422-functions 'erc-set-network-name) - (add-hook 'erc-disconnected-hook 'erc-unset-network-name)) - ((remove-hook 'erc-server-375-functions 'erc-set-network-name) - (remove-hook 'erc-server-422-functions 'erc-set-network-name) - (remove-hook 'erc-disconnected-hook 'erc-unset-network-name))) + ((add-hook 'erc-server-375-functions #'erc-set-network-name) + (add-hook 'erc-server-422-functions #'erc-set-network-name) + (add-hook 'erc-disconnected-hook #'erc-unset-network-name)) + ((remove-hook 'erc-server-375-functions #'erc-set-network-name) + (remove-hook 'erc-server-422-functions #'erc-set-network-name) + (remove-hook 'erc-disconnected-hook #'erc-unset-network-name))) (defun erc-ports-list (ports) "Return a list of PORTS. diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el index e133e05a7d3..1ed056c277d 100644 --- a/lisp/erc/erc-notify.el +++ b/lisp/erc/erc-notify.el @@ -42,20 +42,17 @@ (defcustom erc-notify-list nil "List of nicknames you want to be notified about online/offline status change." - :group 'erc-notify :type '(repeat string)) (defcustom erc-notify-interval 60 "Time interval (in seconds) for checking online status of notified people." - :group 'erc-notify :type 'integer) (defcustom erc-notify-signon-hook nil "Hook run after someone on `erc-notify-list' has signed on. Two arguments are passed to the function, SERVER and NICK, both strings." - :group 'erc-notify :type 'hook :options '(erc-notify-signon)) @@ -63,7 +60,6 @@ strings." "Hook run after someone on `erc-notify-list' has signed off. Two arguments are passed to the function, SERVER and NICK, both strings." - :group 'erc-notify :type 'hook :options '(erc-notify-signoff)) @@ -95,14 +91,14 @@ strings." (define-erc-module notify nil "Periodically check for the online status of certain users and report changes." - ((add-hook 'erc-timer-hook 'erc-notify-timer) - (add-hook 'erc-server-JOIN-functions 'erc-notify-JOIN) - (add-hook 'erc-server-NICK-functions 'erc-notify-NICK) - (add-hook 'erc-server-QUIT-functions 'erc-notify-QUIT)) - ((remove-hook 'erc-timer-hook 'erc-notify-timer) - (remove-hook 'erc-server-JOIN-functions 'erc-notify-JOIN) - (remove-hook 'erc-server-NICK-functions 'erc-notify-NICK) - (remove-hook 'erc-server-QUIT-functions 'erc-notify-QUIT))) + ((add-hook 'erc-timer-hook #'erc-notify-timer) + (add-hook 'erc-server-JOIN-functions #'erc-notify-JOIN) + (add-hook 'erc-server-NICK-functions #'erc-notify-NICK) + (add-hook 'erc-server-QUIT-functions #'erc-notify-QUIT)) + ((remove-hook 'erc-timer-hook #'erc-notify-timer) + (remove-hook 'erc-server-JOIN-functions #'erc-notify-JOIN) + (remove-hook 'erc-server-NICK-functions #'erc-notify-NICK) + (remove-hook 'erc-server-QUIT-functions #'erc-notify-QUIT))) ;;;; Timer handler @@ -137,7 +133,7 @@ changes." (setq erc-last-ison ison-list) t))) (erc-server-send - (concat "ISON " (mapconcat 'identity erc-notify-list " "))) + (concat "ISON " (mapconcat #'identity erc-notify-list " "))) (setq erc-last-ison-time now))) (defun erc-notify-JOIN (proc parsed) @@ -211,7 +207,7 @@ with args, toggle notify status of people." 'notify_current ?l ison)))) ((string= (car args) "-l") (erc-display-message nil 'notice 'active - 'notify_list ?l (mapconcat 'identity erc-notify-list + 'notify_list ?l (mapconcat #'identity erc-notify-list " "))) (t (while args @@ -231,7 +227,7 @@ with args, toggle notify status of people." (setq args (cdr args))) (erc-display-message nil 'notice 'active - 'notify_list ?l (mapconcat 'identity erc-notify-list " ")))) + 'notify_list ?l (mapconcat #'identity erc-notify-list " ")))) t) (autoload 'pcomplete-erc-all-nicks "erc-pcomplete") diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el index 0cb60f5efa0..4c244b7984d 100644 --- a/lisp/erc/erc-page.el +++ b/lisp/erc/erc-page.el @@ -1,4 +1,4 @@ -;; erc-page.el - CTCP PAGE support for ERC +;; erc-page.el - CTCP PAGE support for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc. @@ -30,6 +30,10 @@ (require 'erc) +(defgroup erc-page nil + "React to CTCP PAGE messages." + :group 'erc) + ;;;###autoload(autoload 'erc-page-mode "erc-page") (define-erc-module page ctcp-page "Process CTCP PAGE requests from IRC." @@ -37,10 +41,6 @@ (erc-define-catalog-entry 'english 'CTCP-PAGE "Page from %n (%u@%h): %m") -(defgroup erc-page nil - "React to CTCP PAGE messages." - :group 'erc) - (defcustom erc-page-function nil "A function to process a \"page\" request. If nil, this prints the page message in the minibuffer and calls @@ -53,20 +53,18 @@ Example for your init file: (lambda (sender msg) (play-sound-file \"/home/alex/elisp/erc/sounds/ni.wav\") (message \"IRC Page from %s: %s\" sender msg)))" - :group 'erc-page :type '(choice (const nil) (function))) -(defcustom erc-ctcp-query-PAGE-hook '(erc-ctcp-query-PAGE) +(defcustom erc-ctcp-query-PAGE-hook (list #'erc-ctcp-query-PAGE) "List of functions to be called when a CTCP PAGE is received. This is called from `erc-process-ctcp-query'. The functions are called with six arguments: PROC NICK LOGIN HOST TO MSG. Note that you can also set `erc-page-function' to a function, which only gets two arguments, SENDER and MSG, so that might be easier to use." - :group 'erc-page :type '(repeat function)) -(defun erc-ctcp-query-PAGE (proc nick login host to msg) +(defun erc-ctcp-query-PAGE (_proc nick login host _to msg) "Deal with an CTCP PAGE query, if `erc-page-mode' is non-nil. This will call `erc-page-function', if defined, or it will just print a message and `beep'. In addition to that, the page message is also @@ -91,7 +89,7 @@ inserted into the server buffer." nil 'notice nil text))) nil) -(defun erc-cmd-PAGE (line &optional force) +(defun erc-cmd-PAGE (line &optional _force) "Send a CTCP page to the user given as the first word in LINE. The rest of LINE is the message to send. Note that you will only receive pages if `erc-page-mode' is on." diff --git a/lisp/erc/erc-pcomplete.el b/lisp/erc/erc-pcomplete.el index e9ebf0a07a4..8ea37c7f290 100644 --- a/lisp/erc/erc-pcomplete.el +++ b/lisp/erc/erc-pcomplete.el @@ -1,4 +1,4 @@ -;;; erc-pcomplete.el --- Provides programmable completion for ERC +;;; erc-pcomplete.el --- Provides programmable completion for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc. @@ -50,23 +50,21 @@ (defcustom erc-pcomplete-nick-postfix ":" "When `pcomplete' is used in the first word after the prompt, add this string to nicks completed." - :group 'erc-pcomplete :type 'string) (defcustom erc-pcomplete-order-nickname-completions t "If t, channel nickname completions will be ordered such that the most recent speakers are listed first." - :group 'erc-pcomplete :type 'boolean) ;;;###autoload(autoload 'erc-completion-mode "erc-pcomplete" nil t) (define-erc-module pcomplete Completion "In ERC Completion mode, the TAB key does completion whenever possible." - ((add-hook 'erc-mode-hook 'pcomplete-erc-setup) - (add-hook 'erc-complete-functions 'erc-pcompletions-at-point) + ((add-hook 'erc-mode-hook #'pcomplete-erc-setup) + (add-hook 'erc-complete-functions #'erc-pcompletions-at-point) (erc-buffer-list #'pcomplete-erc-setup)) - ((remove-hook 'erc-mode-hook 'pcomplete-erc-setup) - (remove-hook 'erc-complete-functions 'erc-pcompletions-at-point))) + ((remove-hook 'erc-mode-hook #'pcomplete-erc-setup) + (remove-hook 'erc-complete-functions #'erc-pcompletions-at-point))) (defun erc-pcompletions-at-point () "ERC completion data from pcomplete. @@ -154,7 +152,7 @@ for use on `completion-at-point-function'." (defun pcomplete/erc-mode/NAMES () (while (pcomplete-here (pcomplete-erc-channels)))) -(defalias 'pcomplete/erc-mode/NOTICE 'pcomplete/erc-mode/MSG) +(defalias 'pcomplete/erc-mode/NOTICE #'pcomplete/erc-mode/MSG) (defun pcomplete/erc-mode/OP () (while (pcomplete-here (pcomplete-erc-not-ops)))) @@ -162,7 +160,7 @@ for use on `completion-at-point-function'." (defun pcomplete/erc-mode/PART () (pcomplete-here (pcomplete-erc-channels))) -(defalias 'pcomplete/erc-mode/LEAVE 'pcomplete/erc-mode/PART) +(defalias 'pcomplete/erc-mode/LEAVE #'pcomplete/erc-mode/PART) (defun pcomplete/erc-mode/QUERY () (pcomplete-here (append (pcomplete-erc-all-nicks) diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el index c67d7514037..d08d9850c10 100644 --- a/lisp/erc/erc-replace.el +++ b/lisp/erc/erc-replace.el @@ -1,4 +1,4 @@ -;; erc-replace.el -- wash and massage messages inserted into the buffer +;; erc-replace.el -- wash and massage messages inserted into the buffer -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2002, 2004, 2006-2021 Free Software Foundation, ;; Inc. @@ -49,7 +49,6 @@ expression or a variable, or any sexp, TO can be a string or a function to call, or any sexp. If a function, it will be called with one argument, the string to be replaced, and it should return a replacement string." - :group 'erc-replace :type '(repeat (cons :tag "Search & Replace" (choice :tag "From" regexp @@ -68,23 +67,23 @@ It replaces text according to `erc-replace-alist'." (let ((from (car elt)) (to (cdr elt))) (unless (stringp from) - (setq from (eval from))) + (setq from (eval from t))) (while (re-search-forward from nil t) (cond ((stringp to) (replace-match to)) - ((and (symbolp to) (fboundp to)) + ((functionp to) (replace-match (funcall to (match-string 0)))) (t - (eval to)))))) + (eval to t)))))) erc-replace-alist)) ;;;###autoload(autoload 'erc-replace-mode "erc-replace") (define-erc-module replace nil "This mode replaces incoming text according to `erc-replace-alist'." ((add-hook 'erc-insert-modify-hook - 'erc-replace-insert)) + #'erc-replace-insert)) ((remove-hook 'erc-insert-modify-hook - 'erc-replace-insert))) + #'erc-replace-insert))) (provide 'erc-replace) diff --git a/lisp/erc/erc-ring.el b/lisp/erc/erc-ring.el index 028ab1eead8..28299ae46c3 100644 --- a/lisp/erc/erc-ring.el +++ b/lisp/erc/erc-ring.el @@ -1,4 +1,4 @@ -;; erc-ring.el -- Command history handling for erc using ring.el +;; erc-ring.el -- Command history handling for erc using ring.el -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc. @@ -46,12 +46,12 @@ (define-erc-module ring nil "Stores input in a ring so that previous commands and messages can be recalled using M-p and M-n." - ((add-hook 'erc-pre-send-functions 'erc-add-to-input-ring) - (define-key erc-mode-map "\M-p" 'erc-previous-command) - (define-key erc-mode-map "\M-n" 'erc-next-command)) - ((remove-hook 'erc-pre-send-functions 'erc-add-to-input-ring) - (define-key erc-mode-map "\M-p" 'undefined) - (define-key erc-mode-map "\M-n" 'undefined))) + ((add-hook 'erc-pre-send-functions #'erc-add-to-input-ring) + (define-key erc-mode-map "\M-p" #'erc-previous-command) + (define-key erc-mode-map "\M-n" #'erc-next-command)) + ((remove-hook 'erc-pre-send-functions #'erc-add-to-input-ring) + (define-key erc-mode-map "\M-p" #'undefined) + (define-key erc-mode-map "\M-n" #'undefined))) (defvar-local erc-input-ring nil "Input ring for erc.") diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el index 9ef8b7f46ab..09d1f7a3302 100644 --- a/lisp/erc/erc-services.el +++ b/lisp/erc/erc-services.el @@ -91,7 +91,6 @@ Possible settings are:. nil - Disables automatic Nickserv identification. You can also use \\[erc-nickserv-identify-mode] to change modes." - :group 'erc-services :type '(choice (const autodetect) (const nick-change) (const both) @@ -107,13 +106,13 @@ You can also use \\[erc-nickserv-identify-mode] to change modes." "This mode automates communication with services." ((erc-nickserv-identify-mode erc-nickserv-identify-mode)) ((remove-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identify-autodetect) + #'erc-nickserv-identify-autodetect) (remove-hook 'erc-after-connect - 'erc-nickserv-identify-on-connect) + #'erc-nickserv-identify-on-connect) (remove-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change) + #'erc-nickserv-identify-on-nick-change) (remove-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identification-autodetect))) + #'erc-nickserv-identification-autodetect))) ;;;###autoload (defun erc-nickserv-identify-mode (mode) @@ -123,7 +122,7 @@ You can also use \\[erc-nickserv-identify-mode] to change modes." "Choose Nickserv identify mode (RET to disable): " '(("autodetect") ("nick-change") ("both")) nil t)))) (add-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identification-autodetect) + #'erc-nickserv-identification-autodetect) (unless erc-networks-mode ;; Force-enable networks module, because we need it to set ;; erc-network for us. @@ -131,41 +130,40 @@ You can also use \\[erc-nickserv-identify-mode] to change modes." (cond ((eq mode 'autodetect) (setq erc-nickserv-identify-mode 'autodetect) (add-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identify-autodetect) + #'erc-nickserv-identify-autodetect) (remove-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change) + #'erc-nickserv-identify-on-nick-change) (remove-hook 'erc-after-connect - 'erc-nickserv-identify-on-connect)) + #'erc-nickserv-identify-on-connect)) ((eq mode 'nick-change) (setq erc-nickserv-identify-mode 'nick-change) (add-hook 'erc-after-connect - 'erc-nickserv-identify-on-connect) + #'erc-nickserv-identify-on-connect) (add-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change) + #'erc-nickserv-identify-on-nick-change) (remove-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identify-autodetect)) + #'erc-nickserv-identify-autodetect)) ((eq mode 'both) (setq erc-nickserv-identify-mode 'both) (add-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identify-autodetect) + #'erc-nickserv-identify-autodetect) (add-hook 'erc-after-connect - 'erc-nickserv-identify-on-connect) + #'erc-nickserv-identify-on-connect) (add-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change)) + #'erc-nickserv-identify-on-nick-change)) (t (setq erc-nickserv-identify-mode nil) (remove-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identify-autodetect) + #'erc-nickserv-identify-autodetect) (remove-hook 'erc-after-connect - 'erc-nickserv-identify-on-connect) + #'erc-nickserv-identify-on-connect) (remove-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change) + #'erc-nickserv-identify-on-nick-change) (remove-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identification-autodetect)))) + #'erc-nickserv-identification-autodetect)))) (defcustom erc-prompt-for-nickserv-password t "Ask for the password when identifying to NickServ." - :group 'erc-services :type 'boolean) (defcustom erc-use-auth-source-for-nickserv-password nil @@ -174,7 +172,6 @@ This option has an no effect if `erc-prompt-for-nickserv-password' is non-nil, and passwords from `erc-nickserv-passwords' take precedence." :version "28.1" - :group 'erc-services :type 'boolean) (defcustom erc-nickserv-passwords nil @@ -187,7 +184,6 @@ Example of use: \\='((freenode ((\"nick-one\" . \"password\") (\"nick-two\" . \"password\"))) (DALnet ((\"nick\" . \"password\")))))" - :group 'erc-services :type '(repeat (list :tag "Network" (choice :tag "Network name" @@ -305,7 +301,6 @@ ANSWER is the command to use for the answer. The default is `privmsg'. SUCCESS-REGEXP is a regular expression matching the message nickserv sends when you've successfully identified. The last two elements are optional." - :group 'erc-services :type '(repeat (list :tag "Nickserv data" (symbol :tag "Network name") @@ -357,7 +352,6 @@ The last two elements are optional." (defcustom erc-nickserv-identified-hook nil "Run this hook when NickServ acknowledged successful identification. Hooks are called with arguments (NETWORK NICK)." - :group 'erc-services :type 'hook) (defun erc-nickserv-identification-autodetect (_proc parsed) diff --git a/lisp/erc/erc-sound.el b/lisp/erc/erc-sound.el index fff1639a9de..92759d206a3 100644 --- a/lisp/erc/erc-sound.el +++ b/lisp/erc/erc-sound.el @@ -52,11 +52,11 @@ "In ERC sound mode, the client will respond to CTCP SOUND requests and play sound files as requested." ;; Enable: - ((add-hook 'erc-ctcp-query-SOUND-hook 'erc-ctcp-query-SOUND) - (define-key erc-mode-map "\C-c\C-s" 'erc-toggle-sound)) + ((add-hook 'erc-ctcp-query-SOUND-hook #'erc-ctcp-query-SOUND) + (define-key erc-mode-map "\C-c\C-s" #'erc-toggle-sound)) ;; Disable: - ((remove-hook 'erc-ctcp-query-SOUND-hook 'erc-ctcp-query-SOUND) - (define-key erc-mode-map "\C-c\C-s" 'undefined))) + ((remove-hook 'erc-ctcp-query-SOUND-hook #'erc-ctcp-query-SOUND) + (define-key erc-mode-map "\C-c\C-s" #'undefined))) (erc-define-catalog-entry 'english 'CTCP-SOUND "%n (%u@%h) plays %s:%m") diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el index c2be23990f1..bb858445235 100644 --- a/lisp/erc/erc-speedbar.el +++ b/lisp/erc/erc-speedbar.el @@ -1,4 +1,4 @@ -;;; erc-speedbar.el --- Speedbar support for ERC +;;; erc-speedbar.el --- Speedbar support for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc. @@ -52,7 +52,6 @@ `activity' - Sort users by channel activity `alphabetical' - Sort users alphabetically nil - Do not sort users" - :group 'erc-speedbar :type '(choice (const :tag "Sort users by channel activity" activity) (const :tag "Sort users alphabetically" alphabetical) (const :tag "Do not sort users" nil))) @@ -67,11 +66,11 @@ nil - Do not sort users" (setq erc-speedbar-key-map (speedbar-make-specialized-keymap)) ;; Basic tree features - (define-key erc-speedbar-key-map "e" 'speedbar-edit-line) - (define-key erc-speedbar-key-map "\C-m" 'speedbar-edit-line) - (define-key erc-speedbar-key-map "+" 'speedbar-expand-line) - (define-key erc-speedbar-key-map "=" 'speedbar-expand-line) - (define-key erc-speedbar-key-map "-" 'speedbar-contract-line)) + (define-key erc-speedbar-key-map "e" #'speedbar-edit-line) + (define-key erc-speedbar-key-map "\C-m" #'speedbar-edit-line) + (define-key erc-speedbar-key-map "+" #'speedbar-expand-line) + (define-key erc-speedbar-key-map "=" #'speedbar-expand-line) + (define-key erc-speedbar-key-map "-" #'speedbar-contract-line)) (speedbar-add-expansion-list '("ERC" erc-speedbar-menu-items erc-speedbar-key-map @@ -124,7 +123,7 @@ This will add a speedbar major display mode." (erc-speedbar-insert-target buffer 0)) (t (ignore))))) -(defun erc-speedbar-server-buttons (directory depth) +(defun erc-speedbar-server-buttons (_directory depth) "Insert the initial list of servers you are connected to." (let ((servers (erc-buffer-list (lambda () @@ -154,7 +153,7 @@ This will add a speedbar major display mode." (t (error "Ooops... not sure what to do"))) (speedbar-center-buffer-smartly)) -(defun erc-speedbar-channel-buttons (directory depth server-buffer) +(defun erc-speedbar-channel-buttons (_directory depth server-buffer) (when (get-buffer server-buffer) (let* ((proc (with-current-buffer server-buffer erc-server-process)) (targets (erc-buffer-list @@ -191,7 +190,7 @@ INDENT is the current indentation level." (save-excursion (end-of-line) (forward-char 1) (let ((modes (with-current-buffer channel - (concat (apply 'concat + (concat (apply #'concat erc-channel-modes) (cond ((and erc-channel-user-limit @@ -314,7 +313,7 @@ The update is only done when the channel is actually expanded already." (t (error "Ooops... not sure what to do"))) (speedbar-center-buffer-smartly)) -(defun erc-speedbar-goto-buffer (text buffer indent) +(defun erc-speedbar-goto-buffer (_text buffer _indent) "When user clicks on TEXT, goto an ERC buffer. The INDENT level is ignored." (if (featurep 'dframe) diff --git a/lisp/erc/erc-spelling.el b/lisp/erc/erc-spelling.el index c18ac5b3ec0..950a821e3c4 100644 --- a/lisp/erc/erc-spelling.el +++ b/lisp/erc/erc-spelling.el @@ -1,4 +1,4 @@ -;;; erc-spelling.el --- use flyspell in ERC +;;; erc-spelling.el --- use flyspell in ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2005-2021 Free Software Foundation, Inc. @@ -38,10 +38,10 @@ "Enable flyspell mode in ERC buffers." ;; Use erc-connect-pre-hook instead of erc-mode-hook as pre-hook is ;; called AFTER the server buffer is initialized. - ((add-hook 'erc-connect-pre-hook 'erc-spelling-init) + ((add-hook 'erc-connect-pre-hook #'erc-spelling-init) (dolist (buffer (erc-buffer-list)) (erc-spelling-init buffer))) - ((remove-hook 'erc-connect-pre-hook 'erc-spelling-init) + ((remove-hook 'erc-connect-pre-hook #'erc-spelling-init) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer (flyspell-mode 0))))) @@ -104,7 +104,7 @@ The cadr is the beginning and the caddr is the end." (put 'erc-mode 'flyspell-mode-predicate - 'erc-spelling-flyspell-verify) + #'erc-spelling-flyspell-verify) (provide 'erc-spelling) diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index da91364e9cc..31de9e80697 100644 --- a/lisp/erc/erc-stamp.el +++ b/lisp/erc/erc-stamp.el @@ -52,7 +52,6 @@ This string is processed using `format-time-string'. Good examples are \"%T\" and \"%H:%M\". If nil, timestamping is turned off." - :group 'erc-stamp :type '(choice (const nil) (string))) @@ -66,7 +65,6 @@ screen when `erc-insert-timestamp-function' is set to `erc-insert-timestamp-left-and-right'. If nil, timestamping is turned off." - :group 'erc-stamp :type '(choice (const nil) (string))) @@ -80,7 +78,6 @@ screen when `erc-insert-timestamp-function' is set to `erc-insert-timestamp-left-and-right'. If nil, timestamping is turned off." - :group 'erc-stamp :type '(choice (const nil) (string))) @@ -95,7 +92,6 @@ operate on. You will probably want to set `erc-insert-away-timestamp-function' to the same value." - :group 'erc-stamp :type '(choice (const :tag "Both sides" erc-insert-timestamp-left-and-right) (const :tag "Right" erc-insert-timestamp-right) (const :tag "Left" erc-insert-timestamp-left) @@ -108,7 +104,6 @@ If nil, timestamping is turned off when away unless `erc-timestamp-format' is set. If `erc-timestamp-format' is set, this will not be used." - :group 'erc-stamp :type '(choice (const nil) (string))) @@ -117,7 +112,6 @@ If `erc-timestamp-format' is set, this will not be used." "Function to use to insert the away timestamp. See `erc-insert-timestamp-function' for details." - :group 'erc-stamp :type '(choice (const :tag "Both sides" erc-insert-timestamp-left-and-right) (const :tag "Right" erc-insert-timestamp-right) (const :tag "Left" erc-insert-timestamp-left) @@ -128,7 +122,6 @@ See `erc-insert-timestamp-function' for details." This is useful for logging, because, although timestamps will be hidden, they will still be present in the logs." - :group 'erc-stamp :type 'boolean) (defcustom erc-echo-timestamps nil @@ -136,20 +129,17 @@ hidden, they will still be present in the logs." Using this variable, you can turn off normal timestamping, and simply move point to an irc message to see its timestamp printed in the minibuffer." - :group 'erc-stamp :type 'boolean) (defcustom erc-echo-timestamp-format "Timestamped %A, %H:%M:%S" "Format string to be used when `erc-echo-timestamps' is non-nil. This string specifies the format of the timestamp being echoed in the minibuffer." - :group 'erc-stamp :type 'string) (defcustom erc-timestamp-intangible nil "Whether the timestamps should be intangible, i.e. prevent the point from entering them and instead jump over them." - :group 'erc-stamp :version "24.5" :type 'boolean) @@ -211,7 +201,6 @@ string of spaces which is the same size as the timestamp is added to the beginning of the line in its place. If you use `erc-insert-timestamp-right', nothing gets inserted in place of the timestamp." - :group 'erc-stamp :type 'boolean) (defcustom erc-timestamp-right-column nil @@ -219,7 +208,6 @@ timestamp." if the timestamp is to be printed to the right. If nil, `erc-insert-timestamp-right' will use other means to determine the correct column." - :group 'erc-stamp :type '(choice (integer :tag "Column number") (const :tag "Unspecified" nil))) @@ -231,7 +219,6 @@ Asian language characters and math symbols) precede a timestamp. A side effect of enabling this is that there will only be one space before a right timestamp in any saved logs." - :group 'erc-stamp :type 'boolean) (defun erc-insert-timestamp-left (string) diff --git a/lisp/erc/erc-status-sidebar.el b/lisp/erc/erc-status-sidebar.el index ff51026088a..a75a74bb6fd 100644 --- a/lisp/erc/erc-status-sidebar.el +++ b/lisp/erc/erc-status-sidebar.el @@ -1,4 +1,4 @@ -;;; erc-status-sidebar.el --- HexChat-like activity overview for ERC +;;; erc-status-sidebar.el --- HexChat-like activity overview for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2017, 2020-2021 Free Software Foundation, Inc. @@ -58,36 +58,30 @@ (defcustom erc-status-sidebar-buffer-name "*ERC Status*" "Name of the sidebar buffer." - :type 'string - :group 'erc-status-sidebar) + :type 'string) (defcustom erc-status-sidebar-mode-line-format "ERC Status" "Mode line format for the status sidebar." - :type 'string - :group 'erc-status-sidebar) + :type 'string) (defcustom erc-status-sidebar-header-line-format nil "Header line format for the status sidebar." :type '(choice (const :tag "No header line" nil) - string) - :group 'erc-status-sidebar) + string)) (defcustom erc-status-sidebar-width 15 "Default width of the sidebar (in columns)." - :type 'number - :group 'erc-status-sidebar) + :type 'number) (defcustom erc-status-sidebar-channel-sort 'erc-status-sidebar-default-chansort "Sorting function used to determine order of channels in the sidebar." - :type 'function - :group 'erc-status-sidebar) + :type 'function) (defcustom erc-status-sidebar-channel-format 'erc-status-sidebar-default-chan-format "Function used to format channel names for display in the sidebar." - :type 'function - :group 'erc-status-sidebar) + :type 'function) (defun erc-status-sidebar-display-window () "Display the status buffer in a side window. Return the new window." @@ -152,7 +146,8 @@ containing it on the current frame is closed. See (save-excursion (let ((sidebar-exists (erc-status-sidebar-buffer-exists-p)) (sidebar-buffer (erc-status-sidebar-get-buffer)) - (sidebar-window (erc-status-sidebar-get-window))) + ;; (sidebar-window (erc-status-sidebar-get-window)) + ) (unless sidebar-exists (with-current-buffer sidebar-buffer (erc-status-sidebar-mode) @@ -253,7 +248,7 @@ name stand out." erc-disconnected-hook erc-quit-hook)) -(defun erc-status-sidebar--post-refresh (&rest ignore) +(defun erc-status-sidebar--post-refresh (&rest _ignore) "Schedule sidebar refresh for execution after command stack is cleared. Ignore arguments in IGNORE, allowing this function to be added to @@ -276,7 +271,7 @@ to the `window-configuration-change-hook'." (when (and (eq (selected-window) (erc-status-sidebar-get-window)) (fboundp 'window-preserve-size)) (unless (eq (window-total-width) (window-min-size nil t)) - (apply 'window-preserve-size (selected-window) t t nil)))) + (apply #'window-preserve-size (selected-window) t t nil)))) (define-derived-mode erc-status-sidebar-mode special-mode "ERC Sidebar" "Major mode for ERC status sidebar" @@ -298,8 +293,7 @@ to the `window-configuration-change-hook'." ;; erc-status-sidebar-mode initialization code, so it won't undo the ;; add-hook's we did in the previous expressions. (add-hook 'change-major-mode-hook #'erc-status-sidebar-mode--unhook nil t) - (add-hook 'kill-buffer-hook #'erc-status-sidebar-mode--unhook nil t) - :group 'erc-status-sidebar) + (add-hook 'kill-buffer-hook #'erc-status-sidebar-mode--unhook nil t)) (provide 'erc-status-sidebar) ;;; erc-status-sidebar.el ends here diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index a853a362252..8be55558823 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -60,7 +60,6 @@ The reason for using this default value is to both (1) adhere to the Emacs development guidelines which say not to touch keys of the form C-c C-<something> and also (2) to meet the expectations of long-time ERC users, many of whom rely on these keybindings." - :group 'erc-track :type '(choice (const :tag "Ask, if used already" ask) (const :tag "Enable" t) (const :tag "Disable" nil))) @@ -80,7 +79,6 @@ nil - only the selected frame selected-visible - only the selected frame if it is visible Activity means that there was no user input in the last 10 seconds." - :group 'erc-track :type '(choice (const :tag "All frames" t) (const :tag "All visible frames" visible) (const :tag "Only the selected frame" nil) @@ -89,13 +87,11 @@ Activity means that there was no user input in the last 10 seconds." (defcustom erc-track-exclude nil "A list targets (channel names or query targets) which should not be tracked." - :group 'erc-track :type '(repeat string)) (defcustom erc-track-remove-disconnected-buffers nil "If true, remove buffers associated with a server that is disconnected from `erc-modified-channels-alist'." - :group 'erc-track :type 'boolean) (defcustom erc-track-exclude-types '("NICK" "333" "353") @@ -105,25 +101,21 @@ This list could look like (\"JOIN\" \"PART\"). By default, exclude changes of nicknames (NICK), display of who set the channel topic (333), and listing of users on the current channel (353)." - :group 'erc-track :type 'erc-message-type) (defcustom erc-track-exclude-server-buffer nil "If true, don't perform tracking on the server buffer; this is useful for excluding all the things like MOTDs from the server and other miscellaneous functions." - :group 'erc-track :type 'boolean) (defcustom erc-track-shorten-start 1 "This number specifies the minimum number of characters a channel name in the mode-line should be reduced to." - :group 'erc-track :type 'number) (defcustom erc-track-shorten-cutoff 4 "All channel names longer than this value will be shortened." - :group 'erc-track :type 'number) (defcustom erc-track-shorten-aggressively nil @@ -144,7 +136,6 @@ not compared to #electronica -- only to #vi, therefore it can be shortened even more and the result is #e and #v. This setting is used by `erc-track-shorten-names'." - :group 'erc-track :type '(choice (const :tag "No" nil) (const :tag "Yes" t) (const :tag "Max" max))) @@ -154,7 +145,6 @@ This setting is used by `erc-track-shorten-names'." It takes one argument, CHANNEL-NAMES which is a list of strings. It should return a list of strings of the same number of elements. If nil instead of a function, shortening is disabled." - :group 'erc-track :type '(choice (const :tag "Disabled") function)) @@ -165,14 +155,12 @@ If nil instead of a function, shortening is disabled." This is useful for people that don't use the default mode-line notification but instead use a separate mechanism to provide notification of channel activity." - :group 'erc-track :type 'hook) (defcustom erc-track-use-faces t "Use faces in the mode-line. The faces used are the same as used for text in the buffers. \(e.g. `erc-pal-face' is used if a pal sent a message to that channel.)" - :group 'erc-track :type 'boolean) (defcustom erc-track-faces-priority-list @@ -199,7 +187,6 @@ The faces used are the same as used for text in the buffers. "A list of faces used to highlight active buffer names in the mode line. If a message contains one of the faces in this list, the buffer name will be highlighted using that face. The first matching face is used." - :group 'erc-track :type '(repeat (choice face (repeat :tag "Combination" face)))) @@ -214,7 +201,6 @@ this feature. Note: If you have a lot of faces listed in `erc-track-faces-priority-list', setting this variable might not be very useful." - :group 'erc-track :type '(choice (const nil) (repeat string) (const all))) @@ -237,7 +223,6 @@ message. This gives a rough indication that active conversations are occurring in these channels. The effect may be disabled by setting this variable to nil." - :group 'erc-track :type '(repeat (choice face (repeat :tag "Combination" face)))) @@ -249,7 +234,6 @@ Choices are: `after-modes' - add to the end of `mode-line-modes', t - add to the end of `global-mode-string', nil - don't add to mode line." - :group 'erc-track :type '(choice (const :tag "Just before mode information" before-modes) (const :tag "Just after mode information" after-modes) (const :tag "After all other information" t) @@ -266,7 +250,7 @@ nil - don't add to mode line." (if strings (concat (if (eq erc-track-position-in-mode-line 'after-modes) "[" " [") - (mapconcat 'identity (nreverse strings) ",") + (mapconcat #'identity (nreverse strings) ",") (if (eq erc-track-position-in-mode-line 'before-modes) "] " "]")) "")) @@ -289,20 +273,17 @@ while the buffer was not visible.") (defcustom erc-track-showcount nil "If non-nil, count of unseen messages will be shown for each channel." - :type 'boolean - :group 'erc-track) + :type 'boolean) (defcustom erc-track-showcount-string ":" "The string to display between buffer name and the count in the mode line. The default is a colon, resulting in \"#emacs:9\"." - :type 'string - :group 'erc-track) + :type 'string) (defcustom erc-track-switch-from-erc t "If non-nil, `erc-track-switch-buffer' will return to the last non-erc buffer when there are no more active channels." - :type 'boolean - :group 'erc-track) + :type 'boolean) (defcustom erc-track-switch-direction 'oldest "Direction `erc-track-switch-buffer' should switch. @@ -316,7 +297,6 @@ when there are no more active channels." If set to `importance', the importance is determined by position in `erc-track-faces-priority-list', where first is most important." - :group 'erc-track :type '(choice (const importance) (const oldest) (const newest) @@ -472,9 +452,9 @@ START is the minimum length of the name used." (defvar erc-track-minor-mode-map (make-sparse-keymap) "Keymap for rcirc track minor mode.") -(define-key erc-track-minor-mode-map (kbd "C-c C-@") 'erc-track-switch-buffer) +(define-key erc-track-minor-mode-map (kbd "C-c C-@") #'erc-track-switch-buffer) (define-key erc-track-minor-mode-map (kbd "C-c C-SPC") - 'erc-track-switch-buffer) + #'erc-track-switch-buffer) ;;;###autoload (define-minor-mode erc-track-minor-mode @@ -487,8 +467,7 @@ keybindings will not do anything useful." :init-value nil :lighter "" :keymap erc-track-minor-mode-map - :global t - :group 'erc-track) + :global t) (defun erc-track-minor-mode-maybe (&optional buffer) "Enable `erc-track-minor-mode', depending on `erc-track-enable-keybindings'." @@ -530,17 +509,17 @@ keybindings will not do anything useful." ((when (boundp 'erc-track-when-inactive) (if erc-track-when-inactive (progn - (add-hook 'window-configuration-change-hook 'erc-user-is-active) - (add-hook 'erc-send-completed-hook 'erc-user-is-active) - (add-hook 'erc-server-001-functions 'erc-user-is-active)) + (add-hook 'window-configuration-change-hook #'erc-user-is-active) + (add-hook 'erc-send-completed-hook #'erc-user-is-active) + (add-hook 'erc-server-001-functions #'erc-user-is-active)) (erc-track-add-to-mode-line erc-track-position-in-mode-line) (erc-update-mode-line) (add-hook 'window-configuration-change-hook - 'erc-window-configuration-change) - (add-hook 'erc-insert-post-hook 'erc-track-modified-channels) - (add-hook 'erc-disconnected-hook 'erc-modified-channels-update)) + #'erc-window-configuration-change) + (add-hook 'erc-insert-post-hook #'erc-track-modified-channels) + (add-hook 'erc-disconnected-hook #'erc-modified-channels-update)) ;; enable the tracking keybindings - (add-hook 'erc-connect-pre-hook 'erc-track-minor-mode-maybe) + (add-hook 'erc-connect-pre-hook #'erc-track-minor-mode-maybe) (erc-track-minor-mode-maybe))) ;; Disable: ((when (boundp 'erc-track-when-inactive) @@ -548,23 +527,22 @@ keybindings will not do anything useful." (if erc-track-when-inactive (progn (remove-hook 'window-configuration-change-hook - 'erc-user-is-active) - (remove-hook 'erc-send-completed-hook 'erc-user-is-active) - (remove-hook 'erc-server-001-functions 'erc-user-is-active) - (remove-hook 'erc-timer-hook 'erc-user-is-active)) + #'erc-user-is-active) + (remove-hook 'erc-send-completed-hook #'erc-user-is-active) + (remove-hook 'erc-server-001-functions #'erc-user-is-active) + (remove-hook 'erc-timer-hook #'erc-user-is-active)) (remove-hook 'window-configuration-change-hook - 'erc-window-configuration-change) - (remove-hook 'erc-disconnected-hook 'erc-modified-channels-update) - (remove-hook 'erc-insert-post-hook 'erc-track-modified-channels)) + #'erc-window-configuration-change) + (remove-hook 'erc-disconnected-hook #'erc-modified-channels-update) + (remove-hook 'erc-insert-post-hook #'erc-track-modified-channels)) ;; disable the tracking keybindings - (remove-hook 'erc-connect-pre-hook 'erc-track-minor-mode-maybe) + (remove-hook 'erc-connect-pre-hook #'erc-track-minor-mode-maybe) (when erc-track-minor-mode (erc-track-minor-mode -1))))) (defcustom erc-track-when-inactive nil "Enable channel tracking even for visible buffers, if you are inactive." - :group 'erc-track :type 'boolean :set (lambda (sym val) (if erc-track-mode @@ -705,9 +683,9 @@ Use `erc-make-mode-line-buffer-name' to create buttons." ;; four lists we use to create a new ;; `erc-modified-channels-object' using ;; `erc-make-mode-line-buffer-name'. - (let* ((buffers (mapcar 'car erc-modified-channels-alist)) - (counts (mapcar 'cadr erc-modified-channels-alist)) - (faces (mapcar 'cddr erc-modified-channels-alist)) + (let* ((buffers (mapcar #'car erc-modified-channels-alist)) + (counts (mapcar #'cadr erc-modified-channels-alist)) + (faces (mapcar #'cddr erc-modified-channels-alist)) (long-names (mapcar #'(lambda (buf) (or (buffer-name buf) "")) diff --git a/lisp/erc/erc-truncate.el b/lisp/erc/erc-truncate.el index f4514ca1371..ff33fbc5570 100644 --- a/lisp/erc/erc-truncate.el +++ b/lisp/erc/erc-truncate.el @@ -1,4 +1,4 @@ -;;; erc-truncate.el --- Functions for truncating ERC buffers +;;; erc-truncate.el --- Functions for truncating ERC buffers -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2004, 2006-2021 Free Software Foundation, Inc. @@ -41,7 +41,6 @@ "Maximum size in chars of each ERC buffer. Used only when auto-truncation is enabled. \(see `erc-truncate-buffer' and `erc-insert-post-hook')." - :group 'erc-truncate :type 'integer) ;;;###autoload(autoload 'erc-truncate-mode "erc-truncate" nil t) @@ -51,9 +50,9 @@ This prevents the query buffer from getting too large, which can bring any grown Emacs to its knees after a few days worth of tracking heavy-traffic channels." ;;enable - ((add-hook 'erc-insert-post-hook 'erc-truncate-buffer)) + ((add-hook 'erc-insert-post-hook #'erc-truncate-buffer)) ;; disable - ((remove-hook 'erc-insert-post-hook 'erc-truncate-buffer))) + ((remove-hook 'erc-insert-post-hook #'erc-truncate-buffer))) ;;;###autoload (defun erc-truncate-buffer-to-size (size &optional buffer) diff --git a/lisp/erc/erc-xdcc.el b/lisp/erc/erc-xdcc.el index db8383ba20b..e1b9f0de3a7 100644 --- a/lisp/erc/erc-xdcc.el +++ b/lisp/erc/erc-xdcc.el @@ -1,4 +1,4 @@ -;;; erc-xdcc.el --- XDCC file-server support for ERC +;;; erc-xdcc.el --- XDCC file-server support for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2004, 2006-2021 Free Software Foundation, Inc. @@ -51,7 +51,7 @@ Your friends should issue \"/ctcp yournick XDCC list\" to see this." (defcustom erc-xdcc-help-text '(("Hey " nick ", wondering how this works? Pretty easy.") ("Available commands: XDCC [" - (mapconcat 'car erc-xdcc-handler-alist "|") "]") + (mapconcat #'car erc-xdcc-handler-alist "|") "]") ("Type \"/ctcp " (erc-current-nick) " XDCC list\" to see the list of offered files, then type \"/ctcp " (erc-current-nick) " XDCC send #\" to get a particular file number.")) @@ -82,7 +82,7 @@ being evaluated and should return strings." (defvar erc-ctcp-query-XDCC-hook '(erc-xdcc) "Hook called whenever a CTCP XDCC message is received.") -(defun erc-xdcc (proc nick login host to query) +(defun erc-xdcc (proc nick login host _to query) "Handle incoming CTCP XDCC queries." (when erc-xdcc-verbose-flag (erc-display-message nil 'notice proc @@ -96,15 +96,15 @@ being evaluated and should return strings." (format "Unknown XDCC sub-command, try \"/ctcp %s XDCC help\"" (erc-current-nick)))))) -(defun erc-xdcc-help (proc nick login host args) +(defun erc-xdcc-help (proc nick _login _host _args) "Send basic help information to NICK." (mapc (lambda (msg) (erc-xdcc-reply proc nick - (mapconcat (lambda (elt) (if (stringp elt) elt (eval elt))) msg ""))) + (mapconcat (lambda (elt) (if (stringp elt) elt (eval elt t))) msg ""))) erc-xdcc-help-text)) -(defun erc-xdcc-list (proc nick login host args) +(defun erc-xdcc-list (proc nick _login _host _args) "Show the contents of `erc-xdcc-files' via privmsg to NICK." (if (null erc-xdcc-files) (erc-xdcc-reply proc nick "No files offered, sorry") @@ -117,7 +117,7 @@ being evaluated and should return strings." (setq n (1+ n)) (erc-dcc-file-to-name file))))))) -(defun erc-xdcc-send (proc nick login host args) +(defun erc-xdcc-send (proc nick _login _host args) "Send a file to NICK." (let ((n (string-to-number (car args))) (len (length erc-xdcc-files))) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 939113acc52..bdb1914d7bf 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1,4 +1,4 @@ -;; erc.el --- An Emacs Internet Relay Chat client -*- lexical-binding:t -*- +;;; erc.el --- An Emacs Internet Relay Chat client -*- lexical-binding:t -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. @@ -1133,31 +1133,31 @@ which the local user typed." (defvar erc-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\C-m" 'erc-send-current-line) - (define-key map "\C-a" 'erc-bol) - (define-key map [home] 'erc-bol) - (define-key map "\C-c\C-a" 'erc-bol) - (define-key map "\C-c\C-b" 'erc-switch-to-buffer) - (define-key map "\C-c\C-c" 'erc-toggle-interpret-controls) - (define-key map "\C-c\C-d" 'erc-input-action) - (define-key map "\C-c\C-e" 'erc-toggle-ctcp-autoresponse) - (define-key map "\C-c\C-f" 'erc-toggle-flood-control) - (define-key map "\C-c\C-i" 'erc-invite-only-mode) - (define-key map "\C-c\C-j" 'erc-join-channel) - (define-key map "\C-c\C-n" 'erc-channel-names) - (define-key map "\C-c\C-o" 'erc-get-channel-mode-from-keypress) - (define-key map "\C-c\C-p" 'erc-part-from-channel) - (define-key map "\C-c\C-q" 'erc-quit-server) - (define-key map "\C-c\C-r" 'erc-remove-text-properties-region) - (define-key map "\C-c\C-t" 'erc-set-topic) - (define-key map "\C-c\C-u" 'erc-kill-input) - (define-key map "\C-c\C-x" 'erc-quit-server) - (define-key map "\M-\t" 'ispell-complete-word) - (define-key map "\t" 'completion-at-point) + (define-key map "\C-m" #'erc-send-current-line) + (define-key map "\C-a" #'erc-bol) + (define-key map [home] #'erc-bol) + (define-key map "\C-c\C-a" #'erc-bol) + (define-key map "\C-c\C-b" #'erc-switch-to-buffer) + (define-key map "\C-c\C-c" #'erc-toggle-interpret-controls) + (define-key map "\C-c\C-d" #'erc-input-action) + (define-key map "\C-c\C-e" #'erc-toggle-ctcp-autoresponse) + (define-key map "\C-c\C-f" #'erc-toggle-flood-control) + (define-key map "\C-c\C-i" #'erc-invite-only-mode) + (define-key map "\C-c\C-j" #'erc-join-channel) + (define-key map "\C-c\C-n" #'erc-channel-names) + (define-key map "\C-c\C-o" #'erc-get-channel-mode-from-keypress) + (define-key map "\C-c\C-p" #'erc-part-from-channel) + (define-key map "\C-c\C-q" #'erc-quit-server) + (define-key map "\C-c\C-r" #'erc-remove-text-properties-region) + (define-key map "\C-c\C-t" #'erc-set-topic) + (define-key map "\C-c\C-u" #'erc-kill-input) + (define-key map "\C-c\C-x" #'erc-quit-server) + (define-key map "\M-\t" #'ispell-complete-word) + (define-key map "\t" #'completion-at-point) ;; Suppress `font-lock-fontify-block' key binding since it ;; destroys face properties. - (define-key map [remap font-lock-fontify-block] 'undefined) + (define-key map [remap font-lock-fontify-block] #'undefined) map) "ERC keymap.") @@ -1293,6 +1293,9 @@ and disable it otherwise. If called from Lisp, enable the mode if ARG is omitted or nil. %s" name name doc) nil nil nil + ;; FIXME: We don't know if this group exists, so this `:group' may + ;; actually just silence a valid warning about the fact that the var + ;; is not associated with any group. :global ,(not local-p) :group (quote ,group) (if ,mode (,enable) @@ -1313,12 +1316,10 @@ if ARG is omitted or nil. ,@disable-body) ,(when (and alias (not (eq name alias))) `(defalias - (quote - ,(intern + ',(intern (format "erc-%s-mode" - (downcase (symbol-name alias))))) - (quote - ,mode))) + (downcase (symbol-name alias)))) + #',mode)) ;; For find-function and find-variable. (put ',mode 'definition-name ',name) (put ',enable 'definition-name ',name) @@ -1745,7 +1746,7 @@ nil." (ignore res) res))) -(define-obsolete-function-alias 'erc-iswitchb 'erc-switch-to-buffer "25.1") +(define-obsolete-function-alias 'erc-iswitchb #'erc-switch-to-buffer "25.1") (defun erc--switch-to-buffer (&optional arg) (read-buffer "Switch to ERC buffer: " (when (boundp 'erc-modified-channels-alist) @@ -1854,7 +1855,7 @@ removed from the list will be disabled." :get (lambda (sym) ;; replace outdated names with their newer equivalents (erc-migrate-modules (symbol-value sym))) - :initialize 'custom-initialize-default + :initialize #'custom-initialize-default :set (lambda (sym val) ;; disable modules which have just been removed (when (and (boundp 'erc-modules) erc-modules val) @@ -2219,8 +2220,8 @@ be invoked for the values of the other parameters." (erc-open server port nick full-name t password)) ;;;###autoload -(defalias 'erc-select 'erc) -(defalias 'erc-ssl 'erc-tls) +(defalias 'erc-select #'erc) +(defalias 'erc-ssl #'erc-tls) ;;;###autoload (defun erc-tls (&rest r) @@ -2841,14 +2842,14 @@ VALUE is computed by evaluating the rest of LINE in Lisp." (val (read (match-string 2 line)))) (if (boundp var) (progn - (set var (eval val)) + (set var (eval val t)) (erc-display-message nil nil 'active (format "Set %S to %S" var val)) t) (setq var (read (match-string 1 line))) (if (boundp var) (progn - (set var (eval val)) + (set var (eval val t)) (erc-display-message nil nil 'active (format "Set %S to %S" var val)) t) @@ -2870,8 +2871,8 @@ VALUE is computed by evaluating the rest of LINE in Lisp." (current-buffer)) t) (t nil))) -(defalias 'erc-cmd-VAR 'erc-cmd-SET) -(defalias 'erc-cmd-VARIABLE 'erc-cmd-SET) +(defalias 'erc-cmd-VAR #'erc-cmd-SET) +(defalias 'erc-cmd-VARIABLE #'erc-cmd-SET) (put 'erc-cmd-SET 'do-not-parse-args t) (put 'erc-cmd-SET 'process-not-needed t) @@ -2999,7 +3000,7 @@ If no USER argument is specified, list the contents of `erc-ignore-list'." (car user-data)) ops))))) erc-channel-users)) - (setq ops (sort ops 'string-lessp)) + (setq ops (sort ops #'string-lessp)) (if ops (erc-display-message nil 'notice (current-buffer) 'ops @@ -3098,7 +3099,7 @@ For a list of user commands (/join /part, ...): (message "Type C-h m to get additional information about keybindings.") t)) -(defalias 'erc-cmd-H 'erc-cmd-HELP) +(defalias 'erc-cmd-H #'erc-cmd-HELP) (put 'erc-cmd-HELP 'process-not-needed t) (defun erc-server-join-channel (server channel &optional secret) @@ -3144,8 +3145,8 @@ were most recently invited. See also `invitation'." (erc-server-join-channel server chnl key))))) t) -(defalias 'erc-cmd-CHANNEL 'erc-cmd-JOIN) -(defalias 'erc-cmd-J 'erc-cmd-JOIN) +(defalias 'erc-cmd-CHANNEL #'erc-cmd-JOIN) +(defalias 'erc-cmd-J #'erc-cmd-JOIN) (defvar-local erc-channel-new-member-names nil "If non-nil, a names list is currently being received. @@ -3169,7 +3170,7 @@ command." (erc-server-send (concat "NAMES " tgt))) (erc-display-message nil 'error (current-buffer) 'no-default-channel))) t) -(defalias 'erc-cmd-N 'erc-cmd-NAMES) +(defalias 'erc-cmd-N #'erc-cmd-NAMES) (defun erc-cmd-KICK (target &optional reason-or-nick &rest reasonwords) "Kick the user indicated in LINE from the current channel. @@ -3239,7 +3240,7 @@ If SERVER is non-nil, use that, rather than the current server." (erc-log (format "cmd: %s" send)) (erc-server-send send) t)) -(defalias 'erc-cmd-WI 'erc-cmd-WHOIS) +(defalias 'erc-cmd-WI #'erc-cmd-WHOIS) (defun erc-cmd-WHOAMI () "Display whois information about yourself." @@ -3410,7 +3411,7 @@ The rest is the message to send." The rest of LINE is the message to send." (erc-message "PRIVMSG" line)) -(defalias 'erc-cmd-M 'erc-cmd-MSG) +(defalias 'erc-cmd-M #'erc-cmd-MSG) (put 'erc-cmd-MSG 'do-not-parse-args t) (defun erc-cmd-SQUERY (line) @@ -3465,7 +3466,7 @@ Otherwise leave the channel indicated by LINE." (t nil))) (put 'erc-cmd-PART 'do-not-parse-args t) -(defalias 'erc-cmd-LEAVE 'erc-cmd-PART) +(defalias 'erc-cmd-LEAVE #'erc-cmd-PART) (defun erc-cmd-PING (recipient) "Ping RECIPIENT." @@ -3517,7 +3518,7 @@ If USER is omitted, close the current query buffer if one exists ;; currently broken, evil hack to display help anyway ;(erc-delete-query)))) (signal 'wrong-number-of-arguments "")))) -(defalias 'erc-cmd-Q 'erc-cmd-QUERY) +(defalias 'erc-cmd-Q #'erc-cmd-QUERY) (defun erc-quit/part-reason-default () "Default quit/part message." @@ -3612,9 +3613,9 @@ the message given by REASON." t) (t nil))) -(defalias 'erc-cmd-BYE 'erc-cmd-QUIT) -(defalias 'erc-cmd-EXIT 'erc-cmd-QUIT) -(defalias 'erc-cmd-SIGNOFF 'erc-cmd-QUIT) +(defalias 'erc-cmd-BYE #'erc-cmd-QUIT) +(defalias 'erc-cmd-EXIT #'erc-cmd-QUIT) +(defalias 'erc-cmd-SIGNOFF #'erc-cmd-QUIT) (put 'erc-cmd-QUIT 'do-not-parse-args t) (put 'erc-cmd-QUIT 'process-not-needed t) @@ -3633,7 +3634,7 @@ the message given by REASON." (kill-buffer buffer))))) t) -(defalias 'erc-cmd-GQ 'erc-cmd-GQUIT) +(defalias 'erc-cmd-GQ #'erc-cmd-GQUIT) (put 'erc-cmd-GQUIT 'do-not-parse-args t) (put 'erc-cmd-GQUIT 'process-not-needed t) @@ -3731,7 +3732,7 @@ the message given by REASON." (erc-server-send (concat "TIME " args))) t) (t (erc-server-send "TIME")))) -(defalias 'erc-cmd-DATE 'erc-cmd-TIME) +(defalias 'erc-cmd-DATE #'erc-cmd-TIME) (defun erc-cmd-TOPIC (topic) "Set or request the topic for a channel. @@ -3772,7 +3773,7 @@ be displayed." (erc-display-message nil 'error (current-buffer) 'no-target))) t) (t nil))) -(defalias 'erc-cmd-T 'erc-cmd-TOPIC) +(defalias 'erc-cmd-T #'erc-cmd-TOPIC) (put 'erc-cmd-TOPIC 'do-not-parse-args t) (defun erc-cmd-APPENDTOPIC (topic) @@ -3784,7 +3785,7 @@ be displayed." ;; strip trailing ^O (when (string-match "\\(.*\\)\C-o" oldtopic) (erc-cmd-TOPIC (concat (match-string 1 oldtopic) topic))))) -(defalias 'erc-cmd-AT 'erc-cmd-APPENDTOPIC) +(defalias 'erc-cmd-AT #'erc-cmd-APPENDTOPIC) (put 'erc-cmd-APPENDTOPIC 'do-not-parse-args t) (defun erc-cmd-CLEARTOPIC (&optional channel) @@ -3808,6 +3809,8 @@ The property `received-from-server' indicates whether or not the ban list has been requested from the server.") (put 'erc-channel-banlist 'received-from-server nil) +(defvar erc-fill-column) + (defun erc-cmd-BANLIST () "Pretty-print the contents of `erc-channel-banlist'. @@ -3878,7 +3881,7 @@ The ban list is fetched from the server if necessary." (put 'erc-channel-banlist 'received-from-server nil))))) t) -(defalias 'erc-cmd-BL 'erc-cmd-BANLIST) +(defalias 'erc-cmd-BL #'erc-cmd-BANLIST) (defun erc-cmd-MASSUNBAN () "Mass Unban. @@ -3920,7 +3923,7 @@ Unban all currently banned users in the current channel." (erc-group-list bans 3)))) t)))) -(defalias 'erc-cmd-MUB 'erc-cmd-MASSUNBAN) +(defalias 'erc-cmd-MUB #'erc-cmd-MASSUNBAN) ;;;; End of IRC commands @@ -4121,7 +4124,7 @@ This places `point' just after the prompt, or at the beginning of the line." (defun erc-complete-word-at-point () (run-hook-with-args-until-success 'erc-complete-functions)) -(define-obsolete-function-alias 'erc-complete-word 'completion-at-point "24.1") +(define-obsolete-function-alias 'erc-complete-word #'completion-at-point "24.1") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; @@ -5169,7 +5172,7 @@ TOPIC string to the current topic." "Sort LIST-OF-STRINGS in lexicographic order. Side-effect free." - (sort (copy-sequence list-of-strings) 'string<)) + (sort (copy-sequence list-of-strings) #'string<)) (defun erc-parse-modes (mode-string) "Parse MODE-STRING into a list. @@ -6106,11 +6109,11 @@ non-nil value is found. ;; time routines -(define-obsolete-function-alias 'erc-string-to-emacs-time 'string-to-number +(define-obsolete-function-alias 'erc-string-to-emacs-time #'string-to-number "27.1") -(defalias 'erc-emacs-time-to-erc-time 'float-time) -(defalias 'erc-current-time 'float-time) +(defalias 'erc-emacs-time-to-erc-time #'float-time) +(defalias 'erc-current-time #'float-time) (defun erc-time-diff (t1 t2) "Return the absolute value of the difference in seconds between T1 and T2." @@ -6892,7 +6895,3 @@ Otherwise, connect to HOST:PORT as USER and /join CHANNEL." (require 'erc-goodies) ;;; erc.el ends here -;; -;; Local Variables: -;; outline-regexp: ";;+" -;; End: diff --git a/lisp/expand.el b/lisp/expand.el index 9df8d9f15ac..d11ae7c5263 100644 --- a/lisp/expand.el +++ b/lisp/expand.el @@ -1,4 +1,4 @@ -;;; expand.el --- make abbreviations more usable +;;; expand.el --- make abbreviations more usable -*- lexical-binding: t -*- ;; Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc. @@ -74,20 +74,17 @@ (defcustom expand-load-hook nil "Hooks run when `expand.el' is loaded." - :type 'hook - :group 'expand) + :type 'hook) (make-obsolete-variable 'expand-load-hook "use `with-eval-after-load' instead." "28.1") (defcustom expand-expand-hook nil "Hooks run when an abbrev made by `expand-add-abbrevs' is expanded." - :type 'hook - :group 'expand) + :type 'hook) (defcustom expand-jump-hook nil "Hooks run by `expand-jump-to-previous-slot' and `expand-jump-to-next-slot'." - :type 'hook - :group 'expand) + :type 'hook) ;;; Samples: @@ -319,8 +316,7 @@ If ARG is omitted, point is placed at the end of the expanded text." nil) (if (and (symbolp expansion) (fboundp expansion)) expansion - nil) - ) + nil)) 'expand-abbrev-hook))) (put 'expand-abbrev-hook 'no-self-insert t) @@ -368,13 +364,12 @@ See `expand-add-abbrevs'. Value is non-nil if expansion was done." (insert text) (setq expand-point (point)))) (if jump-args - (funcall 'expand-build-list (car jump-args) (cdr jump-args))) + (funcall #'expand-build-list (car jump-args) (cdr jump-args))) (if position (backward-char position)) (if hook (funcall hook)) - t) - ) + t)) (defun expand-abbrev-from-expand (word) "Test if an abbrev has a hook." @@ -428,8 +423,7 @@ This is used only in conjunction with `expand-add-abbrevs'." (lenlist (length expand-list))) (while (< i lenlist) (aset expand-list i (- len (1- (aref expand-list i)))) - (setq i (1+ i)))) - ) + (setq i (1+ i))))) (defun expand-build-marks (p) "Transform the offsets vector into a marker vector." diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 6290b02add2..2d06658b55c 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -169,6 +169,14 @@ it will remove any faces not explicitly in the list." (defalias 'facemenu-background-menu facemenu-background-menu) (put 'facemenu-background-menu 'menu-enable '(facemenu-enable-faces-p)) +(defcustom facemenu-add-face-function nil + "Function called at beginning of text to change or nil. +This function is passed the FACE to set and END of text to change, and must +return a string which is inserted. It may set `facemenu-end-add-face'." + :type '(choice (const :tag "None" nil) + function) + :group 'facemenu) + ;;; Condition for enabling menu items that set faces. (defun facemenu-enable-faces-p () ;; Enable the facemenu if facemenu-add-face-function is defined @@ -260,14 +268,6 @@ requested in `facemenu-keybindings'.") (defalias 'facemenu-keymap facemenu-keymap) -(defcustom facemenu-add-face-function nil - "Function called at beginning of text to change or nil. -This function is passed the FACE to set and END of text to change, and must -return a string which is inserted. It may set `facemenu-end-add-face'." - :type '(choice (const :tag "None" nil) - function) - :group 'facemenu) - (defcustom facemenu-end-add-face nil "String to insert or function called at end of text to change or nil. This function is passed the FACE to set, and must return a string which is @@ -291,6 +291,7 @@ May also be t meaning to use `facemenu-add-face-function'." (defvar facemenu-color-alist nil "Alist of colors, used for completion. If this is nil, then the value of (defined-colors) is used.") +(make-obsolete-variable 'facemenu-color-alist nil "28.1") (defun facemenu-update () "Add or update the \"Face\" menu in the menu bar. diff --git a/lisp/faces.el b/lisp/faces.el index 1e668a43f43..5ae3906acc2 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1917,12 +1917,11 @@ Interactively, or with optional arg MSG non-nil, print the resulting color name in the echo area." (interactive "i\np\ni\np") ; Always convert to RGB interactively. (let* ((completion-ignore-case t) - (colors (or facemenu-color-alist - (append '("foreground at point" "background at point") - (if allow-empty-name '("")) - (if (display-color-p) - (defined-colors-with-face-attributes) - (defined-colors))))) + (colors (append '("foreground at point" "background at point") + (if allow-empty-name '("")) + (if (display-color-p) + (defined-colors-with-face-attributes) + (defined-colors)))) (color (completing-read (or prompt "Color (name or #RGB triplet): ") ;; Completing function for reading colors, accepting @@ -2816,8 +2815,15 @@ Note: Other faces cannot inherit from the cursor face." :group 'help) (defface help-key-binding - '((((class color) (min-colors 88) (background light)) :background "grey90") - (((class color) (min-colors 88) (background dark)) :background "grey25") + '((((class color) (min-colors 88) (background light)) + :background "grey96" :foreground "DarkBlue" + ;; We use negative thickness of the horizontal box border line to + ;; avoid enlarging the height of the echo-area display, which + ;; would then move the mode line a few pixels up. + :box (:line-width (1 . -1) :color "grey80")) + (((class color) (min-colors 88) (background dark)) + :background "grey19" :foreground "LightBlue" + :box (:line-width (1 . -1) :color "grey35")) (((class color grayscale) (background light)) :background "grey90") (((class color grayscale) (background dark)) :background "grey25") (t :background "grey90")) diff --git a/lisp/files.el b/lisp/files.el index 99717ef2a5f..b18d4bda764 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7863,9 +7863,22 @@ Otherwise, trash FILENAME using the freedesktop.org conventions, ;; Make a .trashinfo file. Use O_EXCL, as per trash-spec 1.0. (let* ((files-base (file-name-nondirectory fn)) - (info-fn (expand-file-name + (overwrite nil) + info-fn) + ;; We're checking further down whether the info file + ;; exists, but the file name may exist in the trash + ;; directory even if there is no info file for it. + (when (file-exists-p + (expand-file-name files-base trash-files-dir)) + (setq overwrite t + files-base (file-name-nondirectory + (make-temp-file + (expand-file-name + files-base trash-files-dir))))) + (setq info-fn (expand-file-name (concat files-base ".trashinfo") - trash-info-dir))) + trash-info-dir)) + ;; Re-check the existence (sort of). (condition-case nil (write-region nil nil info-fn nil 'quiet info-fn 'excl) (file-already-exists @@ -7881,7 +7894,7 @@ Otherwise, trash FILENAME using the freedesktop.org conventions, ;; Finally, try to move the file to the trashcan. (let ((delete-by-moving-to-trash nil) (new-fn (expand-file-name files-base trash-files-dir))) - (rename-file fn new-fn))))))))) + (rename-file fn new-fn overwrite))))))))) (defsubst file-attribute-type (attributes) "The type field in ATTRIBUTES returned by `file-attributes'. diff --git a/lisp/filesets.el b/lisp/filesets.el index a51b6f81358..8e9fae80f69 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -1183,7 +1183,7 @@ Return full path if FULL-FLAG is non-nil." (constraint-flag (message "Obsolete :constraint-flag %S, use :constraintp instead" (cadr constraint-flag)) - (eval (cadr constraint-flag))) + (eval (cadr constraint-flag) t)) (t t)))) @@ -1557,18 +1557,20 @@ Replace <file-name> or <<file-name>> with filename." (completing-read "Select fileset: " filesets-data nil t)))) (when (and cmd-name name) (let* ((event (if (equal cmd-name "Grep <<selection>>") - 'on-grep + 'on-grep 'on-cmd)) (files (if (and fileset - (or (equal mode ':ingroup) - (equal mode ':tree))) + (or (equal mode :ingroup) + (equal mode :tree))) (filesets-get-filelist fileset mode event) - (filesets-get-filelist - (filesets-get-fileset-from-name name) - mode event)))) + (filesets-get-filelist + (filesets-get-fileset-from-name name) + mode event)))) (when files (let ((fn (filesets-cmd-get-fn cmd-name)) - (args (filesets-cmd-get-args cmd-name))) + (args + (dlet ((filesets--files files)) + (filesets-cmd-get-args cmd-name)))) (if (memq fn '(multi-isearch-files multi-isearch-files-regexp)) (apply fn args) (dolist (this files nil) @@ -1577,28 +1579,27 @@ Replace <file-name> or <<file-name>> with filename." (let ((buffer (filesets-find-file this))) (when buffer (goto-char (point-min)) - (progn - (cond - ((stringp fn) - (let* ((args - (mapconcat - (lambda (this) - (filesets-run-cmd--repl-fn - this - (lambda (this) - (format "%s" this)))) - args - " ")) - (cmd (concat fn " " args))) - (filesets-cmd-show-result - cmd (shell-command-to-string cmd)))) - ((symbolp fn) - (apply fn - (mapcan (lambda (this) - (filesets-run-cmd--repl-fn - this - 'list)) - args))))))))))))))))) + (cond + ((stringp fn) + (let* ((args + (mapconcat + (lambda (this) + (filesets-run-cmd--repl-fn + this + (lambda (this) + (format "%s" this)))) + args + " ")) + (cmd (concat fn " " args))) + (filesets-cmd-show-result + cmd (shell-command-to-string cmd)))) + ((symbolp fn) + (apply fn + (mapcan (lambda (this) + (filesets-run-cmd--repl-fn + this + 'list)) + args)))))))))))))))) (defun filesets-get-cmd-menu () "Create filesets command menu." @@ -1624,7 +1625,7 @@ Replace <file-name> or <<file-name>> with filename." (defun filesets-cmd-isearch-getargs () "Get arguments for `multi-isearch-files' and `multi-isearch-files-regexp'." - (and (boundp 'files) (list files))) + (and (boundp 'filesets--files) (list filesets--files))) (defun filesets-cmd-shell-command-getargs () "Get arguments for `filesets-cmd-shell-command'." diff --git a/lisp/finder.el b/lisp/finder.el index 2c3869b5089..343739f9036 100644 --- a/lisp/finder.el +++ b/lisp/finder.el @@ -1,11 +1,10 @@ -;;; finder.el --- topic & keyword-based code finder +;;; finder.el --- topic & keyword-based code finder -*- lexical-binding: t -*- ;; Copyright (C) 1992, 1997-1999, 2001-2021 Free Software Foundation, ;; Inc. ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> ;; Created: 16 Jun 1992 -;; Version: 1.0 ;; Keywords: help ;; This file is part of GNU Emacs. @@ -78,8 +77,7 @@ Each element has the form (KEYWORD . DESCRIPTION).") (defvar finder-mode-map - (let ((map (make-sparse-keymap)) - (menu-map (make-sparse-keymap "Finder"))) + (let ((map (make-sparse-keymap))) (define-key map " " 'finder-select) (define-key map "f" 'finder-select) (define-key map [follow-link] 'mouse-face) @@ -199,8 +197,7 @@ from; the default is `load-path'." (progress (make-progress-reporter (byte-compile-info "Scanning files for finder") 0 (length files))) - package-override base-name ; processed - summary keywords package version entry desc) + base-name summary keywords package version entry desc) (dolist (elem files) (let* ((d (car elem)) (f (cdr elem)) @@ -230,7 +227,7 @@ from; the default is `load-path'." ;; (push base-name processed) (with-temp-buffer (insert-file-contents (expand-file-name f d)) - (setq keywords (mapcar 'intern (lm-keywords-list)) + (setq keywords (mapcar #'intern (lm-keywords-list)) package (or package-override (let ((str (lm-header "package"))) (if str (intern str))) @@ -290,7 +287,7 @@ from; the default is `load-path'." (defun finder-compile-keywords-make-dist () "Regenerate `finder-inf.el' for the Emacs distribution." - (apply 'finder-compile-keywords command-line-args-left) + (apply #'finder-compile-keywords command-line-args-left) (kill-emacs)) ;;; Now the retrieval code @@ -299,7 +296,7 @@ from; the default is `load-path'." "Insert, at column COLUMN, other args STRINGS." (if (>= (current-column) column) (insert "\n")) (move-to-column column t) - (apply 'insert strings)) + (apply #'insert strings)) (defvar finder-help-echo nil) @@ -316,7 +313,7 @@ from; the default is `load-path'." (keys (nconc (where-is-internal 'finder-mouse-select finder-mode-map) keys1))) - (concat (mapconcat 'key-description keys ", ") + (concat (mapconcat #'key-description keys ", ") ": select item")))) (add-text-properties (line-beginning-position) (line-end-position) @@ -368,7 +365,7 @@ not `finder-known-keywords'." (define-button-type 'finder-xref 'action #'finder-goto-xref) (defun finder-goto-xref (button) - "Jump to a lisp file for the BUTTON at point." + "Jump to a Lisp file for the BUTTON at point." (let* ((file (button-get button 'xref)) (lib (locate-library file))) (if lib (finder-commentary lib) @@ -418,7 +415,7 @@ FILE should be in a form suitable for passing to `locate-library'." (defun finder-select () "Select item on current line in a Finder buffer." - (interactive) + (interactive nil finder-mode) (let ((key (finder-current-item))) (if (string-match "\\.el$" key) (finder-commentary key) @@ -426,7 +423,7 @@ FILE should be in a form suitable for passing to `locate-library'." (defun finder-mouse-select (event) "Select item in a Finder buffer with the mouse." - (interactive "e") + (interactive "e" finder-mode) (with-current-buffer (window-buffer (posn-window (event-start event))) (goto-char (posn-point (event-start event))) (finder-select))) @@ -434,6 +431,7 @@ FILE should be in a form suitable for passing to `locate-library'." ;;;###autoload (defun finder-by-keyword () "Find packages matching a given keyword." + ;; FIXME: Why does this function exist? Should it just be an alias? (interactive) (finder-list-keywords)) @@ -443,13 +441,14 @@ FILE should be in a form suitable for passing to `locate-library'." \\[finder-select] more help for the item on the current line \\[finder-exit] exit Finder mode and kill the Finder buffer." :syntax-table finder-mode-syntax-table + :interactive nil (setq buffer-read-only t buffer-undo-list t) (setq-local finder-headmark nil)) (defun finder-summary () "Summarize basic Finder commands." - (interactive) + (interactive nil finder-mode) (message "%s" (substitute-command-keys "\\<finder-mode-map>\\[finder-select] = select, \ @@ -459,7 +458,7 @@ finder directory, \\[finder-exit] = quit, \\[finder-summary] = help"))) (defun finder-exit () "Exit Finder mode. Quit the window and kill all Finder-related buffers." - (interactive) + (interactive nil finder-mode) (quit-window t) (dolist (buf (list finder-buffer "*Finder-package*")) (and (get-buffer buf) (kill-buffer buf)))) diff --git a/lisp/font-lock.el b/lisp/font-lock.el index c344a612581..82915d8c8b0 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1120,6 +1120,18 @@ portion of the buffer." (funcall font-lock-ensure-function (or beg (point-min)) (or end (point-max))))) +(defun font-lock-update (&optional arg) + "Updates the syntax highlighting in this buffer. +Refontify the accessible portion of this buffer, or enable Font Lock mode +in this buffer if it is currently disabled. With prefix ARG, toggle Font +Lock mode." + (interactive "P") + (save-excursion + (if (and (not arg) font-lock-mode) + (font-lock-fontify-region (point-min) (point-max)) + (font-lock-unfontify-region (point-min) (point-max)) + (font-lock-mode 'toggle)))) + (defun font-lock-default-fontify-buffer () "Fontify the whole buffer using `font-lock-fontify-region-function'." (let ((verbose (if (numberp font-lock-verbose) diff --git a/lisp/frame.el b/lisp/frame.el index ce4de83b8c5..b5a8e0ed72a 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2733,6 +2733,14 @@ See also `toggle-frame-maximized'." (make-obsolete-variable 'window-system-version "it does not give useful information." "24.3") +(defun set-frame-property--interactive (prompt number) + "Get a value for `set-frame-width' or `set-frame-height', prompting with PROMPT. +Offer NUMBER as default value, if it is a natural number." + (if (and current-prefix-arg (not (consp current-prefix-arg))) + (list (selected-frame) (prefix-numeric-value current-prefix-arg)) + (let ((default (and (natnump number) number))) + (list (selected-frame) (read-number prompt default))))) + ;; Variables whose change of value should trigger redisplay of the ;; current buffer. ;; To test whether a given variable needs to be added to this list, diff --git a/lisp/help-macro.el b/lisp/help-macro.el index 72371a87278..81d238305b2 100644 --- a/lisp/help-macro.el +++ b/lisp/help-macro.el @@ -1,4 +1,4 @@ -;;; help-macro.el --- makes command line help such as help-for-help +;;; help-macro.el --- makes command line help such as help-for-help -*- lexical-binding: t -*- ;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc. diff --git a/lisp/help.el b/lisp/help.el index 45194dd6859..6e94d4a0cd9 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -210,7 +210,7 @@ Do not call this in the scope of `with-help-window'." \\[describe-key] KEYS Display the full documentation for the key sequence. \\[Info-goto-emacs-key-command-node] KEYS Show the Emacs manual's section for the command bound to KEYS. \\[view-lossage] Show last 300 input keystrokes (lossage). -\\[describe-language-environment] LANG-ENV Describes a specific language environment, or RET for current. +\\[describe-language-environment] LANG-ENV Describe a specific language environment, or RET for current. \\[describe-mode] Display documentation of current minor modes and current major mode, including their special commands. \\[view-emacs-news] Display news of recent Emacs changes. diff --git a/lisp/loadup.el b/lisp/loadup.el index f65f7f1d30a..57058ac4aa1 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -254,7 +254,6 @@ (load "startup") (load "term/tty-colors") (load "font-core") -(load "facemenu") (load "emacs-lisp/syntax") (load "font-lock") (load "jit-lock") @@ -507,29 +506,6 @@ lost after dumping"))) (setq redisplay--inhibit-bidi nil) -;; Experimental feature removal. -(define-key global-map "\M-o" #'removed-facemenu-command) - -(defun removed-facemenu-command () - "Transition command during test period for facemenu removal." - (interactive) - (switch-to-buffer "*Facemenu Removal*") - (let ((inhibit-read-only t)) - (erase-buffer) - (insert-file-contents - (expand-file-name "facemenu-removal.txt" data-directory))) - (goto-char (point-min)) - (special-mode)) - -(defun facemenu-keymap-restore () - "Restore the facemenu keymap." - ;; Global bindings: - (define-key global-map [C-down-mouse-2] 'facemenu-menu) - (define-key global-map "\M-o" 'facemenu-keymap) - (define-key facemenu-keymap "\eS" 'center-paragraph) - (define-key facemenu-keymap "\es" 'center-line) - (define-key facemenu-keymap "\M-o" 'font-lock-fontify-block)) - (if dump-mode (let ((output (cond ((equal dump-mode "pdump") "emacs.pdmp") diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 2bd3ffa2910..c7960f85043 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -551,7 +551,7 @@ Examples: (defvar rmail-reply-regexp (concat "\\`\\(" rmail-re-abbrevs - "\\(([0-9]+)\\|\\[[0-9]+\\]\\|\\^[0-9]+\\)?[::] *\\)*") + "\\(([0-9]+)\\|\\[[0-9]+\\]\\|\\^[0-9]+\\)?\u00a0*[::] *\\)*") "Regexp to delete from Subject line before inserting `rmail-reply-prefix'.") (defcustom rmail-display-summary nil @@ -3356,7 +3356,7 @@ whitespace, replacing whitespace runs with a single space and removing prefixes such as Re:, Fwd: and so on and mailing list tags such as [tag]." (let ((subject (or (rmail-get-header "Subject" msgnum) "")) - (regexp "\\`[ \t\n]*\\(\\(\\w\\{1,4\\}[::]\\|\\[[^]]+]\\)[ \t\n]+\\)*")) + (regexp "\\`[ \t\n]*\\(\\(\\w\\{1,4\\}\u00a0*[::]\\|\\[[^]]+]\\)[ \t\n]+\\)*")) (setq subject (rfc2047-decode-string subject)) (setq subject (replace-regexp-in-string regexp "" subject)) (replace-regexp-in-string "[ \t\n]+" " " subject))) diff --git a/lisp/mb-depth.el b/lisp/mb-depth.el index f9a24e34bf2..88003afb409 100644 --- a/lisp/mb-depth.el +++ b/lisp/mb-depth.el @@ -30,10 +30,17 @@ ;;; Code: -(defvar minibuffer-depth-indicator-function nil - "If non-nil, function to set up the minibuffer depth indicator. -It is called with one argument, the minibuffer depth, -and must return a string.") +(defcustom minibuffer-depth-indicator-function nil + "If non-nil, a function to produce the minibuffer depth indicator. +The function will be called with one argument, the minibuffer depth, +and must return a string to display as indication of the minibuffer +depth. +If nil, display the depth as a number inside brackets, [NN], with +the `minibuffer-depth-indicator' face." + :version "28.1" + :type '(choice (const :tag "Default indicator display, [NN]" nil) + (function)) + :group 'minibuffer) (defface minibuffer-depth-indicator '((t :inherit highlight)) "Face to use for minibuffer depth indicator." diff --git a/lisp/mouse.el b/lisp/mouse.el index 8732fb80866..f4979e37b0e 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -119,7 +119,9 @@ Expects to be bound to `(double-)mouse-1' in `key-translation-map'." (time-since (cdr mouse--last-down)) (/ (abs mouse-1-click-follows-link) 1000.0)))))) (eq (car mouse--last-down) - (event-convert-list (list 'down (car-safe last-input-event)))) + (event-convert-list + `(down ,@(event-modifiers last-input-event) + ,(event-basic-type last-input-event)))) (let* ((action (mouse-on-link-p (event-start last-input-event)))) (when (and action (or mouse-1-click-in-non-selected-windows diff --git a/lisp/mwheel.el b/lisp/mwheel.el index adfeaccb29b..048f50c7728 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el @@ -411,6 +411,7 @@ an event used for scrolling, such as `mouse-wheel-down-event'." (cons (vector event) (mapcar (lambda (prefix) (vector prefix event)) prefixes))))) +;;;###autoload (define-minor-mode mouse-wheel-mode "Toggle mouse wheel support (Mouse Wheel mode)." :init-value t diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 5938b8146ef..f33cbaf1126 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -721,13 +721,14 @@ of matching words." (if (dictionary-check-reply reply 552) (progn (unless nomatching - (beep) - (insert "Word not found, maybe you are looking " - "for one of these words\n\n") - (dictionary-do-matching word - dictionary - "." - 'dictionary-display-only-match-result) + (insert "Word not found") + (dictionary-do-matching + word + dictionary + "." + (lambda (reply) + (insert ", maybe you are looking for one of these words\n\n") + (dictionary-display-only-match-result reply))) (dictionary-post-buffer))) (if (dictionary-check-reply reply 550) (error "Dictionary \"%s\" is unknown, please select an existing one" @@ -1074,7 +1075,6 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (defun dictionary-display-only-match-result (reply) "Display the results from the current matches in REPLY without the headers." - (let ((number (nth 1 (dictionary-reply-list reply))) (list (dictionary-simple-split-string (dictionary-read-answer) "\n+"))) (insert number " matching word" (if (equal number "1") "" "s") diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 6ec4d1fed38..aacf83e663f 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -44,7 +44,6 @@ :version "24.4" :type 'string) -;;;###tramp-autoload (defcustom tramp-adb-connect-if-not-connected nil "Try to run `adb connect' if provided device is not connected currently. It is used for TCP/IP devices." @@ -56,7 +55,6 @@ It is used for TCP/IP devices." (defconst tramp-adb-method "adb" "When this method name is used, forward all calls to Android Debug Bridge.") -;;;###tramp-autoload (defcustom tramp-adb-prompt "^[^#$\n\r]*[#$][[:space:]]" "Regexp used as prompt in almquist shell." :type 'regexp diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 1e48f8dbb8c..d208f0e044a 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -208,7 +208,6 @@ This includes password cache, file cache, connection cache, buffers." (dolist (name (tramp-list-remote-buffers)) (when (bufferp (get-buffer name)) (kill-buffer name)))) -;;;###tramp-autoload (defcustom tramp-default-rename-alist nil "Default target for renaming remote buffer file names. This is an alist of cons cells (SOURCE . TARGET). The first @@ -231,7 +230,6 @@ expression which always matches." :type '(repeat (cons (choice :tag "Source regexp" regexp sexp) (choice :tag "Target name" string (const nil))))) -;;;###tramp-autoload (defcustom tramp-confirm-rename-file-names t "Whether renaming a buffer file name must be confirmed." :group 'tramp diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index f8de7085e25..1d8c0ad2170 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el @@ -112,6 +112,18 @@ initializing a new crypted remote directory." "Non-nil when encryption support is available.") (setq tramp-crypt-enabled (executable-find tramp-crypt-encfs-program)) +;; This function takes action since Emacs 28.1, when +;; `read-extended-command-predicate' is set to +;; `command-completion-default-include-p'. +(defun tramp-crypt-command-completion-p (symbol _buffer) + "A predicate for Tramp interactive commands. +They are completed by \"M-x TAB\" only when encryption support is enabled." + (and tramp-crypt-enabled + ;; `tramp-crypt-remove-directory' needs to be completed only in + ;; case we have already crypted directories. + (or (not (eq symbol #'tramp-crypt-remove-directory)) + tramp-crypt-directories))) + ;;;###tramp-autoload (defconst tramp-crypt-encfs-config ".encfs6.xml" "Encfs configuration file name.") @@ -481,10 +493,17 @@ directory. File names will be also encrypted." (setq tramp-crypt-directories (cons name tramp-crypt-directories))) (tramp-register-file-name-handlers)) +;; `tramp-crypt-command-completion-p' is not autoloaded, and this +;; setting isn't either. +(function-put + #'tramp-crypt-add-directory 'completion-predicate + #'tramp-crypt-command-completion-p) + (defun tramp-crypt-remove-directory (name) "Unmark remote directory NAME for encryption. Existing files in that directory and its subdirectories will be kept in their encrypted form." + ;; (declare (completion tramp-crypt-command-completion-p)) (interactive "DRemote directory name: ") (unless tramp-crypt-enabled (tramp-user-error nil "Feature is not enabled.")) @@ -498,6 +517,11 @@ kept in their encrypted form." (setq tramp-crypt-directories (delete name tramp-crypt-directories)) (tramp-register-file-name-handlers))) +;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form. +(function-put + #'tramp-crypt-remove-directory 'completion-predicate + #'tramp-crypt-command-completion-p) + ;; `auth-source' requires a user. (defun tramp-crypt-dissect-file-name (name) "Return a `tramp-file-name' structure for NAME. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 9d4e04ca689..c4ec1121da2 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -175,7 +175,6 @@ They are checked during start up via (dbus-list-known-names :session)) (setq tramp-media-methods (delete method tramp-media-methods))))) -;;;###tramp-autoload (defcustom tramp-gvfs-zeroconf-domain "local" "Zeroconf domain to be used for discovering services, like host names." :group 'tramp diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el index 5adc4ce354a..9d4dd7d42a5 100644 --- a/lisp/net/tramp-integration.el +++ b/lisp/net/tramp-integration.el @@ -261,6 +261,23 @@ NAME must be equal to `tramp-current-connection'." (delete (info-lookup->mode-cache 'symbol ',mode) (info-lookup->topic-cache 'symbol)))))))) +;;; Integration of compile.el: + +;; Compilation processes use `accept-process-output' such a way that +;; Tramp's parallel `accept-process-output' blocks. See last part of +;; Bug#45518. So we don't use ssh ControlMaster options. +(defun tramp-compile-disable-ssh-controlmaster-options () + "Don't allow ssh ControlMaster while compiling." + (setq-local tramp-use-ssh-controlmaster-options nil)) + +(with-eval-after-load 'compile + (add-hook 'compilation-mode-hook + #'tramp-compile-disable-ssh-controlmaster-options) + (add-hook 'tramp-integration-unload-hook + (lambda () + (remove-hook 'compilation-start-hook + #'tramp-compile-disable-ssh-controlmaster-options)))) + ;;; Default connection-local variables for Tramp: ;; `connection-local-set-profile-variables' and ;; `connection-local-set-profiles' exists since Emacs 26.1. @@ -277,7 +294,7 @@ NAME must be equal to `tramp-current-connection'." (tramp-compat-funcall 'connection-local-set-profiles - `(:application tramp) + '(:application tramp) 'tramp-connection-local-default-system-profile) (defconst tramp-connection-local-default-shell-variables @@ -293,7 +310,7 @@ NAME must be equal to `tramp-current-connection'." (with-eval-after-load 'shell (tramp-compat-funcall 'connection-local-set-profiles - `(:application tramp) + '(:application tramp) 'tramp-connection-local-default-shell-profile)) (add-hook 'tramp-unload-hook diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index e6f9fe56ec0..3b6de3e0b70 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -42,7 +42,6 @@ (defconst tramp-rclone-method "rclone" "When this method name is used, forward all calls to rclone mounts.") -;;;###tramp-autoload (defcustom tramp-rclone-program "rclone" "Name of the rclone program." :group 'tramp diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 14abf55e55d..7182cd6b1d9 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -46,7 +46,6 @@ (defconst tramp-default-remote-shell "/bin/sh" "The default remote shell Tramp applies.") -;;;###tramp-autoload (defcustom tramp-inline-compress-start-size 4096 "The minimum size of compressing where inline transfer. When inline transfer, compress transferred data of file whose @@ -56,23 +55,12 @@ If it is nil, no compression at all will be applied." :group 'tramp :type '(choice (const nil) integer)) -;;;###tramp-autoload (defcustom tramp-copy-size-limit 10240 "Maximum file size where inline copying is preferred to an out-of-the-band copy. If it is nil, out-of-the-band copy will be used without a check." :group 'tramp :type '(choice (const nil) integer)) -;;;###tramp-autoload -(defcustom tramp-terminal-type "dumb" - "Value of TERM environment variable for logging in to remote host. -Because Tramp wants to parse the output of the remote shell, it is easily -confused by ANSI color escape sequences and suchlike. Often, shell init -files conditionalize this setup based on the TERM environment variable." - :group 'tramp - :type 'string) - -;;;###tramp-autoload (defcustom tramp-histfile-override "~/.tramp_history" "When invoking a shell, override the HISTFILE with this value. When setting to a string, it redirects the shell history to that @@ -115,7 +103,6 @@ detected as prompt when being sent on echoing hosts, therefore.") (defconst tramp-end-of-heredoc (md5 tramp-end-of-output) "String used to recognize end of heredoc strings.") -;;;###tramp-autoload (defcustom tramp-use-ssh-controlmaster-options t "Whether to use `tramp-ssh-controlmaster-options'. Set it to nil, if you use Control* or Proxy* options in your ssh @@ -477,70 +464,6 @@ The string is used in `tramp-methods'.") (tramp-set-completion-function "psftp" tramp-completion-function-alist-ssh) (tramp-set-completion-function "fcp" tramp-completion-function-alist-ssh)) -;; "getconf PATH" yields: -;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin -;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin -;; GNU/Linux (Debian, Suse, RHEL): /bin:/usr/bin -;; FreeBSD, DragonFly: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"! -;; FreeBSD 12.1, Darwin: /usr/bin:/bin:/usr/sbin:/sbin -;; IRIX64: /usr/bin -;; QNAP QTS: --- -;; Hydra: /run/current-system/sw/bin:/bin:/usr/bin -;;;###tramp-autoload -(defcustom tramp-remote-path - '(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" - "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" - "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" - "/opt/bin" "/opt/sbin" "/opt/local/bin") - "List of directories to search for executables on remote host. -For every remote host, this variable will be set buffer local, -keeping the list of existing directories on that host. - -You can use \"~\" in this list, but when searching for a shell which groks -tilde expansion, all directory names starting with \"~\" will be ignored. - -`Default Directories' represent the list of directories given by -the command \"getconf PATH\". It is recommended to use this -entry on head of this list, because these are the default -directories for POSIX compatible commands. On remote hosts which -do not offer the getconf command (like cygwin), the value -\"/bin:/usr/bin\" is used instead. This entry is represented in -the list by the special value `tramp-default-remote-path'. - -`Private Directories' are the settings of the $PATH environment, -as given in your `~/.profile'. This entry is represented in -the list by the special value `tramp-own-remote-path'." - :group 'tramp - :type '(repeat (choice - (const :tag "Default Directories" tramp-default-remote-path) - (const :tag "Private Directories" tramp-own-remote-path) - (string :tag "Directory")))) - -;;;###tramp-autoload -(defcustom tramp-remote-process-environment - '("ENV=''" "TMOUT=0" "LC_CTYPE=''" - "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" - "autocorrect=" "correct=") - "List of environment variables to be set on the remote host. - -Each element should be a string of the form ENVVARNAME=VALUE. An -entry ENVVARNAME= disables the corresponding environment variable, -which might have been set in the init files like ~/.profile. - -Special handling is applied to some environment variables, -which should not be set here: - -The PATH environment variable should be set via `tramp-remote-path'. - -The TERM environment variable should be set via `tramp-terminal-type'. - -The INSIDE_EMACS environment variable will automatically be set -based on the Tramp and Emacs versions, and should not be set here." - :group 'tramp - :version "26.1" - :type '(repeat string)) - -;;;###tramp-autoload (defcustom tramp-sh-extra-args '(("/bash\\'" . "-noediting -norc -noprofile") ("/zsh\\'" . "-f +Z -V")) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 69359553e44..6fbf08801e8 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -60,20 +60,17 @@ tramp-smb-method '((tramp-parse-netrc "~/.netrc")))) -;;;###tramp-autoload (defcustom tramp-smb-program "smbclient" "Name of SMB client to run." :group 'tramp :type 'string) -;;;###tramp-autoload (defcustom tramp-smb-acl-program "smbcacls" "Name of SMB acls to run." :group 'tramp :type 'string :version "24.4") -;;;###tramp-autoload (defcustom tramp-smb-conf null-device "Path of the \"smb.conf\" file. If it is nil, no \"smb.conf\" will be added to the `tramp-smb-program' @@ -81,7 +78,6 @@ call, letting the SMB client use the default one." :group 'tramp :type '(choice (const nil) (file :must-match t))) -;;;###tramp-autoload (defcustom tramp-smb-options nil "List of additional options. They are added to the `tramp-smb-program' call via \"--option '...'\". @@ -305,7 +301,6 @@ See `tramp-actions-before-shell' for more info.") Operations not mentioned here will be handled by the default Emacs primitives.") ;; Options for remote processes via winexe. -;;;###tramp-autoload (defcustom tramp-smb-winexe-program "winexe" "Name of winexe client to run. If it isn't found in the local $PATH, the absolute path of winexe @@ -314,7 +309,6 @@ shall be given. This is needed for remote processes." :type 'string :version "24.3") -;;;###tramp-autoload (defcustom tramp-smb-winexe-shell-command "powershell.exe" "Shell to be used for processes on remote machines. This must be Powershell V2 compatible." @@ -322,7 +316,6 @@ This must be Powershell V2 compatible." :type 'string :version "24.3") -;;;###tramp-autoload (defcustom tramp-smb-winexe-shell-command-switch "-file -" "Command switch used together with `tramp-smb-winexe-shell-command'. This can be used to disable echo etc." diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index ce9412c0bea..c4a36fe2a3a 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -40,7 +40,6 @@ (defconst tramp-sshfs-method "sshfs" "Tramp method for sshfs mounts.") -;;;###tramp-autoload (defcustom tramp-sshfs-program "sshfs" "The sshfs mount command." :group 'tramp @@ -276,7 +275,8 @@ arguments to pass to the OPERATION." (with-parsed-tramp-file-name filename nil (unless (and (eq flag 'nofollow) (file-symlink-p filename)) (tramp-flush-file-properties v localname) - (set-file-modes (tramp-fuse-local-file-name filename) mode flag)))) + (tramp-compat-set-file-modes + (tramp-fuse-local-file-name filename) mode flag)))) (defun tramp-sshfs-handle-write-region (start end filename &optional append visit lockname mustbenew) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index da779d3386f..8141f026f74 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -660,6 +660,14 @@ The regexp should match at end of buffer. See also `tramp-yesno-prompt-regexp'." :type 'regexp) +(defcustom tramp-terminal-type "dumb" + "Value of TERM environment variable for logging in to remote host. +Because Tramp wants to parse the output of the remote shell, it is easily +confused by ANSI color escape sequences and suchlike. Often, shell init +files conditionalize this setup based on the TERM environment variable." + :group 'tramp + :type 'string) + (defcustom tramp-terminal-prompt-regexp (concat "\\(" "TERM = (.*)" @@ -1243,6 +1251,67 @@ let-bind this variable." :version "24.4" :type '(choice (const nil) integer)) +;; "getconf PATH" yields: +;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin +;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin +;; GNU/Linux (Debian, Suse, RHEL): /bin:/usr/bin +;; FreeBSD, DragonFly: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"! +;; FreeBSD 12.1, Darwin: /usr/bin:/bin:/usr/sbin:/sbin +;; IRIX64: /usr/bin +;; QNAP QTS: --- +;; Hydra: /run/current-system/sw/bin:/bin:/usr/bin +(defcustom tramp-remote-path + '(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" + "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" + "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" + "/opt/bin" "/opt/sbin" "/opt/local/bin") + "List of directories to search for executables on remote host. +For every remote host, this variable will be set buffer local, +keeping the list of existing directories on that host. + +You can use \"~\" in this list, but when searching for a shell which groks +tilde expansion, all directory names starting with \"~\" will be ignored. + +`Default Directories' represent the list of directories given by +the command \"getconf PATH\". It is recommended to use this +entry on head of this list, because these are the default +directories for POSIX compatible commands. On remote hosts which +do not offer the getconf command (like cygwin), the value +\"/bin:/usr/bin\" is used instead. This entry is represented in +the list by the special value `tramp-default-remote-path'. + +`Private Directories' are the settings of the $PATH environment, +as given in your `~/.profile'. This entry is represented in +the list by the special value `tramp-own-remote-path'." + :group 'tramp + :type '(repeat (choice + (const :tag "Default Directories" tramp-default-remote-path) + (const :tag "Private Directories" tramp-own-remote-path) + (string :tag "Directory")))) + +(defcustom tramp-remote-process-environment + '("ENV=''" "TMOUT=0" "LC_CTYPE=''" + "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" + "autocorrect=" "correct=") + "List of environment variables to be set on the remote host. + +Each element should be a string of the form ENVVARNAME=VALUE. An +entry ENVVARNAME= disables the corresponding environment variable, +which might have been set in the init files like ~/.profile. + +Special handling is applied to some environment variables, +which should not be set here: + +The PATH environment variable should be set via `tramp-remote-path'. + +The TERM environment variable should be set via `tramp-terminal-type'. + +The INSIDE_EMACS environment variable will automatically be set +based on the Tramp and Emacs versions, and should not be set here." + :group 'tramp + :version "26.1" + :type '(repeat string)) + (defcustom tramp-completion-reread-directory-timeout 10 "Defines seconds since last remote command before rereading a directory. A remote directory might have changed its contents. In order to diff --git a/lisp/newcomment.el b/lisp/newcomment.el index ea47eec4fda..a5bfb067954 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -1300,7 +1300,11 @@ out." (let ((s (comment-padleft comment-end numarg))) (and s (if (string-match comment-end-skip s) s (comment-padright comment-end)))) - (if multi (comment-padright comment-continue numarg)) + (if multi + (or (comment-padright comment-continue numarg) + ;; `comment-padright' returns nil when + ;; `comment-continue' contains only whitespace + (and (stringp comment-continue) comment-continue))) (if multi (comment-padleft (comment-string-reverse comment-continue) numarg)) block diff --git a/lisp/obsolete/inversion.el b/lisp/obsolete/inversion.el index 192186ee3b2..e61b36cd88b 100644 --- a/lisp/obsolete/inversion.el +++ b/lisp/obsolete/inversion.el @@ -1,6 +1,6 @@ ;;; inversion.el --- When you need something in version XX.XX -*- lexical-binding: t; -*- -;;; Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc. +;; Copyright (C) 2002-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Version: 1.3 diff --git a/lisp/outline.el b/lisp/outline.el index b4d37b2207f..79029a6e5e7 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -207,9 +207,10 @@ in the file it applies to.") (list 'face nil 'keymap outline-mode-cycle-map))) (outline-font-lock-face)) - (when (and outline-minor-mode - (eq outline-minor-mode-highlight 'override)) - 'append) + (when outline-minor-mode + (pcase outline-minor-mode-highlight + ('override t) + ('append 'append))) t))) "Additional expressions to highlight in Outline mode.") @@ -340,10 +341,12 @@ Typing these keys anywhere outside heading lines uses their default bindings." Non-nil value works well only when outline font-lock keywords don't conflict with the major mode's font-lock keywords. When t, it puts outline faces only if there are no major mode's faces -on headings. When `override', it tries to append outline faces -to major mode's faces." +on headings. When `override', it completely overwrites major mode's +faces with outline faces. When `append', it tries to append outline +faces to major mode's faces." :type '(choice (const :tag "No highlighting" nil) - (const :tag "Append to major mode faces" override) + (const :tag "Overwrite major mode faces" override) + (const :tag "Append outline faces to major mode faces" append) (const :tag "Highlight separately from major mode faces" t)) :version "28.1") ;;;###autoload(put 'outline-minor-mode-highlight 'safe-local-variable 'booleanp) @@ -359,6 +362,7 @@ to major mode's faces." (overlay-put overlay 'outline-overlay t) (when (or (eq outline-minor-mode-highlight 'override) (and (eq outline-minor-mode-highlight t) + (goto-char (match-beginning 0)) (not (get-text-property (point) 'face)))) (overlay-put overlay 'face (outline-font-lock-face))) (when outline-minor-mode-cycle diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 48b5ee99736..d23c77ef860 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -3040,12 +3040,7 @@ TRUE-DIRNAME is the `file-truename' of DIRNAME, if given." ;; Get the specified directory from FILE. (spec-directory (if (cdr file) - ;; This function is active in `compilation-filter'. - ;; There could be problems to call `file-truename' - ;; for remote compilation processes. - (if (file-remote-p default-directory) - (concat comint-file-name-prefix (cdr file)) - (file-truename (concat comint-file-name-prefix (cdr file))))))) + (file-truename (concat comint-file-name-prefix (cdr file)))))) ;; Check for a comint-file-name-prefix and prepend it if appropriate. ;; (This is very useful for compilation-minor-mode in an rlogin-mode diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 734797b3ad2..7612f8d284a 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -92,6 +92,7 @@ (concat msg ": "))))) (eval-when-compile (require 'cl-lib)) +(require 'facemenu) (defvar msb-menu-cond) (defvar gud-perldb-history) @@ -3926,21 +3927,24 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', bb (char-after (1- (match-beginning b1))) ; tmp holder ;; bb == "Not a stringy" bb (if (eq b1 10) ; user variables/whatever - (and (memq bb (append "$@%*#_:-&>" nil)) ; $#y) - (cond ((eq bb ?-) (eq c ?s)) ; -s file test - ((eq bb ?\:) ; $opt::s - (eq (char-after - (- (match-beginning b1) 2)) - ?\:)) - ((eq bb ?\>) ; $foo->s - (eq (char-after - (- (match-beginning b1) 2)) - ?\-)) - ((eq bb ?\&) - (not (eq (char-after ; &&m/blah/ - (- (match-beginning b1) 2)) - ?\&))) - (t t))) + (or + ; false positive: "y_" has no word boundary + (save-match-data (looking-at "_")) + (and (memq bb (append "$@%*#_:-&>" nil)) ; $#y) + (cond ((eq bb ?-) (eq c ?s)) ; -s file test + ((eq bb ?\:) ; $opt::s + (eq (char-after + (- (match-beginning b1) 2)) + ?\:)) + ((eq bb ?\>) ; $foo->s + (eq (char-after + (- (match-beginning b1) 2)) + ?\-)) + ((eq bb ?\&) + (not (eq (char-after ; &&m/blah/ + (- (match-beginning b1) 2)) + ?\&))) + (t t)))) ;; <file> or <$file> (and (eq c ?\<) ;; Do not stringify <FH>, <$fh> : diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 18da4398f46..bd552c917ac 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -208,13 +208,19 @@ of the project instance object." (defun project--find-in-directory (dir) (run-hook-with-args-until-success 'project-find-functions dir)) +(defvar project--within-roots-fallback nil) + (cl-defgeneric project-root (project) "Return root directory of the current project. It usually contains the main build file, dependencies configuration file, etc. Though neither is mandatory. -The directory name must be absolute." +The directory name must be absolute.") + +(cl-defmethod project-root (project + &context (project--within-roots-fallback + (eql nil))) (car (project-roots project))) (cl-defgeneric project-roots (project) @@ -226,7 +232,8 @@ and the rest should be possible to express through ;; FIXME: Can we specify project's version here? ;; FIXME: Could we make this affect cl-defmethod calls too? (declare (obsolete project-root "0.3.0")) - (list (project-root project))) + (let ((project--within-roots-fallback t)) + (list (project-root project)))) ;; FIXME: Add MODE argument, like in `ede-source-paths'? (cl-defgeneric project-external-roots (_project) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index c066d9dc024..ea52befec57 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -609,16 +609,26 @@ SELECT is `quit', also quit the *xref* window." (when xref (xref--show-location (xref-item-location xref))))) +(defun xref-next-line-no-show () + "Move to the next xref but don't display its source." + (interactive) + (xref--search-property 'xref-item)) + (defun xref-next-line () "Move to the next xref and display its source in the appropriate window." (interactive) - (xref--search-property 'xref-item) + (xref-next-line-no-show) (xref-show-location-at-point)) +(defun xref-prev-line-no-show () + "Move to the previous xref but don't display its source." + (interactive) + (xref--search-property 'xref-item t)) + (defun xref-prev-line () "Move to the previous xref and display its source in the appropriate window." (interactive) - (xref--search-property 'xref-item t) + (xref-prev-line-no-show) (xref-show-location-at-point)) (defun xref-next-group () diff --git a/lisp/simple.el b/lisp/simple.el index 98fccf4ff23..eeef40f3840 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -238,15 +238,6 @@ all other buffers." :group 'next-error :version "28.1") -(defcustom next-error-found-function #'ignore - "Function called when a next locus is found and displayed. -Function is called with two arguments: a FROM-BUFFER buffer -from which next-error navigated, and a target buffer TO-BUFFER." - :type '(choice (const :tag "No default" ignore) - (function :tag "Other function")) - :group 'next-error - :version "27.1") - (defun next-error-buffer-on-selected-frame (&optional _avoid-current extra-test-inclusive extra-test-exclusive) @@ -386,6 +377,26 @@ To control which errors are matched, customize the variable (not (eq prev next-error-last-buffer))) (message "Current locus from %s" next-error-last-buffer))))) +(defun next-error-quit-window (from-buffer to-buffer) + "Quit window of FROM-BUFFER when the prefix arg is 0. +Intended to be used in `next-error-found-function'." + (when (and (eq current-prefix-arg 0) from-buffer + (not (eq from-buffer to-buffer))) + (let ((window (get-buffer-window from-buffer))) + (when (window-live-p window) + (quit-restore-window window))))) + +(defcustom next-error-found-function #'ignore + "Function called when a next locus is found and displayed. +Function is called with two arguments: a FROM-BUFFER buffer +from which next-error navigated, and a target buffer TO-BUFFER." + :type '(choice (const :tag "No default" ignore) + (const :tag "Quit previous window with M-0" + next-error-quit-window) + (function :tag "Other function")) + :group 'next-error + :version "27.1") + (defun next-error-found (&optional from-buffer to-buffer) "Function to call when the next locus is found and displayed. FROM-BUFFER is a buffer from which next-error navigated, diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 6c4c8eb8132..12e57b11082 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -2159,10 +2159,13 @@ passes some tests." ;; way by displaying the range over which we ;; have grouped them. (setq work-list - (cons (cons (concat short-start-name - " to " - short-end-name) - short-group-list) + (cons (cons + (concat short-start-name + " to " short-end-name) + (sort (copy-sequence short-group-list) + (lambda (e1 e2) + (string< (car e1) + (car e2))))) work-list)))) ;; Reset short group list information every time. (setq short-group-list nil diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 29465aae63f..45ed2a6b314 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -72,6 +72,24 @@ :version "27.1" :group 'tab-bar-faces) +(defface tab-bar-tab-group-current + '((t :inherit tab-bar-tab :box nil :weight bold)) + "Tab bar face for current group tab." + :version "28.1" + :group 'tab-bar-faces) + +(defface tab-bar-tab-group-inactive + '((t :inherit (shadow tab-bar-tab-inactive))) + "Tab bar face for inactive group tab." + :version "28.1" + :group 'tab-bar-faces) + +(defface tab-bar-tab-ungrouped + '((t :inherit (shadow tab-bar-tab-inactive))) + "Tab bar face for ungrouped tab when tab groups are used." + :version "28.1" + :group 'tab-bar-faces) + (defcustom tab-bar-select-tab-modifiers '() "List of modifier keys for selecting a tab by its index digit. @@ -327,6 +345,20 @@ before calling the command that adds a new tab." :group 'tab-bar :version "27.1") +(defcustom tab-bar-new-tab-group nil + "Defines what group to assign to a new tab. +If nil, don't set a default group automatically. +If t, inherit the group name from the previous tab. +If the value is a string, use it as the group name of a new tab. +If the value is a function, call it with no arguments +to get the group name." + :type '(choice (const :tag "No automatic group" nil) + (const :tag "Inherit group from previous tab" t) + (string :tag "Fixed group name") + (function :tag "Function that returns group name")) + :group 'tab-bar + :version "28.1") + (defcustom tab-bar-new-button-show t "If non-nil, show the \"New tab\" button in the tab bar. When this is nil, you can create new tabs with \\[tab-new]." @@ -475,13 +507,13 @@ For example, \\='((tab (name . \"Tab 1\")) (current-tab (name . \"Tab 2\"))) By default, use function `tab-bar-tabs'.") (defun tab-bar-tabs (&optional frame) - "Return a list of tabs belonging to the selected frame. + "Return a list of tabs belonging to the FRAME. Ensure the frame parameter `tabs' is pre-populated. Update the current tab name when it exists. Return its existing value or a new value." (let ((tabs (frame-parameter frame 'tabs))) (if tabs - (let* ((current-tab (assq 'current-tab tabs)) + (let* ((current-tab (tab-bar--current-tab-find tabs)) (current-tab-name (assq 'name current-tab)) (current-tab-explicit-name (assq 'explicit-name current-tab))) (when (and current-tab-name @@ -491,10 +523,24 @@ Return its existing value or a new value." (funcall tab-bar-tab-name-function)))) ;; Create default tabs (setq tabs (list (tab-bar--current-tab))) - (set-frame-parameter frame 'tabs tabs)) + (tab-bar-tabs-set tabs frame)) tabs)) +(defun tab-bar-tabs-set (tabs &optional frame) + "Set a list of TABS on the FRAME." + (set-frame-parameter frame 'tabs tabs)) + +(defcustom tab-bar-tab-face-function #'tab-bar-tab-face-default + "Function to define a tab face. +Function gets one argument: a tab." + :type 'function + :group 'tab-bar + :version "28.1") + +(defun tab-bar-tab-face-default (tab) + (if (eq (car tab) 'current-tab) 'tab-bar-tab 'tab-bar-tab-inactive)) + (defcustom tab-bar-tab-name-format-function #'tab-bar-tab-name-format-default "Function to format a tab name. Function gets two arguments, the tab and its number, and should return @@ -517,12 +563,12 @@ the formatted tab name to display in the tab bar." (if current-p 'non-selected 'selected))) tab-bar-close-button) "")) - 'face (if current-p 'tab-bar-tab 'tab-bar-tab-inactive)))) + 'face (funcall tab-bar-tab-face-function tab)))) -(defvar tab-bar-format '(tab-bar-format-history - tab-bar-format-tabs - tab-bar-separator - tab-bar-format-add-tab) +(defcustom tab-bar-format '(tab-bar-format-history + tab-bar-format-tabs + tab-bar-separator + tab-bar-format-add-tab) "Template for displaying tab bar items. Every item in the list is a function that returns a string, or a list of menu-item elements, or nil. @@ -530,7 +576,22 @@ When you add more items `tab-bar-format-align-right' and `tab-bar-format-global' to the end, then after enabling `display-time-mode' (or any other mode that uses `global-mode-string') it will display time aligned to the right on the tab bar instead of -the mode line.") +the mode line. Replacing `tab-bar-format-tabs' with +`tab-bar-format-tabs-groups' will group tabs on the tab bar." + :type 'hook + :options '(tab-bar-format-history + tab-bar-format-tabs + tab-bar-format-tabs-groups + tab-bar-separator + tab-bar-format-add-tab + tab-bar-format-align-right + tab-bar-format-global) + :initialize 'custom-initialize-default + :set (lambda (sym val) + (set-default sym val) + (force-mode-line-update)) + :group 'tab-bar + :version "28.1") (defun tab-bar-format-history () (when (and tab-bar-history-mode tab-bar-history-buttons-show) @@ -543,39 +604,130 @@ the mode line.") menu-item ,tab-bar-forward-button tab-bar-history-forward :help "Click to go forward in tab history")))) +(defun tab-bar--format-tab (tab i) + (append + `((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore)) + (cond + ((eq (car tab) 'current-tab) + `((current-tab + menu-item + ,(funcall tab-bar-tab-name-format-function tab i) + ignore + :help "Current tab"))) + (t + `((,(intern (format "tab-%i" i)) + menu-item + ,(funcall tab-bar-tab-name-format-function tab i) + ,(or + (alist-get 'binding tab) + `(lambda () + (interactive) + (tab-bar-select-tab ,i))) + :help "Click to visit tab")))) + `((,(if (eq (car tab) 'current-tab) 'C-current-tab (intern (format "C-tab-%i" i))) + menu-item "" + ,(or + (alist-get 'close-binding tab) + `(lambda () + (interactive) + (tab-bar-close-tab ,i))))))) + (defun tab-bar-format-tabs () - (let ((separator (tab-bar-separator)) - (tabs (funcall tab-bar-tabs-function)) - (i 0)) + (let ((i 0)) (mapcan (lambda (tab) (setq i (1+ i)) - (append - `((,(intern (format "sep-%i" i)) menu-item ,separator ignore)) - (cond - ((eq (car tab) 'current-tab) - `((current-tab - menu-item - ,(funcall tab-bar-tab-name-format-function tab i) - ignore - :help "Current tab"))) - (t - `((,(intern (format "tab-%i" i)) - menu-item - ,(funcall tab-bar-tab-name-format-function tab i) - ,(or - (alist-get 'binding tab) - `(lambda () - (interactive) - (tab-bar-select-tab ,i))) - :help "Click to visit tab")))) - `((,(if (eq (car tab) 'current-tab) 'C-current-tab (intern (format "C-tab-%i" i))) - menu-item "" - ,(or - (alist-get 'close-binding tab) - `(lambda () - (interactive) - (tab-bar-close-tab ,i))))))) + (tab-bar--format-tab tab i)) + (funcall tab-bar-tabs-function)))) + +(defcustom tab-bar-tab-group-function #'tab-bar-tab-group-default + "Function to get a tab group name. +Function gets one argument: a tab." + :type 'function + :initialize 'custom-initialize-default + :set (lambda (sym val) + (set-default sym val) + (force-mode-line-update)) + :group 'tab-bar + :version "28.1") + +(defun tab-bar-tab-group-default (tab) + (alist-get 'group tab)) + +(defcustom tab-bar-tab-group-format-function #'tab-bar-tab-group-format-default + "Function to format a tab group name. +Function gets two arguments, a tab with a group name and its number, +and should return the formatted tab group name to display in the tab bar." + :type 'function + :initialize 'custom-initialize-default + :set (lambda (sym val) + (set-default sym val) + (force-mode-line-update)) + :group 'tab-bar + :version "28.1") + +(defun tab-bar-tab-group-format-default (tab i) + (propertize + (concat (if tab-bar-tab-hints (format "%d " i) "") + (funcall tab-bar-tab-group-function tab)) + 'face 'tab-bar-tab-group-inactive)) + +(defcustom tab-bar-tab-group-face-function #'tab-bar-tab-group-face-default + "Function to define a tab group face. +Function gets one argument: a tab." + :type 'function + :group 'tab-bar + :version "28.1") + +(defun tab-bar-tab-group-face-default (tab) + (if (not (or (eq (car tab) 'current-tab) + (funcall tab-bar-tab-group-function tab))) + 'tab-bar-tab-ungrouped + (tab-bar-tab-face-default tab))) + +(defun tab-bar--format-tab-group (tab i &optional current-p) + (append + `((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore)) + `((,(intern (format "group-%i" i)) + menu-item + ,(if current-p + (propertize (funcall tab-bar-tab-group-function tab) + 'face 'tab-bar-tab-group-current) + (funcall tab-bar-tab-group-format-function tab i)) + ,(if current-p 'ignore + (or + (alist-get 'binding tab) + `(lambda () + (interactive) + (tab-bar-select-tab ,i)))) + :help "Click to visit group")))) + +(defun tab-bar-format-tabs-groups () + (let* ((tabs (funcall tab-bar-tabs-function)) + (current-group (funcall tab-bar-tab-group-function + (tab-bar--current-tab-find tabs))) + (previous-group nil) + (i 0)) + (mapcan + (lambda (tab) + (let ((tab-group (funcall tab-bar-tab-group-function tab))) + (setq i (1+ i)) + (prog1 (cond + ;; Show current group tabs and ungrouped tabs + ((or (equal tab-group current-group) (not tab-group)) + (append + ;; Prepend current group name before first tab + (when (and (not (equal previous-group tab-group)) tab-group) + (tab-bar--format-tab-group tab i t)) + ;; Override default tab faces to use group faces + (let ((tab-bar-tab-face-function tab-bar-tab-group-face-function)) + (tab-bar--format-tab tab i)))) + ;; Show first tab of other groups with a group name + ((not (equal previous-group tab-group)) + (tab-bar--format-tab-group tab i)) + ;; Hide other group tabs + (t nil)) + (setq previous-group tab-group)))) tabs))) (defun tab-bar-format-add-tab () @@ -590,7 +742,7 @@ the mode line.") (rest (mapconcat (lambda (item) (nth 2 item)) rest "")) (hpos (length rest)) (str (propertize " " 'display `(space :align-to (- right ,hpos))))) - `((tab-bar-format-align-right menu-item ,str ignore)))) + `((align-right menu-item ,str ignore)))) (defun tab-bar-format-global () "Format `global-mode-string' to display it in the tab bar. @@ -599,10 +751,7 @@ When `tab-bar-format-global' is added to `tab-bar-format' then modes that display information on the mode line using `global-mode-string' will display the same text on the tab bar instead." - `((tab-bar-format-global - menu-item - ,(format-mode-line global-mode-string) - ignore))) + `((global menu-item ,(format-mode-line global-mode-string) ignore))) (defun tab-bar-format-list (format-list) (let ((i 0)) @@ -646,7 +795,7 @@ on the tab bar instead." (push '(tabs . frameset-filter-tabs) frameset-filter-alist) (defun tab-bar--tab (&optional frame) - (let* ((tab (assq 'current-tab (frame-parameter frame 'tabs))) + (let* ((tab (tab-bar--current-tab-find)) (tab-explicit-name (alist-get 'explicit-name tab)) (tab-group (alist-get 'group tab)) (bl (seq-filter #'buffer-live-p (frame-parameter frame 'buffer-list))) @@ -667,13 +816,16 @@ on the tab bar instead." (wc-history-back . ,(gethash (or frame (selected-frame)) tab-bar-history-back)) (wc-history-forward . ,(gethash (or frame (selected-frame)) tab-bar-history-forward))))) -(defun tab-bar--current-tab (&optional tab frame) +(defun tab-bar--current-tab (&optional tab) ;; `tab' here is an argument meaning "use tab as template". This is ;; necessary when switching tabs, otherwise the destination tab ;; inherits the current tab's `explicit-name' parameter. - (let* ((tab (or tab (assq 'current-tab (frame-parameter frame 'tabs)))) - (tab-explicit-name (alist-get 'explicit-name tab)) - (tab-group (alist-get 'group tab))) + (let* ((tab-explicit-name (alist-get 'explicit-name tab)) + (tab-group (if tab + (alist-get 'group tab) + (pcase tab-bar-new-tab-group + ((pred stringp) tab-bar-new-tab-group) + ((pred functionp) (funcall tab-bar-new-tab-group)))))) `(current-tab (name . ,(if tab-explicit-name (alist-get 'name tab) @@ -682,8 +834,7 @@ on the tab bar instead." ,@(if tab-group `((group . ,tab-group)))))) (defun tab-bar--current-tab-find (&optional tabs frame) - (seq-find (lambda (tab) (eq (car tab) 'current-tab)) - (or tabs (funcall tab-bar-tabs-function frame)))) + (assq 'current-tab (or tabs (funcall tab-bar-tabs-function frame)))) (defun tab-bar--current-tab-index (&optional tabs frame) (seq-position (or tabs (funcall tab-bar-tabs-function frame)) @@ -716,7 +867,7 @@ on the tab bar instead." When this command is bound to a numeric key (with a prefix or modifier key using `tab-bar-select-tab-modifiers'), calling it without an argument will translate its bound numeric key to the numeric argument. -ARG counts from 1." +ARG counts from 1. Negative ARG counts tabs from the end of the tab bar." (interactive "P") (unless (integerp arg) (let ((key (event-basic-type last-command-event))) @@ -726,7 +877,9 @@ ARG counts from 1." (let* ((tabs (funcall tab-bar-tabs-function)) (from-index (tab-bar--current-tab-index tabs)) - (to-index (1- (max 1 (min arg (length tabs)))))) + (to-index (if (< arg 0) (+ (length tabs) (1+ arg)) arg)) + (to-index (1- (max 1 (min to-index (length tabs)))))) + (unless (eq from-index to-index) (let* ((from-tab (tab-bar--tab)) (to-tab (nth to-index tabs)) @@ -854,7 +1007,7 @@ where argument addressing is relative." (to-index (max 0 (min (1- to-index) (1- (length tabs)))))) (setq tabs (delq from-tab tabs)) (cl-pushnew from-tab (nthcdr to-index tabs)) - (set-frame-parameter nil 'tabs tabs) + (tab-bar-tabs-set tabs) (force-mode-line-update))) (defun tab-bar-move-tab (&optional arg) @@ -896,7 +1049,7 @@ Interactively, ARG selects the ARGth different frame to move to." (let ((inhibit-message t) ; avoid message about deleted tab tab-bar-closed-tabs) (tab-bar-close-tab from-index))) - (set-frame-parameter to-frame 'tabs to-tabs) + (tab-bar-tabs-set to-tabs to-frame) (force-mode-line-update t)))) @@ -957,7 +1110,10 @@ After the tab is created, the hooks in (when from-index (setf (nth from-index tabs) from-tab)) - (let* ((to-tab (tab-bar--current-tab)) + + (let* ((to-tab (tab-bar--current-tab + (when (eq tab-bar-new-tab-group t) + `((group . ,(alist-get 'group from-tab)))))) (to-index (and to-index (prefix-numeric-value to-index))) (to-index (or (if to-index (if (< to-index 0) @@ -975,7 +1131,7 @@ After the tab is created, the hooks in (when (eq to-index 0) ;; `pushnew' handles the head of tabs but not frame-parameter - (set-frame-parameter nil 'tabs tabs)) + (tab-bar-tabs-set tabs)) (run-hook-with-args 'tab-bar-tab-post-open-functions (nth to-index tabs))) @@ -1012,7 +1168,8 @@ where argument addressing is absolute." If a negative ARG, duplicate the tab to ARG positions to the left. If ARG is zero, duplicate the tab in place of the current tab." (interactive "P") - (let ((tab-bar-new-tab-choice nil)) + (let ((tab-bar-new-tab-choice nil) + (tab-bar-new-tab-group t)) (tab-bar-new-tab arg))) @@ -1130,7 +1287,7 @@ for the last tab on a frame is determined by (tab-bar--tab) close-tab))) tab-bar-closed-tabs) - (set-frame-parameter nil 'tabs (delq close-tab tabs))) + (tab-bar-tabs-set (delq close-tab tabs))) ;; Recalculate `tab-bar-lines' and update frames (tab-bar--update-tab-bar-lines) @@ -1169,7 +1326,7 @@ for the last tab on a frame is determined by (run-hook-with-args 'tab-bar-tab-pre-close-functions tab nil) (setq tabs (delq tab tabs))) (setq index (1+ index))) - (set-frame-parameter nil 'tabs tabs) + (tab-bar-tabs-set tabs) ;; Recalculate tab-bar-lines and update frames (tab-bar--update-tab-bar-lines) @@ -1199,7 +1356,7 @@ for the last tab on a frame is determined by (cl-pushnew tab (nthcdr index tabs)) (when (eq index 0) ;; pushnew handles the head of tabs but not frame-parameter - (set-frame-parameter nil 'tabs tabs)) + (tab-bar-tabs-set tabs)) (tab-bar-select-tab (1+ index)))) (message "No more closed tabs to undo"))) @@ -1256,17 +1413,23 @@ function `tab-bar-tab-name-function'." "Add the tab specified by its absolute position ARG to GROUP-NAME. If no ARG is specified, then set the GROUP-NAME for the current tab. ARG counts from 1. -If GROUP-NAME is the empty string, then remove the tab from any group." +If GROUP-NAME is the empty string, then remove the tab from any group. +While using this command, you might also want to replace +`tab-bar-format-tabs' with `tab-bar-format-tabs-groups' in +`tab-bar-format' to group tabs on the tab bar." (interactive (let* ((tabs (funcall tab-bar-tabs-function)) - (tab-index (or current-prefix-arg (1+ (tab-bar--current-tab-index tabs)))) - (group-name (alist-get 'group (nth (1- tab-index) tabs)))) + (tab-index (or current-prefix-arg + (1+ (tab-bar--current-tab-index tabs)))) + (group-name (funcall tab-bar-tab-group-function + (nth (1- tab-index) tabs)))) (list (completing-read "Group name for tab (leave blank to remove group): " - (delete-dups (delq nil (cons group-name - (mapcar (lambda (tab) - (alist-get 'group tab)) - (funcall tab-bar-tabs-function)))))) + (delete-dups + (delq nil (cons group-name + (mapcar (lambda (tab) + (funcall tab-bar-tab-group-function tab)) + (funcall tab-bar-tabs-function)))))) current-prefix-arg))) (let* ((tabs (funcall tab-bar-tabs-function)) (tab-index (if arg @@ -1286,26 +1449,27 @@ If GROUP-NAME is the empty string, then remove the tab from any group." (defun tab-bar-close-group-tabs (group-name) "Close all tabs that belong to GROUP-NAME on the selected frame." (interactive - (let* ((tabs (funcall tab-bar-tabs-function)) - (group-name (alist-get 'group (tab-bar--current-tab-find tabs)))) + (let ((group-name (funcall tab-bar-tab-group-function + (tab-bar--current-tab-find)))) (list (completing-read "Close all tabs with group name: " - (delete-dups (delq nil (cons group-name - (mapcar (lambda (tab) - (alist-get 'group tab)) - (funcall tab-bar-tabs-function))))))))) + (delete-dups + (delq nil (cons group-name + (mapcar (lambda (tab) + (funcall tab-bar-tab-group-function tab)) + (funcall tab-bar-tabs-function))))))))) (let* ((close-group (and (> (length group-name) 0) group-name)) (tab-bar-tab-prevent-close-functions (cons (lambda (tab _last-tab-p) - (not (equal (alist-get 'group tab) close-group))) + (not (equal (funcall tab-bar-tab-group-function tab) + close-group))) tab-bar-tab-prevent-close-functions))) (tab-bar-close-other-tabs) - (let* ((tabs (funcall tab-bar-tabs-function)) - (current-tab (tab-bar--current-tab-find tabs))) - (when (and current-tab (equal (alist-get 'group current-tab) - close-group)) - (tab-bar-close-tab))))) + (when (equal (funcall tab-bar-tab-group-function + (tab-bar--current-tab-find)) + close-group) + (tab-bar-close-tab)))) ;;; Tab history mode @@ -1594,7 +1758,7 @@ Then move up one line. Prefix arg means move that many lines." (index . ,(tab-bar--tab-index tab)) (tab . ,tab)) tab-bar-closed-tabs) - (set-frame-parameter nil 'tabs (delq tab (funcall tab-bar-tabs-function)))) + (tab-bar-tabs-set (delq tab (funcall tab-bar-tabs-function)))) (defun tab-switcher-execute () "Delete window configurations marked with \\<tab-switcher-mode-map>\\[tab-switcher-delete] commands." diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 903862a3e83..0d97da8ca71 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -44,6 +44,7 @@ whether the tab is a buffer, and whether the tab is selected." :type '(repeat (choice (function-item tab-line-tab-face-special) (function-item tab-line-tab-face-inactive-alternating) + (function-item tab-line-tab-face-group) (function :tag "Custom function"))) :group 'tab-line :version "28.1") @@ -55,29 +56,25 @@ whether the tab is a buffer, and whether the tab is selected." :version "27.1") (defface tab-line-tab - '((default - :inherit tab-line) + '((default :inherit tab-line) (((class color) (min-colors 88)) :box (:line-width 1 :style released-button)) - (t - :inverse-video nil)) + (t :inverse-video nil)) "Tab line face for selected tab." :version "27.1" :group 'tab-line-faces) (defface tab-line-tab-inactive - '((default - :inherit tab-line-tab) + '((default :inherit tab-line-tab) (((class color) (min-colors 88)) :background "grey75") - (t - :inverse-video t)) + (t :inverse-video t)) "Tab line face for non-selected tab." :version "27.1" :group 'tab-line-faces) (defface tab-line-tab-inactive-alternate - `((t (:inherit tab-line-tab-inactive :background "grey65"))) + '((t :inherit tab-line-tab-inactive :background "grey65")) "Alternate face for inactive tab-line tabs. Applied to alternating tabs when option `tab-line-tab-face-functions' includes function @@ -86,18 +83,25 @@ Applied to alternating tabs when option :group 'tab-line-faces) (defface tab-line-tab-special - '((default (:weight bold)) + '((default :weight bold) (((supports :slant italic)) - (:slant italic :weight normal))) + :slant italic :weight normal)) "Face for special (i.e. non-file-backed) tabs. Applied when option `tab-line-tab-face-functions' includes function `tab-line-tab-face-special'." :version "28.1" :group 'tab-line-faces) +(defface tab-line-tab-group + '((t :inherit tab-line :box nil)) + "Face for group tabs. +Applied when option `tab-line-tab-face-functions' includes +function `tab-line-tab-face-group'." + :version "28.1" + :group 'tab-line-faces) + (defface tab-line-tab-current - '((default - :inherit tab-line-tab) + '((default :inherit tab-line-tab) (((class color) (min-colors 88)) :background "grey85")) "Tab line face for tab with current buffer in selected window." @@ -105,7 +109,7 @@ function `tab-line-tab-face-special'." :group 'tab-line-faces) (defface tab-line-highlight - '((default :inherit tab-line-tab)) + '((t :inherit tab-line-tab)) "Tab line face for highlighting." :version "27.1" :group 'tab-line-faces) @@ -178,7 +182,7 @@ If the value is a function, call it with no arguments." (defvar tab-line-new-button (propertize " + " - 'display `(image :type xpm + 'display '(image :type xpm :file "tabs/new.xpm" :margin (2 . 0) :ascent center) @@ -206,7 +210,7 @@ If nil, don't show it at all." (defvar tab-line-close-button (propertize " x" - 'display `(image :type xpm + 'display '(image :type xpm :file "tabs/close.xpm" :margin (2 . 0) :ascent center) @@ -217,7 +221,7 @@ If nil, don't show it at all." (defvar tab-line-left-button (propertize " <" - 'display `(image :type xpm + 'display '(image :type xpm :file "tabs/left-arrow.xpm" :margin (2 . 0) :ascent center) @@ -228,7 +232,7 @@ If nil, don't show it at all." (defvar tab-line-right-button (propertize "> " - 'display `(image :type xpm + 'display '(image :type xpm :file "tabs/right-arrow.xpm" :margin (2 . 0) :ascent center) @@ -294,7 +298,10 @@ be displayed, or just a list of strings to display in the tab line. By default, use function `tab-line-tabs-window-buffers' that returns a list of buffers associated with the selected window. When `tab-line-tabs-mode-buffers', return a list of buffers -with the same major mode as the current buffer." +with the same major mode as the current buffer. +When `tab-line-tabs-buffer-groups', return a list of buffers +grouped either by `tab-line-tabs-buffer-group-function', when set, +or by `tab-line-tabs-buffer-groups'." :type '(choice (const :tag "Window buffers" tab-line-tabs-window-buffers) (const :tag "Same mode buffers" @@ -356,6 +363,11 @@ If the major mode's name string matches REGEXP, use GROUPNAME instead.") mode)))) (defun tab-line-tabs-buffer-groups () + "Return a list of tabs that should be displayed in the tab line. +By default return a list of buffers grouped by major mode, +according to `tab-line-tabs-buffer-groups'. +If non-nil, `tab-line-tabs-buffer-group-function' is used to +generate the group name." (if (window-parameter nil 'tab-line-groups) (let* ((buffers (funcall tab-line-tabs-buffer-list-function)) (groups @@ -385,6 +397,7 @@ If the major mode's name string matches REGEXP, use GROUPNAME instead.") (set-window-parameter nil 'tab-line-group nil)))) (group-tab `(tab (name . ,group) + (group-tab . t) (select . ,(lambda () (set-window-parameter nil 'tab-line-groups t) (set-window-parameter nil 'tab-line-group group) @@ -520,6 +533,13 @@ When TAB is a non-file-backed buffer, make FACE inherit from (setf face `(:inherit (tab-line-tab-special ,face)))) face) +(defun tab-line-tab-face-group (tab _tabs face _buffer-p _selected-p) + "Return FACE for TAB according to whether it's a group tab. +For use in `tab-line-tab-face-functions'." + (when (alist-get 'group-tab tab) + (setf face `(:inherit (tab-line-tab-group ,face)))) + face) + (defvar tab-line-auto-hscroll) (defun tab-line-format () diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el index ec21987bbf5..e2fd3ecaa42 100644 --- a/lisp/textmodes/bib-mode.el +++ b/lisp/textmodes/bib-mode.el @@ -29,6 +29,8 @@ ;; bibliography file. Keys are automagically inserted as you type, ;; and appropriate keys are presented for various kinds of entries. +;; FIXME: Fix the namespace use of this library. + ;;; Code: (defgroup bib nil @@ -39,7 +41,7 @@ (defcustom bib-file "~/my-bibliography.bib" "Default name of file used by `addbib'." - :type 'file) + :type 'file) (defcustom unread-bib-file "~/to-be-read.bib" "Default name of file used by `unread-bib' in Bib mode." @@ -48,10 +50,10 @@ (defvar bib-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map text-mode-map) - (define-key map "\C-M" 'return-key-bib) - (define-key map "\C-c\C-u" 'unread-bib) - (define-key map "\C-c\C-@" 'mark-bib) - (define-key map "\e`" 'abbrev-mode) + (define-key map "\C-M" #'return-key-bib) + (define-key map "\C-c\C-u" #'unread-bib) + (define-key map "\C-c\C-@" #'mark-bib) + (define-key map "\e`" #'abbrev-mode) map)) (defun addbib () diff --git a/lisp/textmodes/bibtex-style.el b/lisp/textmodes/bibtex-style.el index 66d245f9083..820033486dc 100644 --- a/lisp/textmodes/bibtex-style.el +++ b/lisp/textmodes/bibtex-style.el @@ -70,7 +70,7 @@ (setq-local outline-regexp "^[a-z]") (setq-local imenu-generic-expression '((nil "\\<\\(FUNCTION\\|MACRO\\)\\s-+{\\([^}\n]+\\)}" 2))) - (setq-local indent-line-function 'bibtex-style-indent-line) + (setq-local indent-line-function #'bibtex-style-indent-line) (setq-local parse-sexp-ignore-comments t) (setq font-lock-defaults '(bibtex-style-font-lock-keywords nil t diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el index f1a7517192f..2fa5e8de398 100644 --- a/lisp/textmodes/dns-mode.el +++ b/lisp/textmodes/dns-mode.el @@ -144,8 +144,8 @@ manually with \\[dns-mode-soa-increment-serial]." (defvar dns-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\C-c\C-s" 'dns-mode-soa-increment-serial) - (define-key map "\C-c\C-e" 'dns-mode-ipv6-to-nibbles) + (define-key map "\C-c\C-s" #'dns-mode-soa-increment-serial) + (define-key map "\C-c\C-e" #'dns-mode-ipv6-to-nibbles) map) "Keymap for DNS master file mode.") @@ -177,7 +177,7 @@ Turning on DNS mode runs `dns-mode-hook'." (setq-local comment-start-skip ";+ *") (setq-local font-lock-defaults '(dns-mode-font-lock-keywords nil nil ((?_ . "w")))) - (add-hook 'before-save-hook 'dns-mode-soa-maybe-increment-serial + (add-hook 'before-save-hook #'dns-mode-soa-maybe-increment-serial nil t)) ;;;###autoload (defalias 'zone-mode 'dns-mode) diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el index c44b69cdb73..ba8fac81f2c 100644 --- a/lisp/textmodes/enriched.el +++ b/lisp/textmodes/enriched.el @@ -1,4 +1,4 @@ -;;; enriched.el --- read and save files in text/enriched format +;;; enriched.el --- read and save files in text/enriched format -*- lexical-binding: t; -*- ;; Copyright (C) 1994-1996, 2001-2021 Free Software Foundation, Inc. @@ -181,14 +181,16 @@ The value is a list of \(VAR VALUE VAR VALUE...).") (defvar enriched-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\C-m" 'reindent-then-newline-and-indent) + ;; FIXME: These newline/reindent bindings might be redundant now + ;; that we have `electric-indent-mode' enabled by default. + (define-key map "\C-m" #'reindent-then-newline-and-indent) (define-key map - [remap newline-and-indent] 'reindent-then-newline-and-indent) + [remap newline-and-indent] #'reindent-then-newline-and-indent) (define-key map "\M-j" 'facemenu-justification-menu) - (define-key map "\M-S" 'set-justification-center) - (define-key map "\C-x\t" 'increase-left-margin) - (define-key map "\C-c[" 'set-left-margin) - (define-key map "\C-c]" 'set-right-margin) + (define-key map "\M-S" #'set-justification-center) + (define-key map "\C-x\t" #'increase-left-margin) + (define-key map "\C-c[" #'set-left-margin) + (define-key map "\C-c]" #'set-right-margin) map) "Keymap for Enriched mode.") @@ -215,7 +217,7 @@ Commands: (cond ((null enriched-mode) ;; Turn mode off (remove-hook 'change-major-mode-hook - 'enriched-before-change-major-mode 'local) + #'enriched-before-change-major-mode 'local) (setq buffer-file-format (delq 'text/enriched buffer-file-format)) ;; restore old variable values (while enriched-old-bindings @@ -232,7 +234,7 @@ Commands: (t ; Turn mode on (add-hook 'change-major-mode-hook - 'enriched-before-change-major-mode nil 'local) + #'enriched-before-change-major-mode nil 'local) (add-to-list 'buffer-file-format 'text/enriched) ;; Save old variable values before we change them. ;; These will be restored if we exit Enriched mode. @@ -245,10 +247,12 @@ Commands: (make-local-variable 'default-text-properties) (setq buffer-display-table enriched-display-table) (use-hard-newlines 1 (if enriched-rerun-flag 'never nil)) - (let ((sticky (plist-get default-text-properties 'front-sticky)) - (p enriched-par-props)) - (dolist (x p) - (add-to-list 'sticky x)) + (let* ((sticky + (delete-dups + (append + enriched-par-props + (copy-sequence + (plist-get default-text-properties 'front-sticky)))))) (if sticky (setq default-text-properties (plist-put default-text-properties @@ -264,7 +268,7 @@ Commands: (let ((enriched-rerun-flag t)) (enriched-mode 1)))) -(add-hook 'after-change-major-mode-hook 'enriched-after-change-major-mode) +(add-hook 'after-change-major-mode-hook #'enriched-after-change-major-mode) (fset 'enriched-mode-map enriched-mode-map) @@ -342,7 +346,7 @@ the region, and the START and END of each region." (if orig-buf (set-buffer orig-buf)) (funcall enriched-initial-annotation)))) (enriched-map-property-regions 'hard - (lambda (v b e) + (lambda (v b _e) (if (and v (= ?\n (char-after b))) (progn (goto-char b) (insert "\n")))) (point) nil) @@ -386,9 +390,11 @@ which can be the value of the `face' text property." ((and (listp face) (eq (car face) :background)) (list (list "x-bg-color" (cadr face)))) ((listp face) - (apply 'append (mapcar 'enriched-face-ans face))) + (apply #'append (mapcar #'enriched-face-ans face))) ((let* ((fg (face-attribute face :foreground)) (bg (face-attribute face :background)) + (weight (face-attribute face :weight)) + (slant (face-attribute face :slant)) (props (face-font face t)) (ans (cdr (format-annotate-single-property-change 'face nil props enriched-translations)))) @@ -396,6 +402,10 @@ which can be the value of the `face' text property." (setq ans (cons (list "x-color" fg) ans))) (unless (eq bg 'unspecified) (setq ans (cons (list "x-bg-color" bg) ans))) + (if (eq weight 'bold) + (setq ans (cons (list "bold") ans))) + (if (eq slant 'italic) + (setq ans (cons (list "italic") ans))) ans)))) ;;; diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 6681b03913c..81cd2f02cd7 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -45,7 +45,7 @@ A value of nil means that any change in indentation starts a new paragraph." (defcustom colon-double-space nil "Non-nil means put two spaces after a colon when filling." :type 'boolean) -(put 'colon-double-space 'safe-local-variable 'booleanp) +(put 'colon-double-space 'safe-local-variable #'booleanp) (defcustom fill-separate-heterogeneous-words-with-space nil "Non-nil means to use a space to separate words of a different kind. diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el index 24ccb3ce980..d374cab27a4 100644 --- a/lisp/textmodes/less-css-mode.el +++ b/lisp/textmodes/less-css-mode.el @@ -91,7 +91,7 @@ executable, e.g.: \"~/.gem/ruby/1.8/bin/lessc\"." "If non-nil, Less buffers are compiled to CSS after each save." :type 'boolean) ;;;###autoload -(put 'less-css-compile-at-save 'safe-local-variable 'booleanp) +(put 'less-css-compile-at-save 'safe-local-variable #'booleanp) (defcustom less-css-lessc-options '("--no-color") "Command line options for Less executable. @@ -107,7 +107,7 @@ using `expand-file-name', so both relative and absolute paths will work as expected." :type '(choice (const :tag "Same as Less file" nil) directory)) ;;;###autoload -(put 'less-css-output-directory 'safe-local-variable 'stringp) +(put 'less-css-output-directory 'safe-local-variable #'stringp) (defcustom less-css-output-file-name nil "File name in which to save CSS, or nil to use <name>.css for <name>.less. @@ -133,7 +133,7 @@ the path is relative, it will be relative to the current directory by default." :type '(choice (const nil) file)) ;;;###autoload -(put 'less-css-input-file-name 'safe-local-variable 'stringp) +(put 'less-css-input-file-name 'safe-local-variable #'stringp) (make-variable-buffer-local 'less-css-input-file-name) (defconst less-css-default-error-regex @@ -211,7 +211,7 @@ directory by default." (defvar less-css-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\C-c\C-c" 'less-css-compile) + (define-key map "\C-c\C-c" #'less-css-compile) map)) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.less\\'" . less-css-mode)) @@ -226,7 +226,7 @@ Special commands: (setq-local comment-continue " *") (setq-local comment-start-skip "/[*/]+[ \t]*") (setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*+/\\)") - (add-hook 'after-save-hook 'less-css-compile-maybe nil t)) + (add-hook 'after-save-hook #'less-css-compile-maybe nil t)) (provide 'less-css-mode) ;;; less-css-mode.el ends here diff --git a/lisp/textmodes/makeinfo.el b/lisp/textmodes/makeinfo.el index f63894b8150..8152f4b89c8 100644 --- a/lisp/textmodes/makeinfo.el +++ b/lisp/textmodes/makeinfo.el @@ -1,4 +1,4 @@ -;;; makeinfo.el --- run makeinfo conveniently +;;; makeinfo.el --- run makeinfo conveniently -*- lexical-binding: t; -*- ;; Copyright (C) 1991, 1993, 2001-2021 Free Software Foundation, Inc. @@ -93,7 +93,7 @@ apply to a temporary file, not the original; use the `makeinfo-buffer' command to gain use of `next-error'." (interactive "r") - (let (filename-or-header + (let (;; filename-or-header filename-or-header-beginning filename-or-header-end) ;; Cannot use `let' for makeinfo-temp-file or @@ -173,7 +173,7 @@ command to gain use of `next-error'." t 'makeinfo-compilation-sentinel-region))))))) -(defun makeinfo-next-error (arg reset) +(defun makeinfo-next-error (_arg _reset) "This function is used to disable `next-error' if the user has used `makeinfo-region'. Since the compilation process is used on a temporary file in that case, calling `next-error' would give diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el index 7d9b414bf0c..94519c3420b 100644 --- a/lisp/textmodes/nroff-mode.el +++ b/lisp/textmodes/nroff-mode.el @@ -47,12 +47,12 @@ (defvar nroff-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\t" 'tab-to-tab-stop) - (define-key map "\e?" 'nroff-count-text-lines) - (define-key map "\n" 'nroff-electric-newline) - (define-key map "\en" 'nroff-forward-text-line) - (define-key map "\ep" 'nroff-backward-text-line) - (define-key map "\C-c\C-c" 'nroff-view) + (define-key map "\t" #'tab-to-tab-stop) + (define-key map "\e?" #'nroff-count-text-lines) + (define-key map "\n" #'nroff-electric-newline) + (define-key map "\en" #'nroff-forward-text-line) + (define-key map "\ep" #'nroff-backward-text-line) + (define-key map "\C-c\C-c" #'nroff-view) map) "Major mode keymap for `nroff-mode'.") diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el index c3e1fb14bc3..87c91e8f1b7 100644 --- a/lisp/textmodes/page-ext.el +++ b/lisp/textmodes/page-ext.el @@ -293,7 +293,7 @@ Used by `pages-directory-for-addresses' function." ;; FIXME: Merely loading a package shouldn't have this kind of side-effects! (global-unset-key "\C-x\C-p") (define-key ctl-x-map "\C-p" #'pages-ctl-x-ctl-p-prefix) -(define-obsolete-function-alias 'ctl-x-ctl-p-prefix 'pages-ctl-x-ctl-p-prefix "27.1") +(define-obsolete-function-alias 'ctl-x-ctl-p-prefix #'pages-ctl-x-ctl-p-prefix "27.1") (defalias 'pages-ctl-x-ctl-p-prefix pages--ctl-x-ctl-p-map) diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el index 472c4069612..31e91c73031 100644 --- a/lisp/textmodes/paragraphs.el +++ b/lisp/textmodes/paragraphs.el @@ -97,7 +97,7 @@ lines that start paragraphs from lines that separate them. If the variable `use-hard-newlines' is non-nil, then only lines following a hard newline are considered to match." :type 'regexp) -(put 'paragraph-start 'safe-local-variable 'stringp) +(put 'paragraph-start 'safe-local-variable #'stringp) ;; paragraph-start requires a hard newline, but paragraph-separate does not: ;; It is assumed that paragraph-separate is distinctive enough to be believed @@ -114,7 +114,7 @@ the beginning of the line, so it should not use \"^\" as an anchor. This ensures that the paragraph functions will work equally within a region of text indented by a margin setting." :type 'regexp) -(put 'paragraph-separate 'safe-local-variable 'stringp) +(put 'paragraph-separate 'safe-local-variable #'stringp) (defcustom sentence-end-double-space t "Non-nil means a single space does not end a sentence. @@ -126,7 +126,7 @@ regexp describing the end of a sentence, when the value of the variable `sentence-end' is nil. See Info node `(elisp)Standard Regexps'." :type 'boolean :group 'fill) -(put 'sentence-end-double-space 'safe-local-variable 'booleanp) +(put 'sentence-end-double-space 'safe-local-variable #'booleanp) (defcustom sentence-end-without-period nil "Non-nil means a sentence will end without a period. @@ -138,7 +138,7 @@ regexp describing the end of a sentence, when the value of the variable `sentence-end' is nil. See Info node `(elisp)Standard Regexps'." :type 'boolean :group 'fill) -(put 'sentence-end-without-period 'safe-local-variable 'booleanp) +(put 'sentence-end-without-period 'safe-local-variable #'booleanp) (defcustom sentence-end-without-space "。.?!" @@ -148,7 +148,7 @@ This value is used by the function `sentence-end' to construct the regexp describing the end of a sentence, when the value of the variable `sentence-end' is nil. See Info node `(elisp)Standard Regexps'." :type 'string) -(put 'sentence-end-without-space 'safe-local-variable 'stringp) +(put 'sentence-end-without-space 'safe-local-variable #'stringp) (defcustom sentence-end nil "Regexp describing the end of a sentence. @@ -159,13 +159,13 @@ The value nil means to use the default value defined by the function `sentence-end'. You should always use this function to obtain the value of this variable." :type '(choice regexp (const :tag "Use default value" nil))) -(put 'sentence-end 'safe-local-variable 'string-or-null-p) +(put 'sentence-end 'safe-local-variable #'string-or-null-p) (defcustom sentence-end-base "[.?!…‽][]\"'”’)}»›]*" "Regexp matching the basic end of a sentence, not including following space." :type 'regexp :version "25.1") -(put 'sentence-end-base 'safe-local-variable 'stringp) +(put 'sentence-end-base 'safe-local-variable #'stringp) (defun sentence-end () "Return the regexp describing the end of a sentence. @@ -193,13 +193,13 @@ in between. See Info node `(elisp)Standard Regexps'." (defcustom page-delimiter "^\014" "Regexp describing line-beginnings that separate pages." :type 'regexp) -(put 'page-delimiter 'safe-local-variable 'stringp) +(put 'page-delimiter 'safe-local-variable #'stringp) (defcustom paragraph-ignore-fill-prefix nil "Non-nil means the paragraph commands are not affected by `fill-prefix'. This is desirable in modes where blank lines are the paragraph delimiters." :type 'boolean) -(put 'paragraph-ignore-fill-prefix 'safe-local-variable 'booleanp) +(put 'paragraph-ignore-fill-prefix 'safe-local-variable #'booleanp) ;; Silence the compiler. (defvar multiple-lines) diff --git a/lisp/textmodes/refbib.el b/lisp/textmodes/refbib.el index 2f3e0243ef3..084b17c676b 100644 --- a/lisp/textmodes/refbib.el +++ b/lisp/textmodes/refbib.el @@ -1,4 +1,4 @@ -;;; refbib.el --- convert refer-style references to ones usable by Latex bib +;;; refbib.el --- convert refer-style references to ones usable by Latex bib -*- lexical-binding: t; -*- ;; Copyright (C) 1989, 2001-2021 Free Software Foundation, Inc. @@ -411,7 +411,7 @@ title if CAPITALIZE is true. Returns value of VAR." with a comma and newline; if ABBREVS list is given, then try to replace the {DATA} with an abbreviation." (if data - (let (match nodelim multi-line index) + (let (match nodelim index) ;; multi-line (cond ((and abbrevs (setq match (assoc data abbrevs))) (if (null (cdr match)) @@ -507,7 +507,7 @@ but not a publisher." (defun r2b-barf-output () "Generate bibtex based on global variables." - (let ((standard-output r2b-out-buf) (case-fold-search t) match) + (let ((standard-output r2b-out-buf) (case-fold-search t)) ;; match (r2b-trace "...barfing") (sit-for 0) diff --git a/lisp/textmodes/refer.el b/lisp/textmodes/refer.el index c2bf90f37bb..53519ac3386 100644 --- a/lisp/textmodes/refer.el +++ b/lisp/textmodes/refer.el @@ -1,4 +1,4 @@ -;;; refer.el --- look up references in bibliography files +;;; refer.el --- look up references in bibliography files -*- lexical-binding: t; -*- ;; Copyright (C) 1992, 1996, 2001-2021 Free Software Foundation, Inc. @@ -176,7 +176,7 @@ found on the last `refer-find-entry' or `refer-find-next-entry'." (defun refer-find-entry-internal (keywords continue) (let ((keywords-list (refer-convert-string-to-list-of-strings keywords)) - (old-buffer (current-buffer)) + ;; (old-buffer (current-buffer)) (old-window (selected-window)) (new-window (selected-window)) (files (if continue @@ -184,7 +184,7 @@ found on the last `refer-find-entry' or `refer-find-next-entry'." (setq refer-saved-pos nil) (refer-get-bib-files))) (n 0) - (found nil) + ;; (found nil) (file nil)) ;; find window in which to display bibliography file. ;; if a bibliography file is already displayed in a window, use diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el index 8f4f3c5a231..0a0e4cc444c 100644 --- a/lisp/textmodes/refill.el +++ b/lisp/textmodes/refill.el @@ -1,4 +1,4 @@ -;;; refill.el --- `auto-fill' by refilling paragraphs on changes +;;; refill.el --- `auto-fill' by refilling paragraphs on changes -*- lexical-binding: t -*- ;; Copyright (C) 2000-2021 Free Software Foundation, Inc. @@ -83,16 +83,11 @@ ;;; Code: -;; Unused. -;;; (defgroup refill nil -;;; "Refilling paragraphs on changes." -;;; :group 'fill) - (defvar-local refill-ignorable-overlay nil "Portion of the most recently filled paragraph not needing filling. This is used to optimize refilling.") -(defun refill-adjust-ignorable-overlay (overlay afterp beg end &optional len) +(defun refill-adjust-ignorable-overlay (overlay afterp beg _end &optional _len) "Adjust OVERLAY to not include the about-to-be-modified region." (when (not afterp) (save-excursion @@ -157,7 +152,7 @@ ensures refilling is only done once per command that causes a change, regardless of the number of after-change calls from commands doing complex processing.") -(defun refill-after-change-function (beg end len) +(defun refill-after-change-function (_beg end _len) "Function for `after-change-functions' which just sets `refill-doit'." (unless undo-in-progress (setq refill-doit end))) @@ -232,9 +227,9 @@ For true \"word wrap\" behavior, use `visual-line-mode' instead." (kill-local-variable 'refill-saved-state)) (if refill-mode (progn - (add-hook 'after-change-functions 'refill-after-change-function nil t) - (add-hook 'post-command-hook 'refill-post-command-function nil t) - (add-hook 'pre-command-hook 'refill-pre-command-function nil t) + (add-hook 'after-change-functions #'refill-after-change-function nil t) + (add-hook 'post-command-hook #'refill-post-command-function nil t) + (add-hook 'pre-command-hook #'refill-pre-command-function nil t) (setq-local refill-saved-state (mapcar (lambda (s) (cons s (symbol-value s))) '(fill-paragraph-function auto-fill-function))) @@ -249,8 +244,8 @@ For true \"word wrap\" behavior, use `visual-line-mode' instead." (overlay-put refill-ignorable-overlay 'insert-behind-hooks '(refill-adjust-ignorable-overlay)) (auto-fill-mode 0)) - (remove-hook 'after-change-functions 'refill-after-change-function t) - (remove-hook 'post-command-hook 'refill-post-command-function t) + (remove-hook 'after-change-functions #'refill-after-change-function t) + (remove-hook 'post-command-hook #'refill-post-command-function t) (kill-local-variable 'backward-delete-char-untabify-method))) (provide 'refill) diff --git a/lisp/textmodes/reftex-auc.el b/lisp/textmodes/reftex-auc.el index ae3faec4fdc..8429fce625a 100644 --- a/lisp/textmodes/reftex-auc.el +++ b/lisp/textmodes/reftex-auc.el @@ -1,4 +1,4 @@ -;;; reftex-auc.el --- RefTeX's interface to AUCTeX +;;; reftex-auc.el --- RefTeX's interface to AUCTeX -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. @@ -69,6 +69,8 @@ What is being used depends upon `reftex-plug-into-AUCTeX'." (LaTeX-add-labels label)) (TeX-argument-insert label optional))) +(declare-function LaTeX-add-bibitems "latex") ;FIXME: Can't find the definition + ;;;###autoload (defun reftex-arg-cite (optional &optional prompt definition) "Use `reftex-citation' or AUCTeX's code to insert a cite-key macro argument. @@ -82,13 +84,13 @@ What is being used depends upon `reftex-plug-into-AUCTeX'." (if prompt prompt "Add key") " (default none): ")) (setq items (multi-prompt "," t prompt (LaTeX-bibitem-list))))) - (apply 'LaTeX-add-bibitems items) - (TeX-argument-insert (mapconcat 'identity items reftex-cite-key-separator) + (apply #'LaTeX-add-bibitems items) + (TeX-argument-insert (mapconcat #'identity items reftex-cite-key-separator) optional))) ;;;###autoload -(defun reftex-arg-index-tag (optional &optional prompt &rest args) +(defun reftex-arg-index-tag (optional &optional prompt &rest _args) "Prompt for an index tag with completion. This is the name of an index, not the entry." (let (tag taglist) @@ -102,13 +104,13 @@ This is the name of an index, not the entry." (setq taglist (cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol))) - tag (completing-read prompt (mapcar 'list taglist)))) + tag (completing-read prompt (mapcar #'list taglist)))) ;; Just ask like AUCTeX does. (setq tag (read-string prompt))) (TeX-argument-insert tag optional))) ;;;###autoload -(defun reftex-arg-index (optional &optional prompt &rest args) +(defun reftex-arg-index (optional &optional prompt &rest _args) "Prompt for an index entry completing with known entries. Completion is specific for just one index, if the macro or a tag argument identify one of multiple indices." @@ -149,23 +151,27 @@ argument identify one of multiple indices." ;; `reftex-plug-into-AUCTeX'. (if (reftex-plug-flag 0) - (setq LaTeX-label-function 'reftex-label) - (setq LaTeX-label-function nil)) - - (and (or (reftex-plug-flag 1) (reftex-plug-flag 2)) - (fboundp 'TeX-arg-label) - (fset 'TeX-arg-label 'reftex-arg-label)) - - (and (reftex-plug-flag 3) - (fboundp 'TeX-arg-cite) - (fset 'TeX-arg-cite 'reftex-arg-cite)) - - (and (reftex-plug-flag 4) - (fboundp 'TeX-arg-index-tag) - (fset 'TeX-arg-index-tag 'reftex-arg-index-tag)) - (and (reftex-plug-flag 4) - (fboundp 'TeX-arg-index) - (fset 'TeX-arg-index 'reftex-arg-index))) + (if (bound-and-true-p LaTeX-label-function) + (add-function :override LaTeX-label-function #'reftex-label) + (setq LaTeX-label-function #'reftex-label)) + (if (eq #'reftex-label (bound-and-true-p LaTeX-label-function)) + (setq LaTeX-label-function nil) + (remove-function LaTeX-label-function #'reftex-label))) + + (if (or (reftex-plug-flag 1) (reftex-plug-flag 2)) + (advice-add 'TeX-arg-label :override #'reftex-arg-label) + (advice-remove 'TeX-arg-label #'reftex-arg-label)) + + (if (reftex-plug-flag 3) + (advice-add 'TeX-arg-cite :override #'reftex-arg-cite) + (advice-remove 'TeX-arg-cite #'reftex-arg-cite)) + + (if (reftex-plug-flag 4) + (advice-add 'TeX-arg-index-tag :override #'reftex-arg-index-tag) + (advice-remove 'TeX-arg-index-tag #'reftex-arg-index-tag)) + (if (reftex-plug-flag 4) + (advice-add 'TeX-arg-index :override #'reftex-arg-index) + (advice-remove 'TeX-arg-index #'reftex-arg-index))) ;;;###autoload (defun reftex-toggle-plug-into-AUCTeX () @@ -205,7 +211,7 @@ the label information is recompiled on next use." (when changed (put reftex-docstruct-symbol 'reftex-label-alist-style list))))) ;;;###autoload -(defalias 'reftex-add-to-label-alist 'reftex-add-label-environments) +(defalias 'reftex-add-to-label-alist #'reftex-add-label-environments) ;;;###autoload (defun reftex-add-section-levels (entry-list) diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 5579e401790..650d11d4aca 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -1,4 +1,4 @@ -;;; reftex-cite.el --- creating citations with RefTeX +;;; reftex-cite.el --- creating citations with RefTeX -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. @@ -310,11 +310,11 @@ Return list with entries." ;; Sorting (cond ((eq 'author reftex-sort-bibtex-matches) - (sort found-list 'reftex-bib-sort-author)) + (sort found-list #'reftex-bib-sort-author)) ((eq 'year reftex-sort-bibtex-matches) - (sort found-list 'reftex-bib-sort-year)) + (sort found-list #'reftex-bib-sort-year)) ((eq 'reverse-year reftex-sort-bibtex-matches) - (sort found-list 'reftex-bib-sort-year-reverse)) + (sort found-list #'reftex-bib-sort-year-reverse)) (t found-list)))) (defun reftex-bib-sort-author (e1 e2) @@ -390,7 +390,7 @@ The environment should be located in FILES." (when (and start end) (setq entries (append entries - (mapcar 'reftex-parse-bibitem + (mapcar #'reftex-parse-bibitem (delete "" (split-string (buffer-substring-no-properties @@ -533,7 +533,7 @@ If FORMAT is non-nil `format' entry accordingly." "Format a BibTeX ENTRY so that it is nice to look at." (let* ((auth-list (reftex-get-bib-names "author" entry)) - (authors (mapconcat 'identity auth-list ", ")) + (authors (mapconcat #'identity auth-list ", ")) (year (reftex-get-bib-field "year" entry)) (title (reftex-get-bib-field "title" entry)) (type (reftex-get-bib-field "&type" entry)) @@ -607,7 +607,7 @@ If FORMAT is non-nil `format' entry accordingly." (push (substring text 0 (+ 60 (match-beginning 0))) lines) (setq text (substring text (+ 61 (match-beginning 0))))) (push text lines) - (setq text (mapconcat 'identity (nreverse lines) "\n ")) + (setq text (mapconcat #'identity (nreverse lines) "\n ")) (when (reftex-use-fonts) (put-text-property 0 (length text) 'face reftex-bib-author-face text)) @@ -676,7 +676,7 @@ While entering the regexp, completion on knows citation keys is possible. ;; All keys go into a single command - we need to trick a little ;; FIXME: Unfortunately, this means that commenting does not work right. (pop selected-entries) - (let ((concat-keys (mapconcat 'car selected-entries + (let ((concat-keys (mapconcat #'car selected-entries reftex-cite-key-separator))) (setq insert-entries (list (list concat-keys (cons "&key" concat-keys)))))) @@ -726,7 +726,7 @@ While entering the regexp, completion on knows citation keys is possible. (when (and reftex-mode (fboundp 'LaTeX-add-bibitems) reftex-plug-into-AUCTeX) - (apply 'LaTeX-add-bibitems (mapcar 'car selected-entries))) + (apply #'LaTeX-add-bibitems (mapcar #'car selected-entries))) ;; Produce the cite-view strings (when (and reftex-mode reftex-cache-cite-echo cite-view) @@ -749,7 +749,7 @@ While entering the regexp, completion on knows citation keys is possible. (forward-char 1))) ;; Return the citation key - (mapcar 'car selected-entries))) + (mapcar #'car selected-entries))) (defun reftex-figure-out-cite-format (arg &optional no-insert format-key) "Check if there is already a cite command at point and change cite format @@ -815,15 +815,16 @@ in order to only add another reference in the same cite command." (reftex-citation nil ?t)) (defvar reftex-select-bib-map) +(defvar reftex--found-list) (defun reftex-offer-bib-menu () "Offer bib menu and return list of selected items." (let ((bibtype (reftex-bib-or-thebib)) - found-list rtn key data selected-entries) + reftex--found-list rtn key data selected-entries) (while (not (catch 'done ;; Scan bibtex files - (setq found-list + (setq reftex--found-list (cond ((eq bibtype 'bib) ; ((assq 'bib (symbol-value reftex-docstruct-symbol)) @@ -834,7 +835,7 @@ in order to only add another reference in the same cite command." ;; using thebibliography environment. (reftex-extract-bib-entries-from-thebibliography (reftex-uniquify - (mapcar 'cdr + (mapcar #'cdr (reftex-all-assq 'thebib (symbol-value reftex-docstruct-symbol)))))) (reftex-default-bibliography @@ -842,7 +843,7 @@ in order to only add another reference in the same cite command." (reftex-extract-bib-entries (reftex-default-bibliography))) (t (error "No valid bibliography in this document, and no default available")))) - (unless found-list + (unless reftex--found-list (error "Sorry, no matches found")) ;; Remember where we came from @@ -854,11 +855,11 @@ in order to only add another reference in the same cite command." (delete-other-windows) (reftex-kill-buffer "*RefTeX Select*") (switch-to-buffer-other-window "*RefTeX Select*") - (unless (eq major-mode 'reftex-select-bib-mode) + (unless (derived-mode-p 'reftex-select-bib-mode) (reftex-select-bib-mode)) - (let ((buffer-read-only nil)) + (let ((inhibit-read-only t)) (erase-buffer) - (reftex-insert-bib-matches found-list)) + (reftex-insert-bib-matches reftex--found-list)) (setq buffer-read-only t) (if (= 0 (buffer-size)) (error "No matches found")) @@ -881,34 +882,36 @@ in order to only add another reference in the same cite command." (throw 'done nil)) ((eq key ?r) ;; Restrict with new regular expression - (setq found-list (reftex-restrict-bib-matches found-list)) + (setq reftex--found-list + (reftex-restrict-bib-matches reftex--found-list)) (let ((buffer-read-only nil)) (erase-buffer) - (reftex-insert-bib-matches found-list)) + (reftex-insert-bib-matches reftex--found-list)) (goto-char 1)) ((eq key ?A) ;; Take all (marked) (setq selected-entries (if reftex-select-marked - (mapcar 'car (nreverse reftex-select-marked)) - found-list)) + (mapcar #'car (nreverse reftex-select-marked)) + reftex--found-list)) (throw 'done t)) ((eq key ?a) ;; Take all (marked), and push the symbol 'concat (setq selected-entries (cons 'concat (if reftex-select-marked - (mapcar 'car (nreverse reftex-select-marked)) - found-list))) + (mapcar #'car (nreverse reftex-select-marked)) + reftex--found-list))) (throw 'done t)) ((eq key ?e) ;; Take all (marked), and push the symbol 'concat - (reftex-extract-bib-file found-list reftex-select-marked) + (reftex-extract-bib-file reftex--found-list + reftex-select-marked) (setq selected-entries "BibTeX database file created") (throw 'done t)) ((eq key ?E) ;; Take all (marked), and push the symbol 'concat - (reftex-extract-bib-file found-list reftex-select-marked + (reftex-extract-bib-file reftex--found-list reftex-select-marked 'complement) (setq selected-entries "BibTeX database file created") (throw 'done t)) @@ -918,7 +921,7 @@ in order to only add another reference in the same cite command." (setq selected-entries (if reftex-select-marked (cons 'concat - (mapcar 'car (nreverse reftex-select-marked))) + (mapcar #'car (nreverse reftex-select-marked))) (if data (list data) nil))) (throw 'done t)) ((stringp key) @@ -971,7 +974,7 @@ in order to only add another reference in the same cite command." nil) (cdr (assoc "&entry" x)))) all))) - (insert (mapconcat 'identity all "\n\n")) + (insert (mapconcat #'identity all "\n\n")) (save-buffer) (goto-char (point-min)))) @@ -1004,7 +1007,7 @@ in order to only add another reference in the same cite command." last (nth (1- n) namelist)) (setcdr (nthcdr (- n 2) namelist) nil) (concat - (mapconcat 'identity namelist (nth 0 reftex-cite-punctuation)) + (mapconcat #'identity namelist (nth 0 reftex-cite-punctuation)) (nth 1 reftex-cite-punctuation) last))))) @@ -1100,7 +1103,7 @@ in order to only add another reference in the same cite command." (put reftex-docstruct-symbol 'modified t))) string)) -(defun reftex-bibtex-selection-callback (data ignore no-revisit) +(defun reftex-bibtex-selection-callback (data _ignore no-revisit) "Callback function to be called from the BibTeX selection, in order to display context. This function is relatively slow and not recommended for follow mode. It works OK for individual lookups." @@ -1119,7 +1122,7 @@ recommended for follow mode. It works OK for individual lookups." ; ((assq 'thebib (symbol-value reftex-docstruct-symbol)) (setq bibfile-list (reftex-uniquify - (mapcar 'cdr + (mapcar #'cdr (reftex-all-assq 'thebib (symbol-value reftex-docstruct-symbol)))) item t)) @@ -1163,7 +1166,7 @@ recommended for follow mode. It works OK for individual lookups." "Return a list of BibTeX @string references that appear as values in ALIST." (reftex-remove-if (lambda (x) (string-match "^\\([\"{]\\|[0-9]+$\\)" x)) ;; get list of values, discard keys - (mapcar 'cdr + (mapcar #'cdr ;; remove &key and &type entries (reftex-remove-if (lambda (pair) (string-match "^&" (car pair))) @@ -1186,7 +1189,7 @@ created files in the variables `reftex-create-bibtex-header' or (interactive "FNew BibTeX file: ") (let ((keys (reftex-all-used-citation-keys)) (files (reftex-get-bibfile-list)) - file key entries beg end entry string-keys string-entries) + key entries beg end entry string-keys string-entries) (save-current-buffer (dolist (file files) (set-buffer (reftex-get-file-buffer-force file 'mark)) @@ -1252,9 +1255,9 @@ created files in the variables `reftex-create-bibtex-header' or (error "Abort"))) (erase-buffer) (if reftex-create-bibtex-header (insert reftex-create-bibtex-header "\n\n")) - (insert (mapconcat 'identity (reverse string-entries) "\n\n")) + (insert (mapconcat #'identity (reverse string-entries) "\n\n")) (if string-entries (insert "\n\n\n")) - (insert (mapconcat 'identity (reverse entries) "\n\n")) + (insert (mapconcat #'identity (reverse entries) "\n\n")) (if reftex-create-bibtex-footer (insert "\n\n" reftex-create-bibtex-footer)) (goto-char (point-min)) (save-buffer) diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el index e517cea2669..a21dd3362b0 100644 --- a/lisp/textmodes/reftex-dcr.el +++ b/lisp/textmodes/reftex-dcr.el @@ -1,4 +1,4 @@ -;;; reftex-dcr.el --- viewing cross references and citations with RefTeX +;;; reftex-dcr.el --- viewing cross references and citations with RefTeX -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. @@ -132,7 +132,7 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." ((eq bibtype 'thebib) (setq item t files (reftex-uniquify - (mapcar 'cdr + (mapcar #'cdr (reftex-all-assq 'thebib (symbol-value reftex-docstruct-symbol)))))) (reftex-default-bibliography @@ -161,10 +161,10 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." (shrink-window (1- (- (window-height) size))) (recenter 0)) ;; Arrange restoration - (add-hook 'pre-command-hook 'reftex-restore-window-conf)) + (add-hook 'pre-command-hook #'reftex-restore-window-conf)) ;; Normal display in other window - (add-hook 'pre-command-hook 'reftex-highlight-shall-die) + (add-hook 'pre-command-hook #'reftex-highlight-shall-die) (setq pop-win (selected-window)) (select-window win) (goto-char pos) @@ -212,13 +212,13 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." (error (set-window-configuration window-conf) (message "ref: Label %s not found" label) (error "ref: Label %s not found" label)))) ;; 2nd is line OK - (add-hook 'pre-command-hook 'reftex-highlight-shall-die) + (add-hook 'pre-command-hook #'reftex-highlight-shall-die) (when (eq how 'tmp-window) ;; Resize window and arrange restoration (shrink-window (1- (- (window-height) 9))) (recenter '(4)) - (add-hook 'pre-command-hook 'reftex-restore-window-conf)) + (add-hook 'pre-command-hook #'reftex-restore-window-conf)) (setq pop-win (selected-window)) (select-window win) (goto-char pos) @@ -266,7 +266,7 @@ With argument, actually select the window showing the cross reference." (defun reftex-restore-window-conf () (set-window-configuration (get 'reftex-auto-view-crossref 'last-window-conf)) (put 'reftex-auto-view-crossref 'last-window-conf nil) - (remove-hook 'pre-command-hook 'reftex-restore-window-conf)) + (remove-hook 'pre-command-hook #'reftex-restore-window-conf)) (defun reftex-echo-ref (label entry docstruct) ;; Display crossref info in echo area. @@ -320,10 +320,6 @@ With argument, actually select the window showing the cross reference." (with-current-buffer buf (run-hooks 'reftex-display-copied-context-hook))))) -(defvar reftex-use-itimer-in-xemacs nil - "Non-nil means use the idle timers in XEmacs for crossref display. -Currently, idle timer restart is broken and we use the post-command-hook.") - ;;;###autoload (defun reftex-toggle-auto-view-crossref () "Toggle the automatic display of crossref information in the echo area. @@ -332,36 +328,16 @@ will display info in the echo area." (interactive) (if reftex-auto-view-crossref-timer (progn - (if (featurep 'xemacs) - (if reftex-use-itimer-in-xemacs - (delete-itimer reftex-auto-view-crossref-timer) - (remove-hook 'post-command-hook 'reftex-start-itimer-once)) - (cancel-timer reftex-auto-view-crossref-timer)) + (cancel-timer reftex-auto-view-crossref-timer) (setq reftex-auto-view-crossref-timer nil) (message "Automatic display of crossref information was turned off")) (setq reftex-auto-view-crossref-timer - (if (featurep 'xemacs) - (if reftex-use-itimer-in-xemacs - (start-itimer "RefTeX Idle Timer" - 'reftex-view-crossref-when-idle - reftex-idle-time reftex-idle-time t) - (add-hook 'post-command-hook 'reftex-start-itimer-once) - t) - (run-with-idle-timer - reftex-idle-time t 'reftex-view-crossref-when-idle))) + (run-with-idle-timer + reftex-idle-time t #'reftex-view-crossref-when-idle)) (unless reftex-auto-view-crossref (setq reftex-auto-view-crossref t)) (message "Automatic display of crossref information was turned on"))) -(defun reftex-start-itimer-once () - (and (featurep 'xemacs) - reftex-mode - (not (itimer-live-p reftex-auto-view-crossref-timer)) - (setq reftex-auto-view-crossref-timer - (start-itimer "RefTeX Idle Timer" - 'reftex-view-crossref-when-idle - reftex-idle-time nil t)))) - ;;;###autoload (defun reftex-view-crossref-from-bibtex (&optional arg) "View location in a LaTeX document which cites the BibTeX entry at point. @@ -431,7 +407,7 @@ Calling this function several times find successive citation locations." (put 'reftex-view-regexp-match :cnt (cl-incf cnt)) (reftex-highlight 0 (match-beginning highlight-group) (match-end highlight-group)) - (add-hook 'pre-command-hook 'reftex-highlight-shall-die) + (add-hook 'pre-command-hook #'reftex-highlight-shall-die) (setq pop-window (selected-window))) (put 'reftex-view-regexp-match :props nil) (or cont (set-window-configuration window-conf))) diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el index 4d021609019..3b7518e5c3f 100644 --- a/lisp/textmodes/reftex-global.el +++ b/lisp/textmodes/reftex-global.el @@ -1,4 +1,4 @@ -;;; reftex-global.el --- operations on entire documents with RefTeX +;;; reftex-global.el --- operations on entire documents with RefTeX -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. @@ -39,7 +39,7 @@ The TAGS file is also immediately visited with `visit-tags-table'." (reftex-access-scan-info current-prefix-arg) (let* ((master (reftex-TeX-master-file)) (files (reftex-all-document-files)) - (cmd (format "etags %s" (mapconcat 'shell-quote-argument + (cmd (format "etags %s" (mapconcat #'shell-quote-argument files " ")))) (with-current-buffer (reftex-get-file-buffer-force master) (message "Running etags to create TAGS file...") @@ -65,7 +65,7 @@ No active TAGS table is required." (let* ((files (reftex-all-document-files t)) (cmd (format "%s %s" grep-cmd - (mapconcat 'identity files " ")))) + (mapconcat #'identity files " ")))) (grep cmd))) ;;;###autoload @@ -160,7 +160,7 @@ No active TAGS table is required." (when (and (car (car dlist)) (cdr (car dlist))) (cl-incf cnt) - (insert (mapconcat 'identity (car dlist) "\n ") "\n")) + (insert (mapconcat #'identity (car dlist) "\n ") "\n")) (pop dlist)) (goto-char (point-min)) (when (= cnt 0) @@ -208,7 +208,7 @@ one with the `xr' package." (error "Abort")) ;; Make the translation list (let* ((re-core (concat "\\(" - (mapconcat 'cdr reftex-typekey-to-prefix-alist "\\|") + (mapconcat #'cdr reftex-typekey-to-prefix-alist "\\|") "\\)")) (label-re (concat "\\`" re-core "\\([0-9]+\\)\\'")) (search-re (concat "[{,]\\(" re-core "\\([0-9]+\\)\\)[,}]")) @@ -326,7 +326,7 @@ labels." file buffer) (save-current-buffer (while (setq file (pop files)) - (setq buffer (reftex-get-buffer-visiting file)) + (setq buffer (find-buffer-visiting file)) (when buffer (set-buffer buffer) (save-buffer)))))) @@ -344,7 +344,7 @@ Also checks if buffers visiting the files are in read-only mode." (ding) (or (y-or-n-p (format "No write access to %s. Continue? " file)) (error "Abort"))) - (when (and (setq buf (reftex-get-buffer-visiting file)) + (when (and (setq buf (find-buffer-visiting file)) (with-current-buffer buf buffer-read-only)) (ding) @@ -366,10 +366,10 @@ Also checks if buffers visiting the files are in read-only mode." (goto-char (if isearch-forward (point-min) (point-max)))) (defun reftex-isearch-push-state-function () - `(lambda (cmd) - (reftex-isearch-pop-state-function cmd ,(current-buffer)))) + (let ((buf (current-buffer))) + (lambda (cmd) (reftex-isearch-pop-state-function cmd buf)))) -(defun reftex-isearch-pop-state-function (cmd buffer) +(defun reftex-isearch-pop-state-function (_cmd buffer) (switch-to-buffer buffer)) (defun reftex-isearch-isearch-search (string bound noerror) @@ -451,17 +451,17 @@ With no argument, this command toggles (if (boundp 'multi-isearch-next-buffer-function) (set (make-local-variable 'multi-isearch-next-buffer-function) - 'reftex-isearch-switch-to-next-file) + #'reftex-isearch-switch-to-next-file) (set (make-local-variable 'isearch-wrap-function) - 'reftex-isearch-wrap-function) + #'reftex-isearch-wrap-function) (set (make-local-variable 'isearch-search-fun-function) - (lambda () 'reftex-isearch-isearch-search)) + (lambda () #'reftex-isearch-isearch-search)) (set (make-local-variable 'isearch-push-state-function) - 'reftex-isearch-push-state-function) + #'reftex-isearch-push-state-function) (set (make-local-variable 'isearch-next-buffer-function) - 'reftex-isearch-switch-to-next-file)) + #'reftex-isearch-switch-to-next-file)) (setq reftex-isearch-minor-mode t)))) - (add-hook 'reftex-mode-hook 'reftex-isearch-minor-mode)) + (add-hook 'reftex-mode-hook #'reftex-isearch-minor-mode)) (dolist (crt-buf (buffer-list)) (with-current-buffer crt-buf (when reftex-mode @@ -472,7 +472,7 @@ With no argument, this command toggles (kill-local-variable 'isearch-push-state-function) (kill-local-variable 'isearch-next-buffer-function)) (setq reftex-isearch-minor-mode nil)))) - (remove-hook 'reftex-mode-hook 'reftex-isearch-minor-mode))) + (remove-hook 'reftex-mode-hook #'reftex-isearch-minor-mode))) ;; Force mode line redisplay. (set-buffer-modified-p (buffer-modified-p)))) diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el index 5049ffb64b1..28cc7db2dcd 100644 --- a/lisp/textmodes/reftex-index.el +++ b/lisp/textmodes/reftex-index.el @@ -1,4 +1,4 @@ -;;; reftex-index.el --- index support with RefTeX +;;; reftex-index.el --- index support with RefTeX -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. @@ -30,8 +30,6 @@ (require 'reftex) ;; START remove for XEmacs release -(defvar mark-active) -(defvar transient-mark-mode) (defvar TeX-master) ;; END remove for XEmacs release @@ -49,7 +47,7 @@ which is part of AUCTeX, the string is first processed with the (interactive "P") (let* ((use-default (not (equal arg '(16)))) ; check for double prefix ;; check if we have an active selection - (active (reftex-region-active-p)) + (active (region-active-p)) (beg (if active (region-beginning) (save-excursion @@ -89,7 +87,7 @@ which is part of AUCTeX, the string is first processed with the (reftex-index def-char full-entry def-tag sel))))) ;;;###autoload -(defun reftex-index (&optional char key tag sel no-insert) +(defun reftex-index (&optional char key tag sel _no-insert) "Query for an index macro and insert it along with its arguments. The index macros available are those defined in `reftex-index-macro' or by a call to `reftex-add-index-macros', typically from an AUCTeX style file. @@ -178,7 +176,7 @@ will prompt for other arguments." (format "default %s" default)) ""))) ": "))) - (tag (completing-read prompt (mapcar 'list index-tags)))) + (tag (completing-read prompt (mapcar #'list index-tags)))) (if (and default (equal tag "")) (setq tag default)) (reftex-update-default-index tag) tag)) @@ -239,7 +237,7 @@ will prompt for other arguments." (format "[^M] %s (the default)\n" default) "") (mapconcat (lambda(x) - (apply 'format "[%c] %s" x)) + (apply #'format "[%c] %s" x)) tag-alist "\n"))) ;; Query the user for an index-tag (setq rpl (reftex-select-with-char prompt help 3 t)) @@ -278,56 +276,57 @@ will prompt for other arguments." (defvar reftex-index-mode-map (let ((map (make-sparse-keymap))) ;; Index map - (define-key map (if (featurep 'xemacs) [(button2)] [(mouse-2)]) - 'reftex-index-mouse-goto-line-and-hide) + (define-key map [(mouse-2)] #'reftex-index-mouse-goto-line-and-hide) (define-key map [follow-link] 'mouse-face) (substitute-key-definition - 'next-line 'reftex-index-next map global-map) + #'next-line #'reftex-index-next map global-map) (substitute-key-definition - 'previous-line 'reftex-index-previous map global-map) - - (define-key map "n" 'reftex-index-next) - (define-key map "p" 'reftex-index-previous) - (define-key map "?" 'reftex-index-show-help) - (define-key map " " 'reftex-index-view-entry) - (define-key map "\C-m" 'reftex-index-goto-entry-and-hide) - (define-key map "\C-i" 'reftex-index-goto-entry) - (define-key map "\C-k" 'reftex-index-kill) - (define-key map "r" 'reftex-index-rescan) - (define-key map "R" 'reftex-index-Rescan) - (define-key map "g" 'revert-buffer) - (define-key map "q" 'reftex-index-quit) - (define-key map "k" 'reftex-index-quit-and-kill) - (define-key map "f" 'reftex-index-toggle-follow) - (define-key map "s" 'reftex-index-switch-index-tag) - (define-key map "e" 'reftex-index-edit) - (define-key map "^" 'reftex-index-level-up) - (define-key map "_" 'reftex-index-level-down) - (define-key map "}" 'reftex-index-restrict-to-section) - (define-key map "{" 'reftex-index-widen) - (define-key map ">" 'reftex-index-restriction-forward) - (define-key map "<" 'reftex-index-restriction-backward) - (define-key map "(" 'reftex-index-toggle-range-beginning) - (define-key map ")" 'reftex-index-toggle-range-end) - (define-key map "|" 'reftex-index-edit-attribute) - (define-key map "@" 'reftex-index-edit-visual) - (define-key map "*" 'reftex-index-edit-key) - (define-key map "\C-c=" 'reftex-index-goto-toc) - (define-key map "c" 'reftex-index-toggle-context) + #'previous-line #'reftex-index-previous map global-map) + + (define-key map "n" #'reftex-index-next) + (define-key map "p" #'reftex-index-previous) + (define-key map "?" #'reftex-index-show-help) + (define-key map " " #'reftex-index-view-entry) + (define-key map "\C-m" #'reftex-index-goto-entry-and-hide) + (define-key map "\C-i" #'reftex-index-goto-entry) + (define-key map "\C-k" #'reftex-index-kill) + (define-key map "r" #'reftex-index-rescan) + (define-key map "R" #'reftex-index-Rescan) + (define-key map "g" #'revert-buffer) + (define-key map "q" #'reftex-index-quit) + (define-key map "k" #'reftex-index-quit-and-kill) + (define-key map "f" #'reftex-index-toggle-follow) + (define-key map "s" #'reftex-index-switch-index-tag) + (define-key map "e" #'reftex-index-edit) + (define-key map "^" #'reftex-index-level-up) + (define-key map "_" #'reftex-index-level-down) + (define-key map "}" #'reftex-index-restrict-to-section) + (define-key map "{" #'reftex-index-widen) + (define-key map ">" #'reftex-index-restriction-forward) + (define-key map "<" #'reftex-index-restriction-backward) + (define-key map "(" #'reftex-index-toggle-range-beginning) + (define-key map ")" #'reftex-index-toggle-range-end) + (define-key map "|" #'reftex-index-edit-attribute) + (define-key map "@" #'reftex-index-edit-visual) + (define-key map "*" #'reftex-index-edit-key) + (define-key map "\C-c=" #'reftex-index-goto-toc) + (define-key map "c" #'reftex-index-toggle-context) ;; The capital letters and the exclamation mark - (cl-loop for key across (concat "!" reftex-index-section-letters) do - (define-key map (vector (list key)) - (list 'lambda '() '(interactive) - (list 'reftex-index-goto-letter key)))) + (mapc (lambda (key) + (define-key map (vector (list key)) + (lambda () (interactive) + (reftex-index-goto-letter key)))) + (concat "!" reftex-index-section-letters)) (easy-menu-define reftex-index-menu map "Menu for Index buffer" '("Index" ["Goto section A-Z" (message "To go to a section, just press any of: !%s" - reftex-index-section-letters) t] + reftex-index-section-letters) + t] ["Show Entry" reftex-index-view-entry t] ["Go To Entry" reftex-index-goto-entry t] ["Exit & Go To Entry" reftex-index-goto-entry-and-hide t] @@ -394,7 +393,7 @@ Press `?' for a summary of important key bindings, or check the menu. Here are all local bindings. \\{reftex-index-mode-map}" - (set (make-local-variable 'revert-buffer-function) 'reftex-index-revert) + (set (make-local-variable 'revert-buffer-function) #'reftex-index-revert) (set (make-local-variable 'reftex-index-restriction-data) nil) (set (make-local-variable 'reftex-index-restriction-indicator) nil) (setq mode-line-format @@ -403,15 +402,9 @@ Here are all local bindings. " R<" 'reftex-index-restriction-indicator ">" " -%-")) (setq truncate-lines t) - (when (featurep 'xemacs) - ;; XEmacs needs the call to make-local-hook - (make-local-hook 'post-command-hook) - (make-local-hook 'pre-command-hook)) (make-local-variable 'reftex-last-follow-point) - (when (featurep 'xemacs) - (easy-menu-add reftex-index-menu reftex-index-mode-map)) - (add-hook 'post-command-hook 'reftex-index-post-command-hook nil t) - (add-hook 'pre-command-hook 'reftex-index-pre-command-hook nil t)) + (add-hook 'post-command-hook #'reftex-index-post-command-hook nil t) + (add-hook 'pre-command-hook #'reftex-index-pre-command-hook nil t)) (defconst reftex-index-help " AVAILABLE KEYS IN INDEX BUFFER @@ -450,7 +443,7 @@ _ ^ Add/Remove parent key (to make this item a subitem). (match (cond ((or (not no-revisit) - (reftex-get-buffer-visiting file)) + (find-buffer-visiting file)) (switch-to-buffer-other-window (reftex-get-file-buffer-force file nil)) (goto-char (or pos (point-min))) @@ -567,7 +560,7 @@ SPC=view TAB=goto RET=goto+hide [e]dit [q]uit [r]escan [f]ollow [?]Help (run-hooks 'reftex-display-copied-context-hook) (message "Building %s buffer...done." buffer-name) (setq buffer-read-only t)) - (and locations (apply 'reftex-find-start-point (point) locations)) + (and locations (apply #'reftex-find-start-point (point) locations)) (if reftex-index-restriction-indicator (message "Index restricted: <%s>" reftex-index-restriction-indicator)))) @@ -582,7 +575,7 @@ SPC=view TAB=goto RET=goto+hide [e]dit [q]uit [r]escan [f]ollow [?]Help (indent " ") (context reftex-index-include-context) (context-indent (concat indent " ")) - (section-chars (mapcar 'identity reftex-index-section-letters)) + (section-chars (mapcar #'identity reftex-index-section-letters)) (this-section-char 0) (font (reftex-use-fonts)) (bor (car reftex-index-restriction-data)) @@ -733,9 +726,9 @@ SPC=view TAB=goto RET=goto+hide [e]dit [q]uit [r]escan [f]ollow [?]Help (if reftex-index-follow-mode (setq reftex-index-follow-mode 1))) -(defun reftex-index-next (&optional arg) +(defun reftex-index-next (&optional _arg) "Move to next selectable item." - (interactive "p") + (interactive "^") (setq reftex-callback-fwd t) (or (eobp) (forward-char 1)) (goto-char (or (next-single-property-change (point) :data) @@ -743,9 +736,9 @@ SPC=view TAB=goto RET=goto+hide [e]dit [q]uit [r]escan [f]ollow [?]Help (unless (get-text-property (point) :data) (goto-char (or (next-single-property-change (point) :data) (point))))) -(defun reftex-index-previous (&optional arg) +(defun reftex-index-previous (&optional _arg) "Move to previous selectable item." - (interactive "p") + (interactive "^") (setq reftex-callback-fwd nil) (goto-char (or (previous-single-property-change (point) :data) (point))) @@ -793,7 +786,7 @@ Label context is only displayed when the labels are there as well." (or (one-window-p) (delete-window)) (switch-to-buffer (marker-buffer reftex-index-return-marker)) (goto-char (or (marker-position reftex-index-return-marker) (point)))) -(defun reftex-index-goto-toc (&rest ignore) +(defun reftex-index-goto-toc (&rest _ignore) "Switch to the table of contents of the current document. The function will go to the section where the entry at point was defined." (interactive) @@ -802,7 +795,7 @@ The function will go to the section where the entry at point was defined." (switch-to-buffer (marker-buffer reftex-index-return-marker))) (delete-other-windows) (reftex-toc)) -(defun reftex-index-rescan (&rest ignore) +(defun reftex-index-rescan (&rest _ignore) "Regenerate the *Index* buffer after reparsing file of section at point." (interactive) (let ((index-tag reftex-index-tag)) @@ -818,7 +811,7 @@ The function will go to the section where the entry at point was defined." (reftex-display-index index-tag nil 'redo line))) (reftex-index-Rescan)) (reftex-kill-temporary-buffers))) -(defun reftex-index-Rescan (&rest ignore) +(defun reftex-index-Rescan (&rest _ignore) "Regenerate the *Index* buffer after reparsing the entire document." (interactive) (let ((index-tag reftex-index-tag) @@ -827,7 +820,7 @@ The function will go to the section where the entry at point was defined." (reftex-get-file-buffer-force reftex-last-index-file)) (setq current-prefix-arg '(16)) (reftex-display-index index-tag nil 'redo line))) -(defun reftex-index-revert (&rest ignore) +(defun reftex-index-revert (&rest _ignore) "Regenerate the *Index* from the internal lists. No reparsing os done." (interactive) (let ((buf (current-buffer)) @@ -840,7 +833,7 @@ The function will go to the section where the entry at point was defined." (setq current-prefix-arg nil reftex-last-follow-point 1) (reftex-display-index index-tag nil 'redo data line))) -(defun reftex-index-switch-index-tag (&rest ignore) +(defun reftex-index-switch-index-tag (&rest _ignore) "Switch to a different index of the same document." (interactive) (switch-to-buffer @@ -865,14 +858,14 @@ The function will go to the section where the entry at point was defined." reftex-index-restriction-indicator (nth 6 bor) ))) (reftex-index-revert)) -(defun reftex-index-widen (&rest ignore) +(defun reftex-index-widen (&rest _ignore) "Show the unrestricted index (all entries)." (interactive) (setq reftex-index-restriction-indicator nil reftex-index-restriction-data nil) (reftex-index-revert) (message "Index widened")) -(defun reftex-index-restriction-forward (&rest ignore) +(defun reftex-index-restriction-forward (&rest _ignore) "Restrict to previous section. When index is currently unrestricted, restrict it to a section. When index is restricted, select the next section as restriction criterion." @@ -888,7 +881,7 @@ When index is restricted, select the next section as restriction criterion." (car (memq (assq 'toc (cdr (memq bor docstruct))) docstruct)))) (reftex-index-revert)))) -(defun reftex-index-restriction-backward (&rest ignore) +(defun reftex-index-restriction-backward (&rest _ignore) "Restrict to next section. When index is currently unrestricted, restrict it to a section. When index is restricted, select the previous section as restriction criterion." @@ -986,7 +979,7 @@ When index is restricted, select the previous section as restriction criterion." (setq analyze (reftex-index-analyze-entry data) attr (nth 2 analyze)) (setf (nth 2 analyze) (if (string= attr bor) "" bor)) - (setq new (apply 'concat analyze)) + (setq new (apply #'concat analyze)) (reftex-index-change-entry new (if (string= (nth 2 analyze) bor) "Entry is now START-OF-PAGE-RANGE" @@ -1002,7 +995,7 @@ When index is restricted, select the previous section as restriction criterion." (setq analyze (reftex-index-analyze-entry data) attr (nth 2 analyze)) (setf (nth 2 analyze) (if (string= attr eor) "" eor)) - (setq new (apply 'concat analyze)) + (setq new (apply #'concat analyze)) (reftex-index-change-entry new (if (string= (nth 2 analyze) eor) "Entry is now END-OF-PAGE-RANGE" @@ -1043,7 +1036,7 @@ When index is restricted, select the previous section as restriction criterion." (error "Invalid value") (setf (nth n analyze) npart))) (t (setf (nth n analyze) (concat initial npart)))) - (setq new (apply 'concat analyze)) + (setq new (apply #'concat analyze)) ;; Change the entry and insert the changed version into the index. (reftex-index-change-entry new (if (string= npart "") @@ -1180,27 +1173,50 @@ This gets refreshed in every phrases command.") (defvar reftex-index-phrases-files nil "List of document files relevant for the phrases file.") -(defvar reftex-index-phrases-font-lock-keywords nil - "Font lock keywords for reftex-index-phrases-mode.") -(defvar reftex-index-phrases-font-lock-defaults nil - "Font lock defaults for reftex-index-phrases-mode.") +(defvar reftex-index-phrases-font-lock-keywords + (list + (cons reftex-index-phrases-comment-regexp 'font-lock-comment-face) + (list reftex-index-phrases-macrodef-regexp + '(1 font-lock-type-face) + '(2 font-lock-keyword-face) + '(3 'secondary-selection) + '(4 font-lock-function-name-face) + '(5 'secondary-selection) + '(6 font-lock-string-face)) + (list reftex-index-phrases-phrase-regexp1 + '(1 font-lock-keyword-face) + '(2 'secondary-selection) + '(3 font-lock-string-face) + '(4 'secondary-selection)) + (list reftex-index-phrases-phrase-regexp2 + '(1 font-lock-keyword-face) + '(2 'secondary-selection) + '(3 font-lock-string-face) + '(4 'secondary-selection) + '(5 font-lock-function-name-face)) + '("^\t$" . 'secondary-selection)) + "Font lock keywords for `reftex-index-phrases-mode'.") +(defvar reftex-index-phrases-font-lock-defaults + '((reftex-index-phrases-font-lock-keywords) + nil t nil beginning-of-line) + "Font lock defaults for `reftex-index-phrases-mode'.") (define-obsolete-variable-alias 'reftex-index-phrases-map 'reftex-index-phrases-mode-map "24.1") (defvar reftex-index-phrases-mode-map (let ((map (make-sparse-keymap))) ;; Keybindings and Menu for phrases buffer - (define-key map "\C-c\C-c" 'reftex-index-phrases-save-and-return) - (define-key map "\C-c\C-x" 'reftex-index-this-phrase) - (define-key map "\C-c\C-f" 'reftex-index-next-phrase) - (define-key map "\C-c\C-r" 'reftex-index-region-phrases) - (define-key map "\C-c\C-a" 'reftex-index-all-phrases) - (define-key map "\C-c\C-d" 'reftex-index-remaining-phrases) - (define-key map "\C-c\C-s" 'reftex-index-sort-phrases) - (define-key map "\C-c\C-n" 'reftex-index-new-phrase) - (define-key map "\C-c\C-m" 'reftex-index-phrases-set-macro-key) - (define-key map "\C-c\C-i" 'reftex-index-phrases-info) - (define-key map "\C-c\C-t" 'reftex-index-find-next-conflict-phrase) - (define-key map "\C-i" 'self-insert-command) + (define-key map "\C-c\C-c" #'reftex-index-phrases-save-and-return) + (define-key map "\C-c\C-x" #'reftex-index-this-phrase) + (define-key map "\C-c\C-f" #'reftex-index-next-phrase) + (define-key map "\C-c\C-r" #'reftex-index-region-phrases) + (define-key map "\C-c\C-a" #'reftex-index-all-phrases) + (define-key map "\C-c\C-d" #'reftex-index-remaining-phrases) + (define-key map "\C-c\C-s" #'reftex-index-sort-phrases) + (define-key map "\C-c\C-n" #'reftex-index-new-phrase) + (define-key map "\C-c\C-m" #'reftex-index-phrases-set-macro-key) + (define-key map "\C-c\C-i" #'reftex-index-phrases-info) + (define-key map "\C-c\C-t" #'reftex-index-find-next-conflict-phrase) + (define-key map "\C-i" #'self-insert-command) (easy-menu-define reftex-index-phrases-menu map "Menu for Phrases buffer" @@ -1295,7 +1311,7 @@ If the buffer is non-empty, delete the old header first." reftex-key-to-index-macro-alist))) (macro-alist (sort (copy-sequence reftex-index-macro-alist) - (lambda (a b) (equal (car a) default-macro)))) + (lambda (a _b) (equal (car a) default-macro)))) macro entry key repeat) (if master (set (make-local-variable 'TeX-master) @@ -1311,9 +1327,7 @@ If the buffer is non-empty, delete the old header first." (beginning-of-line 2)) (while (looking-at "^[ \t]*$") (beginning-of-line 2)) - (if (featurep 'xemacs) - (zmacs-activate-region) - (setq mark-active t)) + (activate-mark) (if (yes-or-no-p "Delete and rebuild header? ") (delete-region (point-min) (point)))) @@ -1336,7 +1350,6 @@ If the buffer is non-empty, delete the old header first." (if repeat "t" "nil")))) (insert "%---------------------------------------------------------------------\n\n\n"))) -(defvar TeX-master) (defun reftex-index-phrase-tex-master (&optional dir) "Return the name of the master file associated with a phrase buffer." (if (and (boundp 'TeX-master) @@ -1387,41 +1400,8 @@ Here are all local bindings. :syntax-table reftex-index-phrases-syntax-table (set (make-local-variable 'font-lock-defaults) reftex-index-phrases-font-lock-defaults) - (when (featurep 'xemacs) - (easy-menu-add reftex-index-phrases-menu reftex-index-phrases-mode-map)) (set (make-local-variable 'reftex-index-phrases-marker) (make-marker))) -;; (add-hook 'reftex-index-phrases-mode-hook 'turn-on-font-lock) - -;; Font Locking stuff -(let ((ss (if (featurep 'xemacs) 'secondary-selection ''secondary-selection))) - (setq reftex-index-phrases-font-lock-keywords - (list - (cons reftex-index-phrases-comment-regexp 'font-lock-comment-face) - (list reftex-index-phrases-macrodef-regexp - '(1 font-lock-type-face) - '(2 font-lock-keyword-face) - (list 3 ss) - '(4 font-lock-function-name-face) - (list 5 ss) - '(6 font-lock-string-face)) - (list reftex-index-phrases-phrase-regexp1 - '(1 font-lock-keyword-face) - (list 2 ss) - '(3 font-lock-string-face) - (list 4 ss)) - (list reftex-index-phrases-phrase-regexp2 - '(1 font-lock-keyword-face) - (list 2 ss) - '(3 font-lock-string-face) - (list 4 ss) - '(5 font-lock-function-name-face)) - (cons "^\t$" ss))) - (setq reftex-index-phrases-font-lock-defaults - '((reftex-index-phrases-font-lock-keywords) - nil t nil beginning-of-line)) - (put 'reftex-index-phrases-mode 'font-lock-defaults - reftex-index-phrases-font-lock-defaults) ; XEmacs - ) +;; (add-hook 'reftex-index-phrases-mode-hook #'turn-on-font-lock) (defun reftex-index-next-phrase (&optional arg) "Index the next ARG phrases in the phrases buffer." @@ -1561,9 +1541,7 @@ index the new part without having to go over the unchanged parts again." (unwind-protect (progn ;; Hide the region highlighting - (if (featurep 'xemacs) - (zmacs-deactivate-region) - (deactivate-mark)) + (deactivate-mark) (delete-other-windows) (reftex-index-visit-phrases-buffer) (reftex-index-all-phrases)) @@ -1593,7 +1571,7 @@ index the new part without having to go over the unchanged parts again." (if (and text (stringp text)) (insert text))) -(defun reftex-index-find-next-conflict-phrase (&optional arg) +(defun reftex-index-find-next-conflict-phrase (&optional _arg) "Find the next a phrase which is has conflicts in the phrase buffer. The command helps to find possible conflicts in the phrase indexing process. It searches downward from point for a phrase which is repeated elsewhere @@ -1601,7 +1579,7 @@ in the buffer, or which is a subphrase of another phrase. If such a phrase is found, the phrase info is displayed. To check the whole buffer, start at the beginning and continue by calling this function repeatedly." - (interactive "P") + (interactive) (if (catch 'exit (while (re-search-forward reftex-index-phrases-phrase-regexp12 nil t) (goto-char (match-beginning 3)) @@ -1743,6 +1721,8 @@ information about the currently selected macro." (if repeat "with" "without"))) (error "Abort"))))) +(defvar reftex--chars-first) + (defun reftex-index-sort-phrases (&optional chars-first) "Sort the phrases lines in the buffer alphabetically. Normally, this looks only at the phrases. With a prefix arg CHARS-FIRST, @@ -1762,19 +1742,18 @@ it first compares the macro identifying chars and then the phrases." (if end (setq end (progn (goto-char end) (end-of-line) (point)))) ;; Take the lines, sort them and re-insert. (if (and beg end) - (progn + (let ((reftex--chars-first chars-first)) (message "Sorting lines...") (let* ((lines (split-string (buffer-substring beg end) "\n")) - (lines1 (sort lines 'reftex-compare-phrase-lines))) + (lines1 (sort lines #'reftex-compare-phrase-lines))) (message "Sorting lines...done") (let ((inhibit-quit t)) ;; make sure we do not lose lines (delete-region beg end) - (insert (mapconcat 'identity lines1 "\n")))) + (insert (mapconcat #'identity lines1 "\n")))) (goto-char (point-max)) (re-search-backward (concat "^" (regexp-quote line) "$") nil t)) (error "Cannot find phrases lines to sort")))) -(defvar chars-first) (defun reftex-compare-phrase-lines (a b) "The comparison function used for sorting." (let (ca cb pa pb c-p p-p) @@ -1798,7 +1777,7 @@ it first compares the macro identifying chars and then the phrases." p-p (string< pa pb)) ;; Do the right comparison, based on the value of `chars-first' ;; `chars-first' is bound locally in the calling function - (if chars-first + (if reftex--chars-first (if (string= ca cb) p-p c-p) (if (string= pa pb) c-p p-p))))) ;; If line a does not match, the answer we return determines @@ -1830,14 +1809,14 @@ With optional arg ALLOW-NEWLINE, allow single newline between words." (defun reftex-index-simplify-phrase (phrase) "Make phrase single spaces and single line." - (mapconcat 'identity (split-string phrase) " ")) + (mapconcat #'identity (split-string phrase) " ")) (defun reftex-index-phrases-find-dup-re (phrase &optional sub) "Return a regexp which matches variations of PHRASE (with additional space). When SUB ins non-nil, the regexp will also match when PHRASE is a subphrase of another phrase. The regexp works lonly in the phrase buffer." (concat (if sub "^\\S-?\t\\([^\t\n]*" "^\\S-?\t") - (mapconcat 'regexp-quote (split-string phrase) " +") + (mapconcat #'regexp-quote (split-string phrase) " +") (if sub "[^\t\n]*\\)\\([\t\n]\\|$\\)" " *\\([\t\n]\\|$\\)"))) (defun reftex-index-make-replace-string (macro-fmt match index-key @@ -1870,7 +1849,7 @@ Treats the logical `and' for index phrases." (unless (stringp reftex-index-phrases-restrict-file) (widen)) (goto-char (point-min)) - (apply 'reftex-query-index-phrase args)))))) + (apply #'reftex-query-index-phrase args)))))) (reftex-unhighlight 0) (set-window-configuration win-conf)))) diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el index 98c61f56b48..0157f8443aa 100644 --- a/lisp/textmodes/reftex-parse.el +++ b/lisp/textmodes/reftex-parse.el @@ -1,4 +1,4 @@ -;;; reftex-parse.el --- parser functions for RefTeX +;;; reftex-parse.el --- parser functions for RefTeX -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. @@ -143,7 +143,7 @@ When allowed, do only a partial scan from FILE." (car (push (list 'is-multi is-multi) docstruct))))) (setcdr entry (cons is-multi nil))) (and reftex--index-tags - (setq reftex--index-tags (sort reftex--index-tags 'string<))) + (setq reftex--index-tags (sort reftex--index-tags #'string<))) (let ((index-tag-cell (assq 'index-tags docstruct))) (if index-tag-cell (setcdr index-tag-cell reftex--index-tags) @@ -160,10 +160,10 @@ When allowed, do only a partial scan from FILE." nil)) allxr)) (alist (delq nil alist)) - (allprefix (delq nil (mapcar 'car alist))) + (allprefix (delq nil (mapcar #'car alist))) (regexp (if allprefix (concat "\\`\\(" - (mapconcat 'identity allprefix "\\|") + (mapconcat #'identity allprefix "\\|") "\\)") "\\\\\\\\\\\\"))) ; this will never match (push (list 'xr alist regexp) docstruct))) @@ -209,7 +209,7 @@ of master file." (catch 'exit (setq file-found (reftex-locate-file file "tex" master-dir)) (if (and (not file-found) - (setq buf (reftex-get-buffer-visiting file))) + (setq buf (find-buffer-visiting file))) (setq file-found (buffer-file-name buf))) (unless file-found @@ -384,8 +384,9 @@ of master file." (concat ;; "\\(\\`\\|[\n\r]\\)[^%]*\\\\\\(" "\\(^\\)[^%\n\r]*\\\\\\(" - (mapconcat 'identity reftex-bibliography-commands "\\|") - "\\)\\(\\[.+?\\]\\)?{[ \t]*\\([^}]+\\)") nil t)) + (mapconcat #'identity reftex-bibliography-commands "\\|") + "\\)\\(\\[.+?\\]\\)?{[ \t]*\\([^}]+\\)") + nil t)) (setq files (append files (split-string (reftex-match-string 4) @@ -532,7 +533,7 @@ Careful: This function expects the match-data to be still in place!" (key (if prefix (concat prefix rawkey) rawkey)) (sortkey (downcase key)) - (showkey (mapconcat 'identity + (showkey (mapconcat #'identity (split-string key reftex-index-level-re) " ! "))) (goto-char end-of-args) diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el index 439c02f8089..611102ecbac 100644 --- a/lisp/textmodes/reftex-ref.el +++ b/lisp/textmodes/reftex-ref.el @@ -1,4 +1,4 @@ -;;; reftex-ref.el --- code to create labels and references with RefTeX +;;; reftex-ref.el --- code to create labels and references with RefTeX -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. @@ -84,10 +84,12 @@ If optional BOUND is an integer, limit backward searches to that point." (if (or (re-search-forward (format reftex-find-label-regexp-format - (regexp-quote label)) nil t) + (regexp-quote label)) + nil t) (re-search-forward (format reftex-find-label-regexp-format2 - (regexp-quote label)) nil t)) + (regexp-quote label)) + nil t)) (progn (backward-char 1) @@ -248,13 +250,13 @@ This function is controlled by the settings of reftex-insert-label-flags." "" "POSITION UNCERTAIN. RESCAN TO FIX.")) (file (buffer-file-name)) - (text nil) + ;; (text nil) (tail (memq here-I-am (symbol-value reftex-docstruct-symbol)))) (or (cdr here-I-am-info) (setq rescan-is-useful t)) (when tail - (push (list label typekey text file nil note) (cdr tail)) + (push (list label typekey nil file nil note) (cdr tail)) (put reftex-docstruct-symbol 'modified t))) ;; Insert the label into the buffer @@ -286,7 +288,7 @@ also applies `reftex-translate-to-ascii-function' to the string." (when (and reftex-translate-to-ascii-function (fboundp reftex-translate-to-ascii-function)) (setq string (funcall reftex-translate-to-ascii-function string))) - (apply 'reftex-convert-string string + (apply #'reftex-convert-string string "[-~ \t\n\r,;]+" reftex-label-illegal-re nil nil reftex-derive-label-parameters)) @@ -402,6 +404,8 @@ also applies `reftex-translate-to-ascii-function' to the string." a / A Put all marked entries into one/many \\ref commands. q / RET Quit without referencing / Accept current label (also on mouse-2).") +(defvar reftex-refstyle) + ;;;###autoload (defun reftex-reference (&optional type no-insert cut) "Make a LaTeX reference. Look only for labels of a certain TYPE. @@ -473,7 +477,7 @@ When called with 2 C-u prefix args, disable magic word recognition." ;; If the first entry is the symbol 'concat, concat all labels. ;; We keep the cdr of the first label for typekey etc information. (if (eq (car labels) 'concat) - (setq labels (list (list (mapconcat 'car (cdr labels) ",") + (setq labels (list (list (mapconcat #'car (cdr labels) ",") (cdr (nth 1 labels)))))) (setq type (nth 1 (car labels)) form (or (cdr (assoc type reftex-typekey-to-format-alist)) @@ -502,7 +506,7 @@ When called with 2 C-u prefix args, disable magic word recognition." (setq form (substring form 1))) ;; do we have a special format? (unless (string= reftex-refstyle "\\ref") - (setq reftex-format-ref-function 'reftex-format-special)) + (setq reftex-format-ref-function #'reftex-format-special)) ;; ok, insert the reference (if sep1 (insert sep1)) (insert @@ -744,7 +748,7 @@ When called with 2 C-u prefix args, disable magic word recognition." ;; Goto the file in another window (setq buffer (if no-revisit - (reftex-get-buffer-visiting file) + (find-buffer-visiting file) (reftex-get-file-buffer-force file (not reftex-keep-temporary-buffers)))) (if buffer @@ -826,14 +830,16 @@ When called with 2 C-u prefix args, disable magic word recognition." (dolist (item (nth 2 elt)) (let ((macro (car item)) (package (nth 1 elt))) - (eval `(defun ,(intern (format "reftex-%s-%s" package - (substring macro 1 (length macro)))) () - ,(format "Insert a reference using the `%s' macro from the %s \ + (defalias (intern (format "reftex-%s-%s" package + (substring macro 1 (length macro)))) + (lambda () + (:documentation + (format "Insert a reference using the `%s' macro from the %s \ package.\n\nThis is a generated function." - macro package) - (interactive) - (let ((reftex-refstyle ,macro)) - (reftex-reference)))))))) + macro package)) + (interactive) + (let ((reftex-refstyle macro)) + (reftex-reference)))))))) (defun reftex-format-special (label fmt refstyle) "Apply selected reference style to format FMT and add LABEL. diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el index d2e9974499b..b0a8ebf8ac0 100644 --- a/lisp/textmodes/reftex-sel.el +++ b/lisp/textmodes/reftex-sel.el @@ -1,4 +1,4 @@ -;;; reftex-sel.el --- the selection modes for RefTeX +;;; reftex-sel.el --- the selection modes for RefTeX -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. @@ -34,31 +34,29 @@ (let ((map (make-sparse-keymap))) (set-keymap-parent map special-mode-map) (substitute-key-definition - 'next-line 'reftex-select-next map global-map) + #'next-line #'reftex-select-next map global-map) (substitute-key-definition - 'previous-line 'reftex-select-previous map global-map) + #'previous-line #'reftex-select-previous map global-map) (substitute-key-definition - 'keyboard-quit 'reftex-select-keyboard-quit map global-map) + #'keyboard-quit #'reftex-select-keyboard-quit map global-map) (substitute-key-definition - 'newline 'reftex-select-accept map global-map) - - (define-key map " " 'reftex-select-callback) - (define-key map "n" 'reftex-select-next) - (define-key map [(down)] 'reftex-select-next) - (define-key map "p" 'reftex-select-previous) - (define-key map [(up)] 'reftex-select-previous) - (define-key map "f" 'reftex-select-toggle-follow) - (define-key map "\C-m" 'reftex-select-accept) - (define-key map [(return)] 'reftex-select-accept) - (define-key map "q" 'reftex-select-quit) - (define-key map "." 'reftex-select-show-insertion-point) - (define-key map "?" 'reftex-select-help) + #'newline #'reftex-select-accept map global-map) + + (define-key map " " #'reftex-select-callback) + (define-key map "n" #'reftex-select-next) + (define-key map [(down)] #'reftex-select-next) + (define-key map "p" #'reftex-select-previous) + (define-key map [(up)] #'reftex-select-previous) + (define-key map "f" #'reftex-select-toggle-follow) + (define-key map "\C-m" #'reftex-select-accept) + (define-key map [(return)] #'reftex-select-accept) + (define-key map "q" #'reftex-select-quit) + (define-key map "." #'reftex-select-show-insertion-point) + (define-key map "?" #'reftex-select-help) ;; The mouse-2 binding - (if (featurep 'xemacs) - (define-key map [(button2)] 'reftex-select-mouse-accept) - (define-key map [(mouse-2)] 'reftex-select-mouse-accept) - (define-key map [follow-link] 'mouse-face)) + (define-key map [(mouse-2)] #'reftex-select-mouse-accept) + (define-key map [follow-link] 'mouse-face) map)) (define-obsolete-variable-alias @@ -67,25 +65,26 @@ (let ((map (make-sparse-keymap))) (set-keymap-parent map reftex-select-shared-map) - (cl-loop for key across "aAcgFlrRstx#%" do - (define-key map (vector (list key)) - (list 'lambda '() - "Press `?' during selection to find out about this key." - '(interactive) (list 'throw '(quote myexit) key)))) - - (define-key map "b" 'reftex-select-jump-to-previous) - (define-key map "z" 'reftex-select-jump) - (define-key map "v" 'reftex-select-cycle-ref-style-forward) - (define-key map "V" 'reftex-select-cycle-ref-style-backward) - (define-key map "m" 'reftex-select-mark) - (define-key map "u" 'reftex-select-unmark) - (define-key map "," 'reftex-select-mark-comma) - (define-key map "-" 'reftex-select-mark-to) - (define-key map "+" 'reftex-select-mark-and) - (define-key map [(tab)] 'reftex-select-read-label) - (define-key map "\C-i" 'reftex-select-read-label) - (define-key map "\C-c\C-n" 'reftex-select-next-heading) - (define-key map "\C-c\C-p" 'reftex-select-previous-heading) + (mapc (lambda (key) + (define-key map (vector (list key)) + (lambda () + "Press `?' during selection to find out about this key." + (interactive) (throw 'myexit key)))) + "aAcgFlrRstx#%") + + (define-key map "b" #'reftex-select-jump-to-previous) + (define-key map "z" #'reftex-select-jump) + (define-key map "v" #'reftex-select-cycle-ref-style-forward) + (define-key map "V" #'reftex-select-cycle-ref-style-backward) + (define-key map "m" #'reftex-select-mark) + (define-key map "u" #'reftex-select-unmark) + (define-key map "," #'reftex-select-mark-comma) + (define-key map "-" #'reftex-select-mark-to) + (define-key map "+" #'reftex-select-mark-and) + (define-key map [(tab)] #'reftex-select-read-label) + (define-key map "\C-i" #'reftex-select-read-label) + (define-key map "\C-c\C-n" #'reftex-select-next-heading) + (define-key map "\C-c\C-p" #'reftex-select-previous-heading) map) "Keymap used for *RefTeX Select* buffer, when selecting a label. @@ -104,10 +103,6 @@ Press `?' for a summary of important key bindings. During a selection process, these are the local bindings. \\{reftex-select-label-mode-map}" - (when (featurep 'xemacs) - ;; XEmacs needs the call to make-local-hook - (make-local-hook 'pre-command-hook) - (make-local-hook 'post-command-hook)) (set (make-local-variable 'reftex-select-marked) nil) (when (syntax-table-p reftex-latex-syntax-table) (set-syntax-table reftex-latex-syntax-table)) @@ -120,16 +115,17 @@ During a selection process, these are the local bindings. (let ((map (make-sparse-keymap))) (set-keymap-parent map reftex-select-shared-map) - (cl-loop for key across "grRaAeE" do - (define-key map (vector (list key)) - (list 'lambda '() - "Press `?' during selection to find out about this key." - '(interactive) (list 'throw '(quote myexit) key)))) + (mapc (lambda (key) + (define-key map (vector (list key)) + (lambda () + "Press `?' during selection to find out about this key." + (interactive) (throw 'myexit key)))) + "grRaAeE") - (define-key map "\C-i" 'reftex-select-read-cite) - (define-key map [(tab)] 'reftex-select-read-cite) - (define-key map "m" 'reftex-select-mark) - (define-key map "u" 'reftex-select-unmark) + (define-key map "\C-i" #'reftex-select-read-cite) + (define-key map [(tab)] #'reftex-select-read-cite) + (define-key map "m" #'reftex-select-mark) + (define-key map "u" #'reftex-select-unmark) map) "Keymap used for *RefTeX Select* buffer, when selecting a BibTeX entry. @@ -148,10 +144,6 @@ Press `?' for a summary of important key bindings. During a selection process, these are the local bindings. \\{reftex-select-label-mode-map}" - (when (featurep 'xemacs) - ;; XEmacs needs the call to make-local-hook - (make-local-hook 'pre-command-hook) - (make-local-hook 'post-command-hook)) (set (make-local-variable 'reftex-select-marked) nil) ;; We do not set a local map - reftex-select-item does this. ) @@ -432,12 +424,21 @@ During a selection process, these are the local bindings. (defvar reftex-last-data nil) (defvar reftex-last-line nil) (defvar reftex-select-marked nil) +(defvar reftex-refstyle) + +;; The following variables are all bound dynamically in `reftex-select-item'. + +(defvar reftex-select-data) +(defvar reftex-select-prompt) +(defvar reftex--cb-flag) +(defvar reftex--last-data) +(defvar reftex--call-back) +(defvar reftex--help-string) ;;;###autoload -(defun reftex-select-item (reftex-select-prompt help-string keymap - &optional offset - call-back cb-flag) - ;; Select an item, using REFTEX-SELECT-PROMPT. +(defun reftex-select-item ( prompt help-string keymap + &optional offset call-back cb-flag) + ;; Select an item, using PROMPT. ;; The function returns a key indicating an exit status, along with a ;; data structure indicating which item was selected. ;; HELP-STRING contains help. KEYMAP is a keymap with the available @@ -448,7 +449,12 @@ During a selection process, these are the local bindings. ;; When CALL-BACK is given, it is a function which is called with the index ;; of the element. ;; CB-FLAG is the initial value of that flag. - (let (ev reftex-select-data last-data (selection-buffer (current-buffer))) + (let ((reftex-select-prompt prompt) + (reftex--help-string help-string) + (reftex--call-back call-back) + (reftex--cb-flag cb-flag) + ev reftex-select-data reftex--last-data + (selection-buffer (current-buffer))) (setq reftex-select-marked nil) @@ -466,43 +472,29 @@ During a selection process, these are the local bindings. (unwind-protect (progn (use-local-map keymap) - (add-hook 'pre-command-hook 'reftex-select-pre-command-hook nil t) - (add-hook 'post-command-hook 'reftex-select-post-command-hook nil t) + (add-hook 'pre-command-hook #'reftex-select-pre-command-hook nil t) + (add-hook 'post-command-hook #'reftex-select-post-command-hook nil t) (princ reftex-select-prompt) (set-marker reftex-recursive-edit-marker (point)) - ;; XEmacs does not run post-command-hook here - (and (featurep 'xemacs) (run-hooks 'post-command-hook)) (recursive-edit)) (set-marker reftex-recursive-edit-marker nil) (with-current-buffer selection-buffer (use-local-map nil) - (remove-hook 'pre-command-hook 'reftex-select-pre-command-hook t) + (remove-hook 'pre-command-hook #'reftex-select-pre-command-hook t) (remove-hook 'post-command-hook - 'reftex-select-post-command-hook t)) + #'reftex-select-post-command-hook t)) ;; Kill the mark overlays - (mapc (lambda (c) (reftex-delete-overlay (nth 1 c))) + (mapc (lambda (c) (delete-overlay (nth 1 c))) reftex-select-marked))))) (set (make-local-variable 'reftex-last-line) (+ (count-lines (point-min) (point)) (if (bolp) 1 0))) - (set (make-local-variable 'reftex-last-data) last-data) + (set (make-local-variable 'reftex-last-data) reftex--last-data) (reftex-kill-buffer "*RefTeX Help*") (setq reftex-callback-fwd (not reftex-callback-fwd)) ;; ;-))) (message "") - (list ev reftex-select-data last-data))) - -;; The following variables are all bound dynamically in `reftex-select-item'. -;; The defvars are here only to silence the byte compiler. - -(defvar found-list) -(defvar cb-flag) -(defvar reftex-select-data) -(defvar reftex-select-prompt) -(defvar last-data) -(defvar call-back) -(defvar help-string) -(defvar reftex-refstyle) + (list ev reftex-select-data reftex--last-data))) ;; The selection commands @@ -513,12 +505,12 @@ During a selection process, these are the local bindings. (defun reftex-select-post-command-hook () (let (b e) (setq reftex-select-data (get-text-property (point) :data)) - (setq last-data (or reftex-select-data last-data)) + (setq reftex--last-data (or reftex-select-data reftex--last-data)) - (when (and reftex-select-data cb-flag + (when (and reftex-select-data reftex--cb-flag (not (equal reftex-last-follow-point (point)))) (setq reftex-last-follow-point (point)) - (funcall call-back reftex-select-data reftex-callback-fwd + (funcall reftex--call-back reftex-select-data reftex-callback-fwd (not reftex-revisit-to-follow))) (if reftex-select-data (setq b (or (previous-single-property-change @@ -594,7 +586,7 @@ Useful for large TOC's." "Toggle follow mode: Other window follows with full context." (interactive) (setq reftex-last-follow-point -1) - (setq cb-flag (not cb-flag))) + (setq reftex--cb-flag (not reftex--cb-flag))) (defun reftex-select-cycle-ref-style-internal (&optional reverse) "Cycle through macros used for referencing. @@ -632,7 +624,9 @@ Cycle in reverse order if optional argument REVERSE is non-nil." (defun reftex-select-callback () "Show full context in another window." (interactive) - (if reftex-select-data (funcall call-back reftex-select-data reftex-callback-fwd nil) (ding))) + (if reftex-select-data + (funcall reftex--call-back reftex-select-data reftex-callback-fwd nil) + (ding))) (defun reftex-select-accept () "Accept the currently selected item." (interactive) @@ -642,7 +636,7 @@ Cycle in reverse order if optional argument REVERSE is non-nil." (interactive "e") (mouse-set-point ev) (setq reftex-select-data (get-text-property (point) :data)) - (setq last-data (or reftex-select-data last-data)) + (setq reftex--last-data (or reftex-select-data reftex--last-data)) (throw 'myexit 'return)) (defun reftex-select-read-label () "Use minibuffer to read a label to reference, with completion." @@ -652,16 +646,19 @@ Cycle in reverse order if optional argument REVERSE is non-nil." nil nil reftex-prefix))) (unless (or (equal label "") (equal label reftex-prefix)) (throw 'myexit label)))) + +(defvar reftex--found-list) + (defun reftex-select-read-cite () "Use minibuffer to read a citation key with completion." (interactive) - (let* ((key (completing-read "Citation key: " found-list)) - (entry (assoc key found-list))) + (let* ((key (completing-read "Citation key: " reftex--found-list)) + (entry (assoc key reftex--found-list))) (cond ((or (null key) (equal key ""))) (entry (setq reftex-select-data entry) - (setq last-data reftex-select-data) + (setq reftex--last-data reftex-select-data) (throw 'myexit 'return)) (t (throw 'myexit key))))) @@ -676,14 +673,14 @@ Cycle in reverse order if optional argument REVERSE is non-nil." (setq boe (or (previous-single-property-change (1+ (point)) :data) (point-min)) eoe (or (next-single-property-change (point) :data) (point-max))) - (setq ovl (reftex-make-overlay boe eoe)) + (setq ovl (make-overlay boe eoe)) (push (list data ovl separator) reftex-select-marked) - (reftex-overlay-put ovl 'font-lock-face reftex-select-mark-face) - (reftex-overlay-put ovl 'before-string - (if separator - (format "*%c%d* " separator - (length reftex-select-marked)) - (format "*%d* " (length reftex-select-marked)))) + (overlay-put ovl 'font-lock-face reftex-select-mark-face) + (overlay-put ovl 'before-string + (if separator + (format "*%c%d* " separator + (length reftex-select-marked)) + (format "*%d* " (length reftex-select-marked)))) (message "Entry has mark no. %d" (length reftex-select-marked)))) (defun reftex-select-mark-comma () @@ -709,15 +706,15 @@ Cycle in reverse order if optional argument REVERSE is non-nil." sep) (unless cell (error "No marked entry at point")) - (and ovl (reftex-delete-overlay ovl)) + (and ovl (delete-overlay ovl)) (setq reftex-select-marked (delq cell reftex-select-marked)) (setq cnt (1+ (length reftex-select-marked))) (mapc (lambda (c) (setq sep (nth 2 c)) - (reftex-overlay-put (nth 1 c) 'before-string - (if sep - (format "*%c%d* " sep (cl-decf cnt)) - (format "*%d* " (cl-decf cnt))))) + (overlay-put (nth 1 c) 'before-string + (if sep + (format "*%c%d* " sep (cl-decf cnt)) + (format "*%d* " (cl-decf cnt))))) reftex-select-marked) (message "Entry no longer marked"))) @@ -725,7 +722,7 @@ Cycle in reverse order if optional argument REVERSE is non-nil." "Display a summary of the special key bindings." (interactive) (with-output-to-temp-buffer "*RefTeX Help*" - (princ help-string)) + (princ reftex--help-string)) (reftex-enlarge-to-fit "*RefTeX Help*" t)) (provide 'reftex-sel) diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index 3b9f970a3d2..b5643491338 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el @@ -1,4 +1,4 @@ -;;; reftex-toc.el --- RefTeX's table of contents mode +;;; reftex-toc.el --- RefTeX's table of contents mode -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2000, 2003-2021 Free Software Foundation, Inc. @@ -32,8 +32,7 @@ (defvar reftex-toc-mode-map (let ((map (make-sparse-keymap))) - (define-key map (if (featurep 'xemacs) [(button2)] [(mouse-2)]) - 'reftex-toc-mouse-goto-line-and-hide) + (define-key map [(mouse-2)] #'reftex-toc-mouse-goto-line-and-hide) (define-key map [follow-link] 'mouse-face) (substitute-key-definition @@ -41,34 +40,34 @@ (substitute-key-definition 'previous-line 'reftex-toc-previous map global-map) - (define-key map "n" 'reftex-toc-next) - (define-key map "p" 'reftex-toc-previous) - (define-key map "?" 'reftex-toc-show-help) - (define-key map " " 'reftex-toc-view-line) - (define-key map "\C-m" 'reftex-toc-goto-line-and-hide) - (define-key map "\C-i" 'reftex-toc-goto-line) - (define-key map "\C-c>" 'reftex-toc-display-index) - (define-key map "r" 'reftex-toc-rescan) - (define-key map "R" 'reftex-toc-Rescan) - (define-key map "q" 'reftex-toc-quit) ; - (define-key map "k" 'reftex-toc-quit-and-kill) - (define-key map "f" 'reftex-toc-toggle-follow) ; - (define-key map "a" 'reftex-toggle-auto-toc-recenter) - (define-key map "d" 'reftex-toc-toggle-dedicated-frame) - (define-key map "F" 'reftex-toc-toggle-file-boundary) - (define-key map "i" 'reftex-toc-toggle-index) - (define-key map "l" 'reftex-toc-toggle-labels) - (define-key map "t" 'reftex-toc-max-level) - (define-key map "c" 'reftex-toc-toggle-context) - ;; (define-key map "%" 'reftex-toc-toggle-commented) - (define-key map "\M-%" 'reftex-toc-rename-label) - (define-key map "x" 'reftex-toc-external) - (define-key map "z" 'reftex-toc-jump) - (define-key map "." 'reftex-toc-show-calling-point) - (define-key map "\C-c\C-n" 'reftex-toc-next-heading) - (define-key map "\C-c\C-p" 'reftex-toc-previous-heading) - (define-key map ">" 'reftex-toc-demote) - (define-key map "<" 'reftex-toc-promote) + (define-key map "n" #'reftex-toc-next) + (define-key map "p" #'reftex-toc-previous) + (define-key map "?" #'reftex-toc-show-help) + (define-key map " " #'reftex-toc-view-line) + (define-key map "\C-m" #'reftex-toc-goto-line-and-hide) + (define-key map "\C-i" #'reftex-toc-goto-line) + (define-key map "\C-c>" #'reftex-toc-display-index) + (define-key map "r" #'reftex-toc-rescan) + (define-key map "R" #'reftex-toc-Rescan) + (define-key map "q" #'reftex-toc-quit) ; + (define-key map "k" #'reftex-toc-quit-and-kill) + (define-key map "f" #'reftex-toc-toggle-follow) ; + (define-key map "a" #'reftex-toggle-auto-toc-recenter) + (define-key map "d" #'reftex-toc-toggle-dedicated-frame) + (define-key map "F" #'reftex-toc-toggle-file-boundary) + (define-key map "i" #'reftex-toc-toggle-index) + (define-key map "l" #'reftex-toc-toggle-labels) + (define-key map "t" #'reftex-toc-max-level) + (define-key map "c" #'reftex-toc-toggle-context) + ;; (define-key map "%" #'reftex-toc-toggle-commented) + (define-key map "\M-%" #'reftex-toc-rename-label) + (define-key map "x" #'reftex-toc-external) + (define-key map "z" #'reftex-toc-jump) + (define-key map "." #'reftex-toc-show-calling-point) + (define-key map "\C-c\C-n" #'reftex-toc-next-heading) + (define-key map "\C-c\C-p" #'reftex-toc-previous-heading) + (define-key map ">" #'reftex-toc-demote) + (define-key map "<" #'reftex-toc-promote) (easy-menu-define reftex-toc-menu map @@ -130,9 +129,7 @@ Here are all local bindings. \\{reftex-toc-mode-map}" (set (make-local-variable 'transient-mark-mode) t) - (when (featurep 'xemacs) - (set (make-local-variable 'zmacs-regions) t)) - (set (make-local-variable 'revert-buffer-function) 'reftex-toc-revert) + (set (make-local-variable 'revert-buffer-function) #'reftex-toc-revert) (set (make-local-variable 'reftex-toc-include-labels-indicator) "") (set (make-local-variable 'reftex-toc-max-level-indicator) (if (= reftex-toc-max-level 100) @@ -146,15 +143,9 @@ Here are all local bindings. " T<" 'reftex-toc-max-level-indicator ">" " -%-")) (setq truncate-lines t) - (when (featurep 'xemacs) - ;; XEmacs needs the call to make-local-hook - (make-local-hook 'post-command-hook) - (make-local-hook 'pre-command-hook)) (make-local-variable 'reftex-last-follow-point) - (add-hook 'post-command-hook 'reftex-toc-post-command-hook nil t) - (add-hook 'pre-command-hook 'reftex-toc-pre-command-hook nil t) - (when (featurep 'xemacs) - (easy-menu-add reftex-toc-menu reftex-toc-mode-map))) + (add-hook 'post-command-hook #'reftex-toc-post-command-hook nil t) + (add-hook 'pre-command-hook #'reftex-toc-pre-command-hook nil t)) (defvar reftex-last-toc-file nil "Stores the file name from which `reftex-toc' was called. For redo command.") @@ -420,7 +411,6 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help (defun reftex-toc-next (&optional _arg) "Move to next selectable item." (interactive) - (when (featurep 'xemacs) (setq zmacs-region-stays t)) (setq reftex-callback-fwd t) (or (eobp) (forward-char 1)) (goto-char (or (next-single-property-change (point) :data) @@ -428,21 +418,18 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help (defun reftex-toc-previous (&optional _arg) "Move to previous selectable item." (interactive) - (when (featurep 'xemacs) (setq zmacs-region-stays t)) (setq reftex-callback-fwd nil) (goto-char (or (previous-single-property-change (point) :data) (point)))) (defun reftex-toc-next-heading (&optional arg) "Move to next table of contents line." (interactive "p") - (when (featurep 'xemacs) (setq zmacs-region-stays t)) (end-of-line) (re-search-forward "^ " nil t arg) (beginning-of-line)) (defun reftex-toc-previous-heading (&optional arg) "Move to previous table of contents line." (interactive "p") - (when (featurep 'xemacs) (setq zmacs-region-stays t)) (re-search-backward "^ " nil t arg)) (defun reftex-toc-toggle-follow () "Toggle follow (other window follows with context)." @@ -662,7 +649,7 @@ point." (let* ((reftex--start-line (+ (count-lines (point-min) (point)) (if (bolp) 1 0))) (reftex--mark-line - (if (reftex-region-active-p) + (if (region-active-p) (save-excursion (goto-char (mark)) (+ (count-lines (point-min) (point)) (if (bolp) 1 0))))) @@ -671,7 +658,7 @@ point." beg end entries data sections nsec msg) (setq msg (catch 'exit - (if (reftex-region-active-p) + (if (region-active-p) ;; A region is dangerous, check if we have a brand new scan, ;; to make sure we are not missing any section statements. (if (not (reftex-toc-check-docstruct)) @@ -712,7 +699,7 @@ point." nil ; we have permission, do nothing (error "Abort")) ; abort, we don't have permission ;; Do the changes - (mapc 'reftex-toc-promote-action entries) + (mapc #'reftex-toc-promote-action entries) ;; Rescan the document and rebuilt the toc buffer (save-window-excursion (reftex-toc-Rescan)) @@ -734,10 +721,8 @@ point." (forward-line (1- point-line))) (when mpos (set-mark mpos) - (if (featurep 'xemacs) - (zmacs-activate-region) - (setq mark-active t - deactivate-mark nil))))) + (setq mark-active t + deactivate-mark nil)))) (defun reftex-toc-promote-prepare (x delta) "Look at a TOC entry and see if we could pro/demote it. @@ -918,7 +903,7 @@ label prefix determines the wording of a reference." (setq match (let ((where (car toc)) (file (nth 1 toc))) - (if (or (not no-revisit) (reftex-get-buffer-visiting file)) + (if (or (not no-revisit) (find-buffer-visiting file)) (progn (switch-to-buffer-other-window (reftex-get-file-buffer-force file nil)) @@ -981,7 +966,7 @@ label prefix determines the wording of a reference." reftex-section-levels-all))) "[[{]?")))) ((or (not no-revisit) - (reftex-get-buffer-visiting file)) + (find-buffer-visiting file)) ;; Marker is lost. Use the backup method. (switch-to-buffer-other-window (reftex-get-file-buffer-force file nil)) @@ -1035,18 +1020,12 @@ section." (interactive) (if reftex-toc-auto-recenter-timer (progn - (if (featurep 'xemacs) - (delete-itimer reftex-toc-auto-recenter-timer) - (cancel-timer reftex-toc-auto-recenter-timer)) + (cancel-timer reftex-toc-auto-recenter-timer) (setq reftex-toc-auto-recenter-timer nil) (message "Automatic recentering of TOC window was turned off")) (setq reftex-toc-auto-recenter-timer - (if (featurep 'xemacs) - (start-itimer "RefTeX Idle Timer for recenter" - 'reftex-recenter-toc-when-idle - reftex-idle-time reftex-idle-time t) - (run-with-idle-timer - reftex-idle-time t 'reftex-recenter-toc-when-idle))) + (run-with-idle-timer + reftex-idle-time t #'reftex-recenter-toc-when-idle)) (message "Automatic recentering of TOC window was turned on"))) (defun reftex-toc-toggle-dedicated-frame () @@ -1090,15 +1069,12 @@ always show the current section in connection with the option (switch-to-buffer "*toc*") (select-frame current-frame) (cond ((fboundp 'x-focus-frame) - (x-focus-frame current-frame)) - ((and (featurep 'xemacs) ; `focus-frame' is a nop in Emacs. - (fboundp 'focus-frame)) - (focus-frame current-frame))) + (x-focus-frame current-frame))) (select-window current-window) (when (eq reftex-auto-recenter-toc 'frame) (unless reftex-toc-auto-recenter-timer (reftex-toggle-auto-toc-recenter)) - (add-hook 'delete-frame-functions 'reftex-toc-delete-frame-hook))))) + (add-hook 'delete-frame-functions #'reftex-toc-delete-frame-hook))))) (defun reftex-toc-delete-frame-hook (frame) (if (and reftex-toc-auto-recenter-timer diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index 5b1e8bd8b51..a65772da1a4 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el @@ -1,4 +1,4 @@ -;;; reftex-vars.el --- configuration variables for RefTeX +;;; reftex-vars.el --- configuration variables for RefTeX -*- lexical-binding: t; -*- ;; Copyright (C) 1997-1999, 2001-2021 Free Software Foundation, Inc. @@ -282,7 +282,7 @@ distribution. Mixed-case symbols are convenience aliases.") The file name is expected after the command, either in braces or separated by whitespace." :group 'reftex-table-of-contents-browser - :set 'reftex-set-dirty + :set #'reftex-set-dirty :type '(repeat string)) (defcustom reftex-max-section-depth 12 @@ -319,7 +319,7 @@ commands, promotion only works correctly if this list is sorted first by set, then within each set by level. The promotion commands always select the nearest entry with the correct new level." :group 'reftex-table-of-contents-browser - :set 'reftex-set-dirty + :set #'reftex-set-dirty :type '(repeat (cons (string :tag "sectioning macro" "") (choice @@ -463,7 +463,7 @@ The value of this variable is a list of symbols with associations in the constant `reftex-label-alist-builtin'. Check that constant for a full list of options." :group 'reftex-defining-label-environments - :set 'reftex-set-dirty + :set #'reftex-set-dirty :type `(set :indent 4 :inline t @@ -611,7 +611,7 @@ Any list entry may also be a symbol. If that has an association in list. However, builtin defaults should normally be set with the variable `reftex-default-label-alist-entries'." :group 'reftex-defining-label-environments - :set 'reftex-set-dirty + :set #'reftex-set-dirty :type `(repeat (choice :tag "Package or Detailed " @@ -1198,7 +1198,7 @@ File names matched by these regexps will not be parsed by RefTeX. Intended for files which contain only `@string' macro definitions and the like, which are ignored by RefTeX anyway." :group 'reftex-citation-support - :set 'reftex-set-dirty + :set #'reftex-set-dirty :type '(repeat (regexp))) (defcustom reftex-default-bibliography nil @@ -1460,7 +1460,7 @@ Note that AUCTeX sets these things internally for RefTeX as well, so with a sufficiently new version of AUCTeX, you should not set the package here." :group 'reftex-index-support - :set 'reftex-set-dirty + :set #'reftex-set-dirty :type `(list (repeat :inline t @@ -1728,7 +1728,7 @@ Multiple directories can be separated by the system dependent `path-separator'. Directories ending in `//' or `!!' will be expanded recursively. See also `reftex-use-external-file-finders'." :group 'reftex-finding-files - :set 'reftex-set-dirty + :set #'reftex-set-dirty :type '(repeat (string :tag "Specification"))) (defcustom reftex-bibpath-environment-variables '("BIBINPUTS" "TEXBIB") @@ -1744,7 +1744,7 @@ Directories ending in `//' or `!!' will be expanded recursively. See also `reftex-use-external-file-finders'." :group 'reftex-citation-support :group 'reftex-finding-files - :set 'reftex-set-dirty + :set #'reftex-set-dirty :type '(repeat (string :tag "Specification"))) (defcustom reftex-file-extensions '(("tex" . (".tex" ".ltx")) diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 269d676c2bc..c732299361c 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -1,4 +1,4 @@ -;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX +;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2000, 2003-2021 Free Software Foundation, Inc. ;; Author: Carsten Dominik <dominik@science.uva.nl> @@ -38,9 +38,8 @@ ;; ;; https://www.gnu.org/software/auctex/manual/reftex.index.html ;; -;; RefTeX is bundled with Emacs and available as a plug-in package for -;; XEmacs 21.x. If you need to install it yourself, you can find a -;; distribution at +;; RefTeX is bundled with Emacs. +;; If you need to install it yourself, you can find a distribution at ;; ;; https://www.gnu.org/software/auctex/reftex.html ;; @@ -100,37 +99,34 @@ (defvar reftex-mode-map (let ((map (make-sparse-keymap))) ;; The default bindings in the mode map. - (define-key map "\C-c=" 'reftex-toc) - (define-key map "\C-c-" 'reftex-toc-recenter) - (define-key map "\C-c(" 'reftex-label) - (define-key map "\C-c)" 'reftex-reference) - (define-key map "\C-c[" 'reftex-citation) - (define-key map "\C-c<" 'reftex-index) - (define-key map "\C-c>" 'reftex-display-index) - (define-key map "\C-c/" 'reftex-index-selection-or-word) - (define-key map "\C-c\\" 'reftex-index-phrase-selection-or-word) - (define-key map "\C-c|" 'reftex-index-visit-phrases-buffer) - (define-key map "\C-c&" 'reftex-view-crossref) + (define-key map "\C-c=" #'reftex-toc) + (define-key map "\C-c-" #'reftex-toc-recenter) + (define-key map "\C-c(" #'reftex-label) + (define-key map "\C-c)" #'reftex-reference) + (define-key map "\C-c[" #'reftex-citation) + (define-key map "\C-c<" #'reftex-index) + (define-key map "\C-c>" #'reftex-display-index) + (define-key map "\C-c/" #'reftex-index-selection-or-word) + (define-key map "\C-c\\" #'reftex-index-phrase-selection-or-word) + (define-key map "\C-c|" #'reftex-index-visit-phrases-buffer) + (define-key map "\C-c&" #'reftex-view-crossref) ;; Bind `reftex-mouse-view-crossref' only when the key is still free - (if (featurep 'xemacs) - (unless (key-binding [(shift button2)]) - (define-key map [(shift button2)] 'reftex-mouse-view-crossref)) - (unless (key-binding [(shift mouse-2)]) - (define-key map [(shift mouse-2)] 'reftex-mouse-view-crossref))) + (unless (key-binding [(shift mouse-2)]) + (define-key map [(shift mouse-2)] #'reftex-mouse-view-crossref)) ;; For most of these commands there are already bindings in place. ;; Setting `reftex-extra-bindings' really is only there to spare users ;; the hassle of defining bindings in the user space themselves. This ;; is why they violate the key binding recommendations. (when reftex-extra-bindings - (define-key map "\C-ct" 'reftex-toc) - (define-key map "\C-cl" 'reftex-label) - (define-key map "\C-cr" 'reftex-reference) - (define-key map "\C-cc" 'reftex-citation) - (define-key map "\C-cv" 'reftex-view-crossref) - (define-key map "\C-cg" 'reftex-grep-document) - (define-key map "\C-cs" 'reftex-search-document)) + (define-key map "\C-ct" #'reftex-toc) + (define-key map "\C-cl" #'reftex-label) + (define-key map "\C-cr" #'reftex-reference) + (define-key map "\C-cc" #'reftex-citation) + (define-key map "\C-cv" #'reftex-view-crossref) + (define-key map "\C-cg" #'reftex-grep-document) + (define-key map "\C-cs" #'reftex-search-document)) map) "Keymap for RefTeX mode.") @@ -204,8 +200,6 @@ on the menu bar. (if reftex-mode (progn ;; Mode was turned on - (when (featurep 'xemacs) - (easy-menu-add reftex-mode-menu)) (and reftex-plug-into-AUCTeX (reftex-plug-into-AUCTeX)) (unless (get 'reftex-auto-view-crossref 'initialized) @@ -220,10 +214,7 @@ on the menu bar. ;; Prepare the special syntax tables. (reftex--prepare-syntax-tables) - (run-hooks 'reftex-mode-hook)) - ;; Mode was turned off - (when (featurep 'xemacs) - (easy-menu-remove reftex-mode-menu)))) + (run-hooks 'reftex-mode-hook)))) (defvar reftex-docstruct-symbol) (defun reftex-kill-buffer-hook () @@ -391,11 +382,11 @@ If the symbols for the current master file do not exist, they are created." ((null master) (error "Need a filename for this buffer, please save it first")) ((or (file-exists-p (concat master ".tex")) - (reftex-get-buffer-visiting (concat master ".tex"))) + (find-buffer-visiting (concat master ".tex"))) ;; Ahh, an extra .tex was missing... (setq master (concat master ".tex"))) ((or (file-exists-p master) - (reftex-get-buffer-visiting master)) + (find-buffer-visiting master)) ;; We either see the file, or have a buffer on it. OK. ) (t @@ -890,7 +881,7 @@ This enforces rescanning the buffer on next use." ;; Are the magic words regular expressions? Quote normal words. (if (eq (car wordlist) 'regexp) (setq wordlist (cdr wordlist)) - (setq wordlist (mapcar 'regexp-quote wordlist))) + (setq wordlist (mapcar #'regexp-quote wordlist))) ;; Remember the first association of each word. (while (stringp (setq word (pop wordlist))) (or (assoc word reftex-words-to-typekey-alist) @@ -1017,11 +1008,11 @@ This enforces rescanning the buffer on next use." (wbol "\\(^\\)%?[ \t]*") ; Need to keep the empty group because ; match numbers are hard coded (label-re (concat "\\(?:" - (mapconcat 'identity reftex-label-regexps "\\|") + (mapconcat #'identity reftex-label-regexps "\\|") "\\)")) (include-re (concat wbol "\\\\\\(" - (mapconcat 'identity + (mapconcat #'identity reftex-include-file-commands "\\|") "\\)[{ \t]+\\([^} \t\n\r]+\\)")) (section-re @@ -1033,23 +1024,24 @@ This enforces rescanning the buffer on next use." (macro-re (if macros-with-labels (concat "\\(" - (mapconcat 'regexp-quote macros-with-labels "\\|") + (mapconcat #'regexp-quote macros-with-labels "\\|") "\\)[[{]") "")) (index-re (concat "\\(" - (mapconcat 'regexp-quote reftex-macros-with-index "\\|") + (mapconcat #'regexp-quote reftex-macros-with-index "\\|") "\\)[[{]")) (find-index-re-format (concat "\\(" - (mapconcat 'regexp-quote reftex-macros-with-index "\\|") + (mapconcat #'regexp-quote reftex-macros-with-index "\\|") "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]")) (find-label-re-format (concat "\\(" "label[[:space:]]*=[[:space:]]*" "\\|" - (mapconcat 'regexp-quote (append '("\\label") - macros-with-labels) "\\|") + (mapconcat #'regexp-quote (append '("\\label") + macros-with-labels) + "\\|") "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]")) (index-level-re (regexp-quote (nth 0 reftex-index-special-chars))) @@ -1081,7 +1073,7 @@ This enforces rescanning the buffer on next use." "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]") (message "Compiling label environment definitions...done"))) (put reftex-docstruct-symbol 'reftex-cache - (mapcar 'symbol-value reftex-cache-variables))) + (mapcar #'symbol-value reftex-cache-variables))) (defun reftex-parse-args (macro) ;; Return a list of macro name, nargs, arg-nr which is label and a list of @@ -1277,8 +1269,8 @@ Valid actions are: readable, restore, read, kill, write." (- 1 xr-index)) (t (save-excursion - (let* ((length (apply 'max (mapcar - (lambda(x) (length (car x))) xr-alist))) + (let* ((length (apply #'max (mapcar + (lambda(x) (length (car x))) xr-alist))) (fmt (format " [%%c] %%-%ds %%s\n" length)) (n (1- ?0))) (setq key @@ -1312,7 +1304,7 @@ When DIE is non-nil, throw an error if file not found." (extensions (cdr (assoc type reftex-file-extensions))) (def-ext (car extensions)) (ext-re (concat "\\(" - (mapconcat 'regexp-quote extensions "\\|") + (mapconcat #'regexp-quote extensions "\\|") "\\)\\'")) (files (if (string-match ext-re file) (cons file nil) @@ -1354,7 +1346,7 @@ When DIE is non-nil, throw an error if file not found." out) (if (string-match "%f" prg) (setq prg (replace-match file t t prg))) - (setq out (apply 'reftex-process-string (split-string prg))) + (setq out (apply #'reftex-process-string (split-string prg))) (if (string-match "[ \t\n]+\\'" out) ; chomp (setq out (replace-match "" nil nil out))) (cond ((equal out "") nil) @@ -1367,7 +1359,7 @@ When DIE is non-nil, throw an error if file not found." (with-output-to-string (with-current-buffer standard-output (let ((default-directory calling-dir)) ; set default directory - (apply 'call-process program nil '(t nil) nil args)))))) + (apply #'call-process program nil '(t nil) nil args)))))) (defun reftex-access-search-path (type &optional recurse master-dir file) ;; Access path from environment variables. TYPE is either "tex" or "bib". @@ -1386,7 +1378,7 @@ When DIE is non-nil, throw an error if file not found." (mapconcat (lambda(x) (if (string-match "^!" x) - (apply 'reftex-process-string + (apply #'reftex-process-string (split-string (substring x 1))) (or (getenv x) x))) ;; For consistency, the next line should look like this: @@ -1531,12 +1523,7 @@ When DIE is non-nil, throw an error if file not found." (when (match-beginning n) (buffer-substring-no-properties (match-beginning n) (match-end n)))) -(defun reftex-region-active-p () - "Should we operate on an active region?" - (if (fboundp 'use-region-p) - (use-region-p) - ;; For XEmacs. - (region-active-p))) +(define-obsolete-function-alias 'reftex-region-active-p #'use-region-p "28.1") (defun reftex-kill-buffer (buffer) ;; Kill buffer if it exists. @@ -1745,26 +1732,12 @@ When DIE is non-nil, throw an error if file not found." (setq string (replace-match "[\n\r]" nil t string))) string)) -(defun reftex-get-buffer-visiting (file) - ;; return a buffer visiting FILE - (cond - ((boundp 'find-file-compare-truenames) ; XEmacs - (let ((find-file-compare-truenames t)) - (get-file-buffer file))) - ((fboundp 'find-buffer-visiting) ; Emacs - (find-buffer-visiting file)) - (t (error "This should not happen (reftex-get-buffer-visiting)")))) - -;; Define `current-message' for compatibility with XEmacs prior to 20.4 -(defvar message-stack) -(if (and (featurep 'xemacs) - (not (fboundp 'current-message))) - (defun current-message (&optional _frame) - (cdr (car message-stack)))) +(define-obsolete-function-alias 'reftex-get-buffer-visiting + #'find-buffer-visiting "28.1") (defun reftex-visited-files (list) ;; Takes a list of filenames and returns the buffers of those already visited - (delq nil (mapcar (lambda (x) (if (reftex-get-buffer-visiting x) x nil)) + (delq nil (mapcar (lambda (x) (if (find-buffer-visiting x) x nil)) list))) (defun reftex-get-file-buffer-force (file &optional mark-to-kill) @@ -1774,7 +1747,7 @@ When DIE is non-nil, throw an error if file not found." ;; initializations according to `reftex-initialize-temporary-buffers', ;; and mark the buffer to be killed after use. - (let ((buf (reftex-get-buffer-visiting file))) + (let ((buf (find-buffer-visiting file))) (cond (buf ;; We have it already as a buffer - just return it @@ -1866,7 +1839,7 @@ When DIE is non-nil, throw an error if file not found." (setq list (copy-sequence list)) (if sort (progn - (setq list (sort list 'string<)) + (setq list (sort list #'string<)) (let ((p list)) (while (cdr p) (if (string= (car p) (car (cdr p))) @@ -2003,7 +1976,7 @@ IGNORE-WORDS List of words which should be removed from the string." (setcdr (nthcdr (1- nwords) words) nil)) ;; First, try to use all words - (setq string (mapconcat 'identity words sep)) + (setq string (mapconcat #'identity words sep)) ;; Abbreviate words if enforced by user settings or string length (if (or (eq t abbrev) @@ -2017,7 +1990,7 @@ IGNORE-WORDS List of words which should be removed from the string." (match-string 1 w)) w)) words) - string (mapconcat 'identity words sep))) + string (mapconcat #'identity words sep))) ;; Shorten if still to long (setq string @@ -2081,24 +2054,11 @@ IGNORE-WORDS List of words which should be removed from the string." (progn ;; Rename buffer temporarily to start w/o space (because of font-lock) (rename-buffer newname t) - (cond - ((fboundp 'font-lock-default-fontify-region) - ;; Good: we have the indirection functions - (set (make-local-variable 'font-lock-fontify-region-function) - 'reftex-select-font-lock-fontify-region) - (let ((major-mode 'latex-mode)) - (font-lock-mode 1))) - ((fboundp 'font-lock-set-defaults-1) - ;; Looks like the XEmacs font-lock stuff. - ;; FIXME: this is still kind of a hack, but it works. - (set (make-local-variable 'font-lock-keywords) nil) - (let ((major-mode 'latex-mode) - (font-lock-defaults-computed nil)) - (font-lock-set-defaults-1) - (reftex-select-font-lock-fontify-region (point-min) (point-max)))) - (t - ;; Oops? - (message "Sorry: cannot refontify RefTeX Select buffer.")))) + ;; Good: we have the indirection functions + (set (make-local-variable 'font-lock-fontify-region-function) + #'reftex-select-font-lock-fontify-region) + (let ((major-mode 'latex-mode)) + (font-lock-mode 1))) (rename-buffer oldname)))) (defun reftex-select-font-lock-fontify-region (beg end &optional _loudly) @@ -2123,46 +2083,39 @@ IGNORE-WORDS List of words which should be removed from the string." (let (face) (catch 'exit (while (setq face (pop faces)) - (if (featurep 'xemacs) - (if (find-face face) (throw 'exit face)) - (if (facep face) (throw 'exit face))))))) - -;; Highlighting uses overlays. For XEmacs, we use extends. -(defalias 'reftex-make-overlay - (if (featurep 'xemacs) 'make-extent 'make-overlay)) -(defalias 'reftex-overlay-put - (if (featurep 'xemacs) 'set-extent-property 'overlay-put)) -(defalias 'reftex-move-overlay - (if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay)) -(defalias 'reftex-delete-overlay - (if (featurep 'xemacs) 'detach-extent 'delete-overlay)) + (if (facep face) (throw 'exit face)))))) + +(define-obsolete-function-alias 'reftex-make-overlay #'make-overlay "28.1") +(define-obsolete-function-alias 'reftex-overlay-put #'overlay-put "28.1") +(define-obsolete-function-alias 'reftex-move-overlay #'move-overlay "28.1") +(define-obsolete-function-alias 'reftex-delete-overlay #'delete-overlay "28.1") ;; We keep a vector with several different overlays to do our highlighting. (defvar reftex-highlight-overlays [nil nil nil]) ;; Initialize the overlays -(aset reftex-highlight-overlays 0 (reftex-make-overlay 1 1)) -(reftex-overlay-put (aref reftex-highlight-overlays 0) +(aset reftex-highlight-overlays 0 (make-overlay 1 1)) +(overlay-put (aref reftex-highlight-overlays 0) 'face 'highlight) -(aset reftex-highlight-overlays 1 (reftex-make-overlay 1 1)) -(reftex-overlay-put (aref reftex-highlight-overlays 1) +(aset reftex-highlight-overlays 1 (make-overlay 1 1)) +(overlay-put (aref reftex-highlight-overlays 1) 'face reftex-cursor-selected-face) -(aset reftex-highlight-overlays 2 (reftex-make-overlay 1 1)) -(reftex-overlay-put (aref reftex-highlight-overlays 2) +(aset reftex-highlight-overlays 2 (make-overlay 1 1)) +(overlay-put (aref reftex-highlight-overlays 2) 'face reftex-cursor-selected-face) ;; Two functions for activating and deactivation highlight overlays (defun reftex-highlight (index begin end &optional buffer) "Highlight a region with overlay INDEX." - (reftex-move-overlay (aref reftex-highlight-overlays index) + (move-overlay (aref reftex-highlight-overlays index) begin end (or buffer (current-buffer)))) (defun reftex-unhighlight (index) "Detach overlay INDEX." - (reftex-delete-overlay (aref reftex-highlight-overlays index))) + (delete-overlay (aref reftex-highlight-overlays index))) (defun reftex-highlight-shall-die () ;; Function used in pre-command-hook to remove highlights. - (remove-hook 'pre-command-hook 'reftex-highlight-shall-die) + (remove-hook 'pre-command-hook #'reftex-highlight-shall-die) (reftex-unhighlight 0)) ;;; ========================================================================= @@ -2174,7 +2127,7 @@ IGNORE-WORDS List of words which should be removed from the string." ;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map (eval-after-load "bibtex" - '(define-key bibtex-mode-map "\C-c&" 'reftex-view-crossref-from-bibtex)) + '(define-key bibtex-mode-map "\C-c&" #'reftex-view-crossref-from-bibtex)) ;;; ========================================================================= ;;; @@ -2379,9 +2332,9 @@ Your bug report will be posted to the AUCTeX bug reporting list. ;;; Install the kill-buffer and kill-emacs hooks ------------------------------ -(add-hook 'kill-buffer-hook 'reftex-kill-buffer-hook) +(add-hook 'kill-buffer-hook #'reftex-kill-buffer-hook) (unless noninteractive - (add-hook 'kill-emacs-hook 'reftex-kill-emacs-hook)) + (add-hook 'kill-emacs-hook #'reftex-kill-emacs-hook)) ;;; Run Hook ------------------------------------------------------------------ diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el index 6a72ebb3321..b731c124421 100644 --- a/lisp/textmodes/remember.el +++ b/lisp/textmodes/remember.el @@ -1,4 +1,4 @@ -;;; remember --- a mode for quickly jotting down things to remember +;;; remember --- a mode for quickly jotting down things to remember -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2001, 2003-2021 Free Software Foundation, Inc. @@ -270,12 +270,13 @@ With a prefix or a visible region, use the region as INITIAL." (buffer-substring (region-beginning) (region-end))))) (funcall (if remember-in-new-frame #'frameset-to-register - #'window-configuration-to-register) remember-register) + #'window-configuration-to-register) + remember-register) (let* ((annotation (if remember-run-all-annotation-functions-flag - (mapconcat 'identity + (mapconcat #'identity (delq nil - (mapcar 'funcall remember-annotation-functions)) + (mapcar #'funcall remember-annotation-functions)) "\n") (run-hook-with-args-until-success 'remember-annotation-functions))) @@ -283,7 +284,8 @@ With a prefix or a visible region, use the region as INITIAL." (run-hooks 'remember-before-remember-hook) (funcall (if remember-in-new-frame #'switch-to-buffer-other-frame - #'switch-to-buffer-other-window) buf) + #'switch-to-buffer-other-window) + buf) (if remember-in-new-frame (set-window-dedicated-p (get-buffer-window (current-buffer) (selected-frame)) t)) @@ -384,7 +386,7 @@ exists) might be changed." (with-current-buffer buf (set-visited-file-name (expand-file-name remember-data-file)))))) - :initialize 'custom-initialize-default) + :initialize #'custom-initialize-default) (defcustom remember-leader-text "** " "The text used to begin each remember item." @@ -541,7 +543,7 @@ If this is nil, then `diary-file' will be used instead." (while (re-search-forward remember-diary-regexp nil t) (push (remember-diary-convert-entry (match-string 1)) list)) (when list - (diary-make-entry (mapconcat 'identity list "\n") + (diary-make-entry (mapconcat #'identity list "\n") nil remember-diary-file) (when remember-save-after-remembering (with-current-buffer (find-buffer-visiting (or remember-diary-file @@ -553,9 +555,9 @@ If this is nil, then `diary-file' will be used instead." (defvar remember-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\C-x\C-s" 'remember-finalize) - (define-key map "\C-c\C-c" 'remember-finalize) - (define-key map "\C-c\C-k" 'remember-destroy) + (define-key map "\C-x\C-s" #'remember-finalize) + (define-key map "\C-c\C-c" #'remember-finalize) + (define-key map "\C-c\C-k" #'remember-destroy) map) "Keymap used in `remember-mode'.") @@ -601,7 +603,7 @@ If this is nil, use `initial-major-mode'." (defvar remember-notes-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\C-c\C-c" 'remember-notes-save-and-bury-buffer) + (define-key map "\C-c\C-c" #'remember-notes-save-and-bury-buffer) map) "Keymap used in `remember-notes-mode'.") diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 876347bc81e..7de5317b025 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -34,6 +34,7 @@ (require 'dom) (require 'seq) +(require 'facemenu) (eval-when-compile (require 'subr-x)) (eval-when-compile (require 'skeleton) diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el index 60122b2fac1..a9f066c4da4 100644 --- a/lisp/textmodes/table.el +++ b/lisp/textmodes/table.el @@ -1306,17 +1306,16 @@ the last cache point coordinate." (let ((func-symbol (intern (format "*table--cell-%s" command))) (doc-string (format "Table remapped function for `%s'." command))) (defalias func-symbol - `(lambda - (&rest args) - ,doc-string - (interactive) - (let ((table-inhibit-update t) - (deactivate-mark nil)) - (table--finish-delayed-tasks) - (table-recognize-cell 'force) - (table-with-cache-buffer - (call-interactively ',command) - (setq table-inhibit-auto-fill-paragraph t))))) + (lambda (&rest _args) + (:documentation doc-string) + (interactive) + (let ((table-inhibit-update t) + (deactivate-mark nil)) + (table--finish-delayed-tasks) + (table-recognize-cell 'force) + (table-with-cache-buffer + (call-interactively command) + (setq table-inhibit-auto-fill-paragraph t))))) (push (cons command func-symbol) table-command-remap-alist))) @@ -1338,17 +1337,16 @@ the last cache point coordinate." (let ((func-symbol (intern (format "*table--cell-%s" command))) (doc-string (format "Table remapped function for `%s'." command))) (defalias func-symbol - `(lambda - (&rest args) - ,doc-string - (interactive) - (table--finish-delayed-tasks) - (table-recognize-cell 'force) - (table-with-cache-buffer - (table--remove-cell-properties (point-min) (point-max)) - (table--remove-eol-spaces (point-min) (point-max)) - (call-interactively ',command)) - (table--finish-delayed-tasks))) + (lambda (&rest _args) + (:documentation doc-string) + (interactive) + (table--finish-delayed-tasks) + (table-recognize-cell 'force) + (table-with-cache-buffer + (table--remove-cell-properties (point-min) (point-max)) + (table--remove-eol-spaces (point-min) (point-max)) + (call-interactively command)) + (table--finish-delayed-tasks))) (push (cons command func-symbol) table-command-remap-alist))) @@ -1360,19 +1358,18 @@ the last cache point coordinate." insert)) (let ((func-symbol (intern (format "*table--cell-%s" command))) (doc-string (format "Table remapped function for `%s'." command))) - (fset func-symbol - `(lambda - (&rest args) - ,doc-string - (interactive) - (table--finish-delayed-tasks) - (table-recognize-cell 'force) - (table-with-cache-buffer - (call-interactively ',command) - (table--untabify (point-min) (point-max)) - (table--fill-region (point-min) (point-max)) - (setq table-inhibit-auto-fill-paragraph t)) - (table--finish-delayed-tasks))) + (defalias func-symbol + (lambda (&rest _args) + (:documentation doc-string) + (interactive) + (table--finish-delayed-tasks) + (table-recognize-cell 'force) + (table-with-cache-buffer + (call-interactively command) + (table--untabify (point-min) (point-max)) + (table--fill-region (point-min) (point-max)) + (setq table-inhibit-auto-fill-paragraph t)) + (table--finish-delayed-tasks))) (push (cons command func-symbol) table-command-remap-alist))) @@ -1384,18 +1381,17 @@ the last cache point coordinate." fill-paragraph)) (let ((func-symbol (intern (format "*table--cell-%s" command))) (doc-string (format "Table remapped function for `%s'." command))) - (fset func-symbol - `(lambda - (&rest args) - ,doc-string - (interactive) - (table--finish-delayed-tasks) - (table-recognize-cell 'force) - (table-with-cache-buffer - (let ((fill-column table-cell-info-width)) - (call-interactively ',command)) - (setq table-inhibit-auto-fill-paragraph t)) - (table--finish-delayed-tasks))) + (defalias func-symbol + (lambda (&rest _args) + (:documentation doc-string) + (interactive) + (table--finish-delayed-tasks) + (table-recognize-cell 'force) + (table-with-cache-buffer + (let ((fill-column table-cell-info-width)) + (call-interactively command)) + (setq table-inhibit-auto-fill-paragraph t)) + (table--finish-delayed-tasks))) (push (cons command func-symbol) table-command-remap-alist))) @@ -2975,8 +2971,8 @@ CALS (DocBook DTD): (setq col-list (cons (car lu-coordinate) col-list))) (unless (memq (cdr lu-coordinate) row-list) (setq row-list (cons (cdr lu-coordinate) row-list)))))) - (setq col-list (sort col-list '<)) - (setq row-list (sort row-list '<)) + (setq col-list (sort col-list #'<)) + (setq row-list (sort row-list #'<)) (message "Generating source...") ;; clear the source generation property list (setplist 'table-source-info-plist nil) @@ -3023,7 +3019,7 @@ CALS (DocBook DTD): ""))) ((eq language 'latex) (insert (format "%% This LaTeX table template is generated by emacs %s\n" emacs-version) - "\\begin{tabular}{|" (apply 'concat (make-list (length col-list) "l|")) "}\n" + "\\begin{tabular}{|" (apply #'concat (make-list (length col-list) "l|")) "}\n" "\\hline\n")) ((eq language 'cals) (insert (format "<!-- This CALS table template is generated by emacs %s -->\n" emacs-version) @@ -3054,7 +3050,7 @@ CALS (DocBook DTD): (set-marker-insertion-type (table-get-source-info 'colspec-marker) t) ;; insert before (save-excursion (goto-char (table-get-source-info 'colspec-marker)) - (dolist (col (sort (table-get-source-info 'colnum-list) '<)) + (dolist (col (sort (table-get-source-info 'colnum-list) #'<)) (insert (format " <colspec colnum=\"%d\" colname=\"c%d\"/>\n" col col)))) (insert (format " </%s>\n </tgroup>\n</table>\n" (table-get-source-info 'row-type)))) ((eq language 'mediawiki) @@ -3852,7 +3848,7 @@ converts a table into plain text without frames. It is a companion to ;; Create the keymap after running the user init file so that the user ;; modification to the global-map is accounted. -(add-hook 'after-init-hook 'table--make-cell-map t) +(add-hook 'after-init-hook #'table--make-cell-map t) (defun *table--cell-self-insert-command () "Table cell version of `self-insert-command'." diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index d5a79ad0ac5..fb57b9b0f23 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -857,11 +857,11 @@ START is the position of the \\ and DELIM is the delimiter char." (defun tex-define-common-keys (keymap) "Define the keys that we want defined both in TeX mode and in the TeX shell." - (define-key keymap "\C-c\C-k" 'tex-kill-job) - (define-key keymap "\C-c\C-l" 'tex-recenter-output-buffer) - (define-key keymap "\C-c\C-q" 'tex-show-print-queue) - (define-key keymap "\C-c\C-p" 'tex-print) - (define-key keymap "\C-c\C-v" 'tex-view) + (define-key keymap "\C-c\C-k" #'tex-kill-job) + (define-key keymap "\C-c\C-l" #'tex-recenter-output-buffer) + (define-key keymap "\C-c\C-q" #'tex-show-print-queue) + (define-key keymap "\C-c\C-p" #'tex-print) + (define-key keymap "\C-c\C-v" #'tex-view) (define-key keymap [menu-bar tex] (cons "TeX" (make-sparse-keymap "TeX"))) @@ -884,27 +884,27 @@ START is the position of the \\ and DELIM is the delimiter char." (let ((map (make-sparse-keymap))) (set-keymap-parent map text-mode-map) (tex-define-common-keys map) - (define-key map "\"" 'tex-insert-quote) - (define-key map "\n" 'tex-handle-newline) - (define-key map "\M-\r" 'latex-insert-item) - (define-key map "\C-c}" 'up-list) - (define-key map "\C-c{" 'tex-insert-braces) - (define-key map "\C-c\C-r" 'tex-region) - (define-key map "\C-c\C-b" 'tex-buffer) - (define-key map "\C-c\C-f" 'tex-file) - (define-key map "\C-c\C-c" 'tex-compile) - (define-key map "\C-c\C-i" 'tex-bibtex-file) - (define-key map "\C-c\C-o" 'latex-insert-block) + (define-key map "\"" #'tex-insert-quote) + (define-key map "\n" #'tex-handle-newline) + (define-key map "\M-\r" #'latex-insert-item) + (define-key map "\C-c}" #'up-list) + (define-key map "\C-c{" #'tex-insert-braces) + (define-key map "\C-c\C-r" #'tex-region) + (define-key map "\C-c\C-b" #'tex-buffer) + (define-key map "\C-c\C-f" #'tex-file) + (define-key map "\C-c\C-c" #'tex-compile) + (define-key map "\C-c\C-i" #'tex-bibtex-file) + (define-key map "\C-c\C-o" #'latex-insert-block) ;; Redundant keybindings, for consistency with SGML mode. - (define-key map "\C-c\C-t" 'latex-insert-block) - (define-key map "\C-c]" 'latex-close-block) - (define-key map "\C-c/" 'latex-close-block) - - (define-key map "\C-c\C-e" 'latex-close-block) - (define-key map "\C-c\C-u" 'tex-goto-last-unclosed-latex-block) - (define-key map "\C-c\C-m" 'tex-feed-input) - (define-key map [(control return)] 'tex-feed-input) + (define-key map "\C-c\C-t" #'latex-insert-block) + (define-key map "\C-c]" #'latex-close-block) + (define-key map "\C-c/" #'latex-close-block) + + (define-key map "\C-c\C-e" #'latex-close-block) + (define-key map "\C-c\C-u" #'tex-goto-last-unclosed-latex-block) + (define-key map "\C-c\C-m" #'tex-feed-input) + (define-key map [(control return)] #'tex-feed-input) (define-key map [menu-bar tex tex-bibtex-file] '("BibTeX File" . tex-bibtex-file)) (define-key map [menu-bar tex tex-validate-region] @@ -922,7 +922,7 @@ START is the position of the \\ and DELIM is the delimiter char." (defvar latex-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map tex-mode-map) - (define-key map "\C-c\C-s" 'latex-split-block) + (define-key map "\C-c\C-s" #'latex-split-block) map) "Keymap for `latex-mode'. See also `tex-mode-map'.") @@ -1033,11 +1033,11 @@ says which mode to use." ;; received them from someone using AUCTeX). ;;;###autoload -(defalias 'TeX-mode 'tex-mode) +(defalias 'TeX-mode #'tex-mode) ;;;###autoload -(defalias 'plain-TeX-mode 'plain-tex-mode) +(defalias 'plain-TeX-mode #'plain-tex-mode) ;;;###autoload -(defalias 'LaTeX-mode 'latex-mode) +(defalias 'LaTeX-mode #'latex-mode) ;;;###autoload (define-derived-mode plain-tex-mode tex-mode "TeX" @@ -1560,7 +1560,7 @@ the name of the environment and SKEL-ELEM is an element to use in a skeleton (see `skeleton-insert').") ;; Like tex-insert-braces, but for LaTeX. -(defalias 'tex-latex-block 'latex-insert-block) +(defalias 'tex-latex-block #'latex-insert-block) (define-skeleton latex-insert-block "Create a matching pair of lines \\begin{NAME} and \\end{NAME} at point. Puts point on a blank line between them." @@ -1866,7 +1866,7 @@ Mark is left at original location." (with-syntax-table tex-mode-syntax-table (forward-sexp)))))) -(defalias 'tex-close-latex-block 'latex-close-block) +(defalias 'tex-close-latex-block #'latex-close-block) (define-skeleton latex-close-block "Create an \\end{...} to match the last unclosed \\begin{...}." (save-excursion @@ -2008,7 +2008,7 @@ Mark is left at original location." ;; Specify an interactive shell, to make sure it prompts. "-i") (let ((proc (get-process "tex-shell"))) - (set-process-sentinel proc 'tex-shell-sentinel) + (set-process-sentinel proc #'tex-shell-sentinel) (set-process-query-on-exit-flag proc nil) (tex-shell) (while (zerop (buffer-size)) @@ -2063,7 +2063,7 @@ evaluates to a command string. Return the process in which TeX is running." (save-excursion - (let* ((cmd (eval command)) + (let* ((cmd (eval command t)) (proc (tex-shell-proc)) (buf (process-buffer proc)) (star (string-match "\\*" cmd)) @@ -2313,7 +2313,7 @@ FILE is typically the output DVI or PDF file." executable)))))) (defun tex-command-executable (cmd) - (let ((s (if (stringp cmd) cmd (eval (car cmd))))) + (let ((s (if (stringp cmd) cmd (eval (car cmd) t)))) (substring s 0 (string-match "[ \t]\\|\\'" s)))) (defun tex-command-active-p (cmd fspec) @@ -2400,7 +2400,7 @@ Only applies the FSPEC to the args part of FORMAT." (setq latest (nth 1 cmd) cmds (list cmd))))))) ;; Expand the command spec into the actual text. (dolist (cmd (prog1 cmds (setq cmds nil))) - (push (cons (eval (car cmd)) (cdr cmd)) cmds)) + (push (cons (eval (car cmd) t) (cdr cmd)) cmds)) ;; Select the favorite command from the history. (let ((hist tex-compile-history) re hist-cmd) @@ -2446,7 +2446,7 @@ Only applies the FSPEC to the args part of FORMAT." (completing-read (format "Command [%s]: " (tex-summarize-command default)) (mapcar (lambda (x) - (list (tex-format-cmd (eval (car x)) fspec))) + (list (tex-format-cmd (eval (car x) t) fspec))) tex-compile-commands) nil nil nil 'tex-compile-history default)))) (save-some-buffers (not compilation-ask-about-save) nil) @@ -2740,7 +2740,7 @@ because there is no standard value that would generally work." ;; Restart the TeX shell if necessary. (or (tex-shell-running) (tex-start-shell)) - (let ((tex-dvi-print-command (eval tex-dvi-view-command))) + (let ((tex-dvi-print-command (eval tex-dvi-view-command t))) (tex-print))) (defun tex-append (file-name suffix) diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el index fe052e32414..a797df9193f 100644 --- a/lisp/textmodes/texinfmt.el +++ b/lisp/textmodes/texinfmt.el @@ -1,4 +1,4 @@ -;;; texinfmt.el --- format Texinfo files into Info files +;;; texinfmt.el --- format Texinfo files into Info files -*- lexical-binding: t; -*- ;; Copyright (C) 1985-1986, 1988, 1990-1998, 2000-2021 Free Software ;; Foundation, Inc. @@ -186,6 +186,7 @@ containing the Texinfo file.") ;; These come from tex-mode.el. (defvar tex-start-of-header) (defvar tex-end-of-header) +(defvar texinfo-example-start) ;;;###autoload (defun texinfo-format-region (region-beginning region-end) @@ -211,7 +212,7 @@ converted to Info is stored in a temporary buffer." texinfo-last-node texinfo-node-names (texinfo-footnote-number 0) - last-input-buffer + ;; last-input-buffer (fill-column-for-info fill-column) (input-buffer (current-buffer)) (input-directory default-directory) @@ -405,7 +406,7 @@ if large. You can use `Info-split' to do this manually." texinfo-stack texinfo-node-names (texinfo-footnote-number 0) - last-input-buffer + ;; last-input-buffer outfile (fill-column-for-info fill-column) (input-buffer (current-buffer)) @@ -924,7 +925,7 @@ commands." (error "Unterminated @%s" (car (car texinfo-stack))))) ;; Remove excess whitespace - (let ((whitespace-silent t)) + (dlet ((whitespace-silent t)) (whitespace-cleanup))) (defvar texinfo-copying-text "" @@ -1032,18 +1033,18 @@ Leave point after argument." (defun texinfo-optional-braces-discard () "Discard braces following command, if any." (goto-char texinfo-command-end) - (let ((start (point))) - (cond ((looking-at "[ \t]*\n")) ; do nothing - ((looking-at "{") ; remove braces, if any - (forward-list 1) - (setq texinfo-command-end (point))) - (t - (error - "Invalid `texinfo-optional-braces-discard' format (need braces?)"))) - (delete-region texinfo-command-start texinfo-command-end))) + ;; (let ((start (point))) + (cond ((looking-at "[ \t]*\n")) ; do nothing + ((looking-at "{") ; remove braces, if any + (forward-list 1) + (setq texinfo-command-end (point))) + (t + (error + "Invalid `texinfo-optional-braces-discard' format (need braces?)"))) + (delete-region texinfo-command-start texinfo-command-end)) ;;) (defun texinfo-format-parse-line-args () - (let ((start (1- (point))) + (let (;; (start (1- (point))) next beg end args) (skip-chars-forward " ") @@ -1064,7 +1065,7 @@ Leave point after argument." (nreverse args))) (defun texinfo-format-parse-args () - (let ((start (1- (point))) + (let (;; (start (1- (point))) next beg end args) (search-forward "{") @@ -2007,26 +2008,26 @@ commands that are defined in texinfo.tex for printed output. ;; ;; Case 2: {Column 1 template} {Column 2} {Column 3 example} ((looking-at "{") - (let ((start-of-templates (point))) - (while (not (eolp)) - (skip-chars-forward " \t") - (let* ((start-of-template (1+ (point))) - (end-of-template - ;; forward-sexp works with braces in Texinfo mode - (progn (forward-sexp 1) (1- (point))))) - (push (- end-of-template start-of-template) - texinfo-multitable-width-list) - ;; Remove carriage return from within a template, if any. - ;; This helps those who want to use more than - ;; one line's worth of words in @multitable line. - (narrow-to-region start-of-template end-of-template) - (goto-char (point-min)) - (while (search-forward " + ;; (let ((start-of-templates (point))) + (while (not (eolp)) + (skip-chars-forward " \t") + (let* ((start-of-template (1+ (point))) + (end-of-template + ;; forward-sexp works with braces in Texinfo mode + (progn (forward-sexp 1) (1- (point))))) + (push (- end-of-template start-of-template) + texinfo-multitable-width-list) + ;; Remove carriage return from within a template, if any. + ;; This helps those who want to use more than + ;; one line's worth of words in @multitable line. + (narrow-to-region start-of-template end-of-template) + (goto-char (point-min)) + (while (search-forward " " nil t) - (delete-char -1)) - (goto-char (point-max)) - (widen) - (forward-char 1))))) + (delete-char -1)) + (goto-char (point-max)) + (widen) + (forward-char 1)))) ;; ) ;; ;; Case 3: Trouble (t @@ -2040,7 +2041,7 @@ commands that are defined in texinfo.tex for printed output. ;; additional between column spaces, if any texinfo-extra-inter-column-width ;; sum of spaces for each entry - (apply '+ texinfo-multitable-width-list)))) + (apply #'+ texinfo-multitable-width-list)))) (if (> desired-columns fill-column) (error "Multi-column table width, %d chars, is greater than page width, %d chars." @@ -2171,9 +2172,9 @@ This command is executed when texinfmt sees @item inside @multitable." (while (< column-number total-number-of-columns) (setq here (point)) (insert-rectangle - (eval (intern - (concat texinfo-multitable-rectangle-name - (int-to-string column-number))))) + (symbol-value (intern + (concat texinfo-multitable-rectangle-name + (int-to-string column-number))))) (goto-char here) (end-of-line) (setq column-number (1+ column-number)))) @@ -2396,8 +2397,8 @@ Use only the FILENAME arg; for Info, ignore the other arguments to @image." (put 'alias 'texinfo-format 'texinfo-alias) (defun texinfo-alias () - (let ((start (1- (point))) - args) + (let (;; (start (1- (point)) + ) ;; args (skip-chars-forward " ") (setq texinfo-command-end (line-end-position)) (if (not (looking-at "\\([^=]+\\)=\\(.*\\)")) @@ -3410,7 +3411,7 @@ Default is to leave paragraph indentation as is." (while args (insert " " (if (or (= ?& (aref (car args) 0)) - (eq (eval (car texinfo-defun-type)) 'deftp-type)) + (eq (car texinfo-defun-type) 'deftp-type)) (car args) (upcase (car args)))) (setq args (cdr args))))) @@ -3775,80 +3776,80 @@ Default is to leave paragraph indentation as is." (put 'deffn 'texinfo-format 'texinfo-format-defun) (put 'deffnx 'texinfo-format 'texinfo-format-defunx) (put 'deffn 'texinfo-end 'texinfo-end-defun) -(put 'deffn 'texinfo-defun-type '('deffn-type nil)) -(put 'deffnx 'texinfo-defun-type '('deffn-type nil)) +(put 'deffn 'texinfo-defun-type '(deffn-type nil)) +(put 'deffnx 'texinfo-defun-type '(deffn-type nil)) (put 'deffn 'texinfo-defun-index 'texinfo-findex) (put 'deffnx 'texinfo-defun-index 'texinfo-findex) (put 'defun 'texinfo-format 'texinfo-format-defun) (put 'defunx 'texinfo-format 'texinfo-format-defunx) (put 'defun 'texinfo-end 'texinfo-end-defun) -(put 'defun 'texinfo-defun-type '('defun-type "Function")) -(put 'defunx 'texinfo-defun-type '('defun-type "Function")) +(put 'defun 'texinfo-defun-type '(defun-type "Function")) +(put 'defunx 'texinfo-defun-type '(defun-type "Function")) (put 'defun 'texinfo-defun-index 'texinfo-findex) (put 'defunx 'texinfo-defun-index 'texinfo-findex) (put 'defmac 'texinfo-format 'texinfo-format-defun) (put 'defmacx 'texinfo-format 'texinfo-format-defunx) (put 'defmac 'texinfo-end 'texinfo-end-defun) -(put 'defmac 'texinfo-defun-type '('defun-type "Macro")) -(put 'defmacx 'texinfo-defun-type '('defun-type "Macro")) +(put 'defmac 'texinfo-defun-type '(defun-type "Macro")) +(put 'defmacx 'texinfo-defun-type '(defun-type "Macro")) (put 'defmac 'texinfo-defun-index 'texinfo-findex) (put 'defmacx 'texinfo-defun-index 'texinfo-findex) (put 'defspec 'texinfo-format 'texinfo-format-defun) (put 'defspecx 'texinfo-format 'texinfo-format-defunx) (put 'defspec 'texinfo-end 'texinfo-end-defun) -(put 'defspec 'texinfo-defun-type '('defun-type "Special form")) -(put 'defspecx 'texinfo-defun-type '('defun-type "Special form")) +(put 'defspec 'texinfo-defun-type '(defun-type "Special form")) +(put 'defspecx 'texinfo-defun-type '(defun-type "Special form")) (put 'defspec 'texinfo-defun-index 'texinfo-findex) (put 'defspecx 'texinfo-defun-index 'texinfo-findex) (put 'defvr 'texinfo-format 'texinfo-format-defun) (put 'defvrx 'texinfo-format 'texinfo-format-defunx) (put 'defvr 'texinfo-end 'texinfo-end-defun) -(put 'defvr 'texinfo-defun-type '('deffn-type nil)) -(put 'defvrx 'texinfo-defun-type '('deffn-type nil)) +(put 'defvr 'texinfo-defun-type '(deffn-type nil)) +(put 'defvrx 'texinfo-defun-type '(deffn-type nil)) (put 'defvr 'texinfo-defun-index 'texinfo-vindex) (put 'defvrx 'texinfo-defun-index 'texinfo-vindex) (put 'defvar 'texinfo-format 'texinfo-format-defun) (put 'defvarx 'texinfo-format 'texinfo-format-defunx) (put 'defvar 'texinfo-end 'texinfo-end-defun) -(put 'defvar 'texinfo-defun-type '('defun-type "Variable")) -(put 'defvarx 'texinfo-defun-type '('defun-type "Variable")) +(put 'defvar 'texinfo-defun-type '(defun-type "Variable")) +(put 'defvarx 'texinfo-defun-type '(defun-type "Variable")) (put 'defvar 'texinfo-defun-index 'texinfo-vindex) (put 'defvarx 'texinfo-defun-index 'texinfo-vindex) (put 'defconst 'texinfo-format 'texinfo-format-defun) (put 'defconstx 'texinfo-format 'texinfo-format-defunx) (put 'defconst 'texinfo-end 'texinfo-end-defun) -(put 'defconst 'texinfo-defun-type '('defun-type "Constant")) -(put 'defconstx 'texinfo-defun-type '('defun-type "Constant")) +(put 'defconst 'texinfo-defun-type '(defun-type "Constant")) +(put 'defconstx 'texinfo-defun-type '(defun-type "Constant")) (put 'defconst 'texinfo-defun-index 'texinfo-vindex) (put 'defconstx 'texinfo-defun-index 'texinfo-vindex) (put 'defcmd 'texinfo-format 'texinfo-format-defun) (put 'defcmdx 'texinfo-format 'texinfo-format-defunx) (put 'defcmd 'texinfo-end 'texinfo-end-defun) -(put 'defcmd 'texinfo-defun-type '('defun-type "Command")) -(put 'defcmdx 'texinfo-defun-type '('defun-type "Command")) +(put 'defcmd 'texinfo-defun-type '(defun-type "Command")) +(put 'defcmdx 'texinfo-defun-type '(defun-type "Command")) (put 'defcmd 'texinfo-defun-index 'texinfo-findex) (put 'defcmdx 'texinfo-defun-index 'texinfo-findex) (put 'defopt 'texinfo-format 'texinfo-format-defun) (put 'defoptx 'texinfo-format 'texinfo-format-defunx) (put 'defopt 'texinfo-end 'texinfo-end-defun) -(put 'defopt 'texinfo-defun-type '('defun-type "User Option")) -(put 'defoptx 'texinfo-defun-type '('defun-type "User Option")) +(put 'defopt 'texinfo-defun-type '(defun-type "User Option")) +(put 'defoptx 'texinfo-defun-type '(defun-type "User Option")) (put 'defopt 'texinfo-defun-index 'texinfo-vindex) (put 'defoptx 'texinfo-defun-index 'texinfo-vindex) (put 'deftp 'texinfo-format 'texinfo-format-defun) (put 'deftpx 'texinfo-format 'texinfo-format-defunx) (put 'deftp 'texinfo-end 'texinfo-end-defun) -(put 'deftp 'texinfo-defun-type '('deftp-type nil)) -(put 'deftpx 'texinfo-defun-type '('deftp-type nil)) +(put 'deftp 'texinfo-defun-type '(deftp-type nil)) +(put 'deftpx 'texinfo-defun-type '(deftp-type nil)) (put 'deftp 'texinfo-defun-index 'texinfo-tindex) (put 'deftpx 'texinfo-defun-index 'texinfo-tindex) @@ -3857,32 +3858,32 @@ Default is to leave paragraph indentation as is." (put 'defop 'texinfo-format 'texinfo-format-defun) (put 'defopx 'texinfo-format 'texinfo-format-defunx) (put 'defop 'texinfo-end 'texinfo-end-defun) -(put 'defop 'texinfo-defun-type '('defop-type nil)) -(put 'defopx 'texinfo-defun-type '('defop-type nil)) +(put 'defop 'texinfo-defun-type '(defop-type nil)) +(put 'defopx 'texinfo-defun-type '(defop-type nil)) (put 'defop 'texinfo-defun-index 'texinfo-findex) (put 'defopx 'texinfo-defun-index 'texinfo-findex) (put 'defmethod 'texinfo-format 'texinfo-format-defun) (put 'defmethodx 'texinfo-format 'texinfo-format-defunx) (put 'defmethod 'texinfo-end 'texinfo-end-defun) -(put 'defmethod 'texinfo-defun-type '('defmethod-type "Method")) -(put 'defmethodx 'texinfo-defun-type '('defmethod-type "Method")) +(put 'defmethod 'texinfo-defun-type '(defmethod-type "Method")) +(put 'defmethodx 'texinfo-defun-type '(defmethod-type "Method")) (put 'defmethod 'texinfo-defun-index 'texinfo-findex) (put 'defmethodx 'texinfo-defun-index 'texinfo-findex) (put 'defcv 'texinfo-format 'texinfo-format-defun) (put 'defcvx 'texinfo-format 'texinfo-format-defunx) (put 'defcv 'texinfo-end 'texinfo-end-defun) -(put 'defcv 'texinfo-defun-type '('defop-type nil)) -(put 'defcvx 'texinfo-defun-type '('defop-type nil)) +(put 'defcv 'texinfo-defun-type '(defop-type nil)) +(put 'defcvx 'texinfo-defun-type '(defop-type nil)) (put 'defcv 'texinfo-defun-index 'texinfo-vindex) (put 'defcvx 'texinfo-defun-index 'texinfo-vindex) (put 'defivar 'texinfo-format 'texinfo-format-defun) (put 'defivarx 'texinfo-format 'texinfo-format-defunx) (put 'defivar 'texinfo-end 'texinfo-end-defun) -(put 'defivar 'texinfo-defun-type '('defmethod-type "Instance variable")) -(put 'defivarx 'texinfo-defun-type '('defmethod-type "Instance variable")) +(put 'defivar 'texinfo-defun-type '(defmethod-type "Instance variable")) +(put 'defivarx 'texinfo-defun-type '(defmethod-type "Instance variable")) (put 'defivar 'texinfo-defun-index 'texinfo-vindex) (put 'defivarx 'texinfo-defun-index 'texinfo-vindex) @@ -3891,32 +3892,32 @@ Default is to leave paragraph indentation as is." (put 'deftypefn 'texinfo-format 'texinfo-format-defun) (put 'deftypefnx 'texinfo-format 'texinfo-format-defunx) (put 'deftypefn 'texinfo-end 'texinfo-end-defun) -(put 'deftypefn 'texinfo-defun-type '('deftypefn-type nil)) -(put 'deftypefnx 'texinfo-defun-type '('deftypefn-type nil)) +(put 'deftypefn 'texinfo-defun-type '(deftypefn-type nil)) +(put 'deftypefnx 'texinfo-defun-type '(deftypefn-type nil)) (put 'deftypefn 'texinfo-defun-index 'texinfo-findex) (put 'deftypefnx 'texinfo-defun-index 'texinfo-findex) (put 'deftypefun 'texinfo-format 'texinfo-format-defun) (put 'deftypefunx 'texinfo-format 'texinfo-format-defunx) (put 'deftypefun 'texinfo-end 'texinfo-end-defun) -(put 'deftypefun 'texinfo-defun-type '('deftypefun-type "Function")) -(put 'deftypefunx 'texinfo-defun-type '('deftypefun-type "Function")) +(put 'deftypefun 'texinfo-defun-type '(deftypefun-type "Function")) +(put 'deftypefunx 'texinfo-defun-type '(deftypefun-type "Function")) (put 'deftypefun 'texinfo-defun-index 'texinfo-findex) (put 'deftypefunx 'texinfo-defun-index 'texinfo-findex) (put 'deftypevr 'texinfo-format 'texinfo-format-defun) (put 'deftypevrx 'texinfo-format 'texinfo-format-defunx) (put 'deftypevr 'texinfo-end 'texinfo-end-defun) -(put 'deftypevr 'texinfo-defun-type '('deftypefn-type nil)) -(put 'deftypevrx 'texinfo-defun-type '('deftypefn-type nil)) +(put 'deftypevr 'texinfo-defun-type '(deftypefn-type nil)) +(put 'deftypevrx 'texinfo-defun-type '(deftypefn-type nil)) (put 'deftypevr 'texinfo-defun-index 'texinfo-vindex) (put 'deftypevrx 'texinfo-defun-index 'texinfo-vindex) (put 'deftypevar 'texinfo-format 'texinfo-format-defun) (put 'deftypevarx 'texinfo-format 'texinfo-format-defunx) (put 'deftypevar 'texinfo-end 'texinfo-end-defun) -(put 'deftypevar 'texinfo-defun-type '('deftypevar-type "Variable")) -(put 'deftypevarx 'texinfo-defun-type '('deftypevar-type "Variable")) +(put 'deftypevar 'texinfo-defun-type '(deftypevar-type "Variable")) +(put 'deftypevarx 'texinfo-defun-type '(deftypevar-type "Variable")) (put 'deftypevar 'texinfo-defun-index 'texinfo-vindex) (put 'deftypevarx 'texinfo-defun-index 'texinfo-vindex) @@ -3943,7 +3944,8 @@ Default is to leave paragraph indentation as is." "Clear the value of the flag." (let* ((arg (texinfo-parse-arg-discard)) (flag (car (read-from-string arg))) - (value (substring arg (cdr (read-from-string arg))))) + ;; (value (substring arg (cdr (read-from-string arg)))) + ) (put flag 'texinfo-whether-setp 'flag-cleared) (put flag 'texinfo-set-value ""))) @@ -4043,7 +4045,7 @@ the @ifeq command." (goto-char texinfo-command-end) (let* ((case-fold-search t) (stop (save-excursion (forward-sexp 1) (point))) - start end + start ;; end ;; @ifeq{arg1, arg2, @command{optional-args}} (arg1 (progn diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 278cd0cd848..750a33db0aa 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -1,4 +1,4 @@ -;;; texinfo.el --- major mode for editing Texinfo files +;;; texinfo.el --- major mode for editing Texinfo files -*- lexical-binding: t; -*- ;; Copyright (C) 1985, 1988-1993, 1996-1997, 2000-2021 Free Software ;; Foundation, Inc. @@ -373,7 +373,7 @@ Subexpression 1 is what goes into the corresponding `@end' statement.") ("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-keyword-face keep) ;; (,texinfo-environment-regexp ;; 1 (texinfo-clone-environment (match-beginning 1) (match-end 1)) keep) - (,(concat "^@" (regexp-opt (mapcar 'car texinfo-section-list) t) + (,(concat "^@" (regexp-opt (mapcar #'car texinfo-section-list) t) ".*\n") 0 'texinfo-heading t)) "Additional expressions to highlight in Texinfo mode.") @@ -400,19 +400,21 @@ Subexpression 1 is what goes into the corresponding `@end' statement.") ;;; Keys common both to Texinfo mode and to TeX shell. +(declare-function tex-show-print-queue "tex-mode" ()) + (defun texinfo-define-common-keys (keymap) "Define the keys both in Texinfo mode and in the texinfo-tex-shell." - (define-key keymap "\C-c\C-t\C-k" 'tex-kill-job) - (define-key keymap "\C-c\C-t\C-x" 'texinfo-quit-job) - (define-key keymap "\C-c\C-t\C-l" 'tex-recenter-output-buffer) - (define-key keymap "\C-c\C-t\C-d" 'texinfo-delete-from-print-queue) - (define-key keymap "\C-c\C-t\C-q" 'tex-show-print-queue) - (define-key keymap "\C-c\C-t\C-p" 'texinfo-tex-print) - (define-key keymap "\C-c\C-t\C-v" 'texinfo-tex-view) - (define-key keymap "\C-c\C-t\C-i" 'texinfo-texindex) - - (define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region) - (define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer)) + (define-key keymap "\C-c\C-t\C-k" #'tex-kill-job) + (define-key keymap "\C-c\C-t\C-x" #'texinfo-quit-job) + (define-key keymap "\C-c\C-t\C-l" #'tex-recenter-output-buffer) + (define-key keymap "\C-c\C-t\C-d" #'texinfo-delete-from-print-queue) + (define-key keymap "\C-c\C-t\C-q" #'tex-show-print-queue) + (define-key keymap "\C-c\C-t\C-p" #'texinfo-tex-print) + (define-key keymap "\C-c\C-t\C-v" #'texinfo-tex-view) + (define-key keymap "\C-c\C-t\C-i" #'texinfo-texindex) + + (define-key keymap "\C-c\C-t\C-r" #'texinfo-tex-region) + (define-key keymap "\C-c\C-t\C-b" #'texinfo-tex-buffer)) ;; Mode documentation displays commands in reverse order ;; from how they are listed in the texinfo-mode-map. @@ -423,68 +425,68 @@ Subexpression 1 is what goes into the corresponding `@end' statement.") ;; bindings for `texnfo-tex.el' (texinfo-define-common-keys map) - (define-key map "\"" 'texinfo-insert-quote) + (define-key map "\"" #'texinfo-insert-quote) ;; bindings for `makeinfo.el' - (define-key map "\C-c\C-m\C-k" 'kill-compilation) + (define-key map "\C-c\C-m\C-k" #'kill-compilation) (define-key map "\C-c\C-m\C-l" - 'makeinfo-recenter-compilation-buffer) - (define-key map "\C-c\C-m\C-r" 'makeinfo-region) - (define-key map "\C-c\C-m\C-b" 'makeinfo-buffer) + #'makeinfo-recenter-compilation-buffer) + (define-key map "\C-c\C-m\C-r" #'makeinfo-region) + (define-key map "\C-c\C-m\C-b" #'makeinfo-buffer) ;; bindings for `texinfmt.el' - (define-key map "\C-c\C-e\C-r" 'texinfo-format-region) - (define-key map "\C-c\C-e\C-b" 'texinfo-format-buffer) + (define-key map "\C-c\C-e\C-r" #'texinfo-format-region) + (define-key map "\C-c\C-e\C-b" #'texinfo-format-buffer) ;; AUCTeX-like bindings - (define-key map "\e\r" 'texinfo-insert-@item) + (define-key map "\e\r" #'texinfo-insert-@item) ;; bindings for updating nodes and menus - (define-key map "\C-c\C-um" 'texinfo-master-menu) + (define-key map "\C-c\C-um" #'texinfo-master-menu) - (define-key map "\C-c\C-u\C-m" 'texinfo-make-menu) - (define-key map "\C-c\C-u\C-n" 'texinfo-update-node) - (define-key map "\C-c\C-u\C-e" 'texinfo-every-node-update) - (define-key map "\C-c\C-u\C-a" 'texinfo-all-menus-update) + (define-key map "\C-c\C-u\C-m" #'texinfo-make-menu) + (define-key map "\C-c\C-u\C-n" #'texinfo-update-node) + (define-key map "\C-c\C-u\C-e" #'texinfo-every-node-update) + (define-key map "\C-c\C-u\C-a" #'texinfo-all-menus-update) - (define-key map "\C-c\C-s" 'texinfo-show-structure) + (define-key map "\C-c\C-s" #'texinfo-show-structure) - (define-key map "\C-c}" 'up-list) + (define-key map "\C-c}" #'up-list) ;; FIXME: This is often used for "close block" aka texinfo-insert-@end. - (define-key map "\C-c]" 'up-list) - (define-key map "\C-c/" 'texinfo-insert-@end) - (define-key map "\C-c{" 'texinfo-insert-braces) + (define-key map "\C-c]" #'up-list) + (define-key map "\C-c/" #'texinfo-insert-@end) + (define-key map "\C-c{" #'texinfo-insert-braces) ;; bindings for inserting strings - (define-key map "\C-c\C-o" 'texinfo-insert-block) - (define-key map "\C-c\C-c\C-d" 'texinfo-start-menu-description) - (define-key map "\C-c\C-c\C-s" 'texinfo-insert-@strong) - (define-key map "\C-c\C-c\C-e" 'texinfo-insert-@emph) - - (define-key map "\C-c\C-cv" 'texinfo-insert-@var) - (define-key map "\C-c\C-cu" 'texinfo-insert-@uref) - (define-key map "\C-c\C-ct" 'texinfo-insert-@table) - (define-key map "\C-c\C-cs" 'texinfo-insert-@samp) - (define-key map "\C-c\C-cr" 'texinfo-insert-dwim-@ref) - (define-key map "\C-c\C-cq" 'texinfo-insert-@quotation) - (define-key map "\C-c\C-co" 'texinfo-insert-@noindent) - (define-key map "\C-c\C-cn" 'texinfo-insert-@node) - (define-key map "\C-c\C-cm" 'texinfo-insert-@email) - (define-key map "\C-c\C-ck" 'texinfo-insert-@kbd) - (define-key map "\C-c\C-ci" 'texinfo-insert-@item) - (define-key map "\C-c\C-cf" 'texinfo-insert-@file) - (define-key map "\C-c\C-cx" 'texinfo-insert-@example) - (define-key map "\C-c\C-ce" 'texinfo-insert-@end) - (define-key map "\C-c\C-cd" 'texinfo-insert-@dfn) - (define-key map "\C-c\C-cc" 'texinfo-insert-@code) + (define-key map "\C-c\C-o" #'texinfo-insert-block) + (define-key map "\C-c\C-c\C-d" #'texinfo-start-menu-description) + (define-key map "\C-c\C-c\C-s" #'texinfo-insert-@strong) + (define-key map "\C-c\C-c\C-e" #'texinfo-insert-@emph) + + (define-key map "\C-c\C-cv" #'texinfo-insert-@var) + (define-key map "\C-c\C-cu" #'texinfo-insert-@uref) + (define-key map "\C-c\C-ct" #'texinfo-insert-@table) + (define-key map "\C-c\C-cs" #'texinfo-insert-@samp) + (define-key map "\C-c\C-cr" #'texinfo-insert-dwim-@ref) + (define-key map "\C-c\C-cq" #'texinfo-insert-@quotation) + (define-key map "\C-c\C-co" #'texinfo-insert-@noindent) + (define-key map "\C-c\C-cn" #'texinfo-insert-@node) + (define-key map "\C-c\C-cm" #'texinfo-insert-@email) + (define-key map "\C-c\C-ck" #'texinfo-insert-@kbd) + (define-key map "\C-c\C-ci" #'texinfo-insert-@item) + (define-key map "\C-c\C-cf" #'texinfo-insert-@file) + (define-key map "\C-c\C-cx" #'texinfo-insert-@example) + (define-key map "\C-c\C-ce" #'texinfo-insert-@end) + (define-key map "\C-c\C-cd" #'texinfo-insert-@dfn) + (define-key map "\C-c\C-cc" #'texinfo-insert-@code) ;; bindings for environment movement - (define-key map "\C-c." 'texinfo-to-environment-bounds) - (define-key map "\C-c\C-c\C-f" 'texinfo-next-environment-end) - (define-key map "\C-c\C-c\C-b" 'texinfo-previous-environment-end) - (define-key map "\C-c\C-c\C-n" 'texinfo-next-environment-start) - (define-key map "\C-c\C-c\C-p" 'texinfo-previous-environment-start) + (define-key map "\C-c." #'texinfo-to-environment-bounds) + (define-key map "\C-c\C-c\C-f" #'texinfo-next-environment-end) + (define-key map "\C-c\C-c\C-b" #'texinfo-previous-environment-end) + (define-key map "\C-c\C-c\C-n" #'texinfo-next-environment-start) + (define-key map "\C-c\C-c\C-p" #'texinfo-previous-environment-start) map)) (easy-menu-define texinfo-mode-menu @@ -624,7 +626,7 @@ value of `texinfo-mode-hook'." (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x))) texinfo-section-list)) (setq-local outline-regexp - (concat (regexp-opt (mapcar 'car outline-heading-alist) t) + (concat (regexp-opt (mapcar #'car outline-heading-alist) t) "\\>")) (setq-local tex-start-of-header "%\\*\\*start") @@ -893,7 +895,7 @@ A numeric argument says how many words the braces should surround. The default is not to surround any existing words with the braces." nil "@uref{" _ "}") -(defalias 'texinfo-insert-@url 'texinfo-insert-@uref) +(defalias 'texinfo-insert-@url #'texinfo-insert-@uref) ;;; Texinfo file structure diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el index 04778ee94d4..27807a95e60 100644 --- a/lisp/textmodes/texnfo-upd.el +++ b/lisp/textmodes/texnfo-upd.el @@ -1,4 +1,4 @@ -;;; texnfo-upd.el --- utilities for updating nodes and menus in Texinfo files +;;; texnfo-upd.el --- utilities for updating nodes and menus in Texinfo files -*- lexical-binding: t; -*- ;; Copyright (C) 1989-1992, 2001-2021 Free Software Foundation, Inc. @@ -420,7 +420,7 @@ of the node if one is found; else do not move point." "\\|" ; or "\\(^@ifnottex[ ]*\n\\)" ; ifnottex line, if any "\\)?" ; end of expression - (eval (cdr (assoc level texinfo-update-menu-lower-regexps)))) + (eval (cdr (assoc level texinfo-update-menu-lower-regexps)) t)) ;; the next higher level node marks the end of this ;; section, and no lower level node will be found beyond ;; this position even if region-end is farther off @@ -454,7 +454,7 @@ if the match is found there, the value is t and point does not move." "\\|" ; or "\\(^@ifnottex[ ]*\n\\)" ; ifnottex line, if any "\\)?" ; end of expression - (eval (cdr (assoc level texinfo-update-menu-higher-regexps)))) + (eval (cdr (assoc level texinfo-update-menu-higher-regexps)) t)) region-end t) (beginning-of-line) t))))) @@ -505,7 +505,7 @@ The function finds entries of the same type. Thus `subsections' and "\\(^@ifnottex[ ]*\n\\)" ; ifnottex line, if any "\\)?" ; end of expression (eval - (cdr (assoc level texinfo-update-menu-same-level-regexps)))) + (cdr (assoc level texinfo-update-menu-same-level-regexps)) t)) search-end t) (goto-char (match-beginning 1))))) @@ -742,7 +742,7 @@ You will need to edit the inserted text since a useful description complements the node name rather than repeats it as a title does." (interactive) - (let (beginning end node-name title) + (let (beginning node-name title) ;; end (save-excursion (beginning-of-line) (if (search-forward "* " (line-end-position) t) @@ -1219,7 +1219,7 @@ Only argument is a string of the general type of section." "\\(^@ifnottex[ ]*\n\\)" ; ifnottex line, if any "\\)?" ; end of expression (eval - (cdr (assoc level texinfo-update-menu-higher-regexps)))) + (cdr (assoc level texinfo-update-menu-higher-regexps)) t)) nil 'goto-beginning) (point)))))) @@ -1243,7 +1243,7 @@ string of the general type of section." "\\)?" ; end of expression (eval ;; Never finds end of level above chapter so goes to end. - (cdr (assoc level texinfo-update-menu-higher-regexps)))) + (cdr (assoc level texinfo-update-menu-higher-regexps)) t)) nil 'goto-end) (match-beginning 1) @@ -1430,7 +1430,7 @@ will be at some level higher in the Texinfo file. The fourth argument "\\(^@ifnottex[ ]*\n\\)" "\\)?") (eval - (cdr (assoc level texinfo-update-menu-same-level-regexps)))) + (cdr (assoc level texinfo-update-menu-same-level-regexps)) t)) end t) 'normal @@ -1451,7 +1451,7 @@ will be at some level higher in the Texinfo file. The fourth argument "\\(^@ifnottex[ ]*\n\\)" "\\)?") (eval - (cdr (assoc level texinfo-update-menu-same-level-regexps))) + (cdr (assoc level texinfo-update-menu-same-level-regexps)) t) "\\|" ;; Match node line. "\\(^@node\\).*\n" @@ -1465,7 +1465,7 @@ will be at some level higher in the Texinfo file. The fourth argument "\\(^@ifnottex[ ]*\n\\)" "\\)?") (eval - (cdr (assoc level texinfo-update-menu-higher-regexps))) + (cdr (assoc level texinfo-update-menu-higher-regexps)) t) "\\|" ;; Handle `Top' node specially. "^@node [ \t]*top[ \t]*\\(,\\|$\\)" @@ -1489,7 +1489,7 @@ will be at some level higher in the Texinfo file. The fourth argument "\\|" "\\(^@ifnottex[ ]*\n\\)" "\\)?") - (eval (cdr (assoc level texinfo-update-menu-higher-regexps))) + (eval (cdr (assoc level texinfo-update-menu-higher-regexps)) t) "\\|" ;; Handle `Top' node specially. "^@node [ \t]*top[ \t]*\\(,\\|$\\)" @@ -1662,7 +1662,7 @@ or `Up' pointer." 'no-pointer)) ((eq direction 'up) (if (re-search-backward - (eval (cdr (assoc level texinfo-update-menu-higher-regexps))) + (eval (cdr (assoc level texinfo-update-menu-higher-regexps)) t) (point-min) t) 'normal @@ -1686,7 +1686,7 @@ node names in pre-existing `@node' lines that lack names." ;; Use marker; after inserting node lines, leave point at end of ;; region and mark at beginning. - (let (beginning-marker end-marker title last-section-position) + (let (end-marker title last-section-position) ;; beginning-marker ;; Save current position on mark ring and set mark to end. (push-mark end t) @@ -2043,8 +2043,8 @@ chapter." (let* ((included-file-list (texinfo-multi-file-included-list outer-file)) (files included-file-list) - next-node-name - previous-node-name + ;; next-node-name + ;; previous-node-name ;; Update the pointers and collect the names of the nodes and titles (main-menu-list (texinfo-multi-file-update files update-everything))) diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index 7836bd46bc5..ffeb9e64dd7 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el @@ -69,7 +69,7 @@ (defvar text-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\e\t" 'ispell-complete-word) + (define-key map "\e\t" #'ispell-complete-word) map) "Keymap for `text-mode'. Many other modes, such as `mail-mode', `outline-mode' and `indented-text-mode', @@ -141,7 +141,7 @@ Turning on Paragraph-Indent minor mode runs the normal hook (remove-function (local 'indent-line-function) #'indent-to-left-margin))) -(defalias 'indented-text-mode 'text-mode) +(defalias 'indented-text-mode #'text-mode) ;; This can be made a no-op once all modes that use text-mode-hook ;; are "derived" from text-mode. (As of 2015/04, and probably well before, diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el index 1d90562ae22..069c8e3f443 100644 --- a/lisp/textmodes/tildify.el +++ b/lisp/textmodes/tildify.el @@ -289,7 +289,7 @@ variable. For example, for an XML file one might use: (setq-local tildify-foreach-region-function (apply-partially \\='tildify-foreach-ignore-environments \\='((\"<! *--\" . \"-- *>\") (\"<\" . \">\"))))" - (let ((beg-re (concat "\\(?:" (mapconcat 'car pairs "\\)\\|\\(?:") "\\)")) + (let ((beg-re (concat "\\(?:" (mapconcat #'car pairs "\\)\\|\\(?:") "\\)")) p end-re) (save-excursion (save-restriction @@ -499,8 +499,8 @@ variable will be set to the representation." "mode won't have any effect, disabling."))) (setq tildify-mode nil)))) (if tildify-mode - (add-hook 'post-self-insert-hook 'tildify-space nil t) - (remove-hook 'post-self-insert-hook 'tildify-space t))) + (add-hook 'post-self-insert-hook #'tildify-space nil t) + (remove-hook 'post-self-insert-hook #'tildify-space t))) ;;; *** Announce *** diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el index 9c0ed8fbd55..6c3bacc647f 100644 --- a/lisp/textmodes/two-column.el +++ b/lisp/textmodes/two-column.el @@ -1,4 +1,4 @@ -;;; two-column.el --- minor mode for editing of two-column text +;;; two-column.el --- minor mode for editing of two-column text -*- lexical-binding: t; -*- ;; Copyright (C) 1992-1995, 2001-2021 Free Software Foundation, Inc. @@ -165,10 +165,10 @@ minus this value." (defvar 2C-mode-map (let ((map (make-sparse-keymap))) - (define-key map "2" '2C-two-columns) - (define-key map [f2] '2C-two-columns) - (define-key map "b" '2C-associate-buffer) - (define-key map "s" '2C-split) + (define-key map "2" #'2C-two-columns) + (define-key map [f2] #'2C-two-columns) + (define-key map "b" #'2C-associate-buffer) + (define-key map "s" #'2C-split) map) "Keymap for commands for setting up two-column mode.") @@ -178,19 +178,19 @@ minus this value." ;; This one is for historical reasons and simple keyboards, it is not ;; at all mnemonic. All usual sequences containing 2 were used, and ;; f2 could not be set up in a standard way under Emacs 18. -;;;###autoload (global-set-key "\C-x6" '2C-command) +;;;###autoload (global-set-key "\C-x6" #'2C-command) -;;;###autoload (global-set-key [f2] '2C-command) +;;;###autoload (global-set-key [f2] #'2C-command) (defvar 2C-minor-mode-map (let ((map (make-sparse-keymap))) - (define-key map "1" '2C-merge) - (define-key map "d" '2C-dissociate) - (define-key map "o" '2C-associated-buffer) - (define-key map "\^m" '2C-newline) - (define-key map "|" '2C-toggle-autoscroll) - (define-key map "{" '2C-shrink-window-horizontally) - (define-key map "}" '2C-enlarge-window-horizontally) + (define-key map "1" #'2C-merge) + (define-key map "d" #'2C-dissociate) + (define-key map "o" #'2C-associated-buffer) + (define-key map "\^m" #'2C-newline) + (define-key map "|" #'2C-toggle-autoscroll) + (define-key map "{" #'2C-shrink-window-horizontally) + (define-key map "}" #'2C-enlarge-window-horizontally) map) "Keymap for commands for use in two-column mode.") @@ -275,7 +275,7 @@ some prefix. The appearance of the screen can be customized by the variables `2C-window-width', `2C-beyond-fill-column', `2C-mode-line-format' and `truncate-partial-width-windows'." - (add-hook 'post-command-hook '2C-autoscroll nil t) + (add-hook 'post-command-hook #'2C-autoscroll nil t) (setq fill-column (- 2C-window-width 2C-beyond-fill-column) mode-line-format 2C-mode-line-format diff --git a/lisp/tooltip.el b/lisp/tooltip.el index af3b86bba71..03d9f54ea6c 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el @@ -131,7 +131,11 @@ of the `tooltip' face are used instead." :inherit variable-pitch) (t :inherit variable-pitch)) - "Face for tooltips." + "Face for tooltips. + +When using the GTK toolkit, this face will only be used if +`x-gtk-use-system-tooltips' is non-nil." + :group 'tooltip :group 'basic-faces) (defcustom tooltip-use-echo-area nil diff --git a/lisp/uniquify.el b/lisp/uniquify.el index c1ec90e2908..1d513d60376 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el @@ -175,8 +175,8 @@ contains the name of the directory which the buffer is visiting.") (cl-defstruct (uniquify-item (:constructor nil) (:copier nil) (:constructor uniquify-make-item - (base dirname buffer &optional proposed))) - base dirname buffer proposed) + (base dirname buffer &optional proposed original-dirname))) + base dirname buffer proposed original-dirname) ;; Internal variables used free (defvar uniquify-possibly-resolvable nil) @@ -211,7 +211,8 @@ this rationalization." (with-current-buffer newbuf (setq uniquify-managed nil)) (when dirname (setq dirname (expand-file-name (directory-file-name dirname))) - (let ((fix-list (list (uniquify-make-item base dirname newbuf))) + (let ((fix-list (list (uniquify-make-item base dirname newbuf + nil dirname))) items) (dolist (buffer (buffer-list)) (when (and (not (and uniquify-ignore-buffers-re @@ -284,7 +285,9 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil." ;; Refresh the dirnames and proposed names. (setf (uniquify-item-proposed item) (uniquify-get-proposed-name (uniquify-item-base item) - (uniquify-item-dirname item))) + (uniquify-item-dirname item) + nil + (uniquify-item-original-dirname item))) (setq uniquify-managed fix-list))) ;; Strip any shared last directory names of the dirname. (when (and (cdr fix-list) uniquify-strip-common-suffix) @@ -307,7 +310,8 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil." (uniquify-item-dirname item)))) (and f (directory-file-name f))) (uniquify-item-buffer item) - (uniquify-item-proposed item)) + (uniquify-item-proposed item) + (uniquify-item-original-dirname item)) fix-list))))) ;; If uniquify-min-dir-content is 0, this will end up just ;; passing fix-list to uniquify-rationalize-conflicting-sublist. @@ -335,13 +339,14 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil." (uniquify-rationalize-conflicting-sublist conflicting-sublist old-proposed depth))) -(defun uniquify-get-proposed-name (base dirname &optional depth) +(defun uniquify-get-proposed-name (base dirname &optional depth + original-dirname) (unless depth (setq depth uniquify-min-dir-content)) (cl-assert (equal (directory-file-name dirname) dirname)) ;No trailing slash. ;; Distinguish directories by adding extra separator. (if (and uniquify-trailing-separator-p - (file-directory-p (expand-file-name base dirname)) + (file-directory-p (expand-file-name base original-dirname)) (not (string-equal base ""))) (cond ((eq uniquify-buffer-name-style 'forward) (setq base (file-name-as-directory base))) @@ -410,7 +415,8 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil." (uniquify-get-proposed-name (uniquify-item-base item) (uniquify-item-dirname item) - depth))) + depth + (uniquify-item-original-dirname item)))) (uniquify-rationalize-a-list conf-list depth)) (unless (string= old-name "") (uniquify-rename-buffer (car conf-list) old-name))))) diff --git a/lisp/vc/ediff-vers.el b/lisp/vc/ediff-vers.el index 13a653b270b..9e82392725d 100644 --- a/lisp/vc/ediff-vers.el +++ b/lisp/vc/ediff-vers.el @@ -24,23 +24,9 @@ ;;; Code: -;; Compiler pacifier -(defvar rcs-default-co-switches) +(eval-when-compile (require 'ediff-init)) -(and noninteractive - (eval-when-compile - (condition-case nil - ;; for compatibility with current stable version of xemacs - (progn - ;;(require 'pcvs nil 'noerror) - ;;(require 'rcs nil 'noerror) - (require 'pcvs) - (require 'rcs)) - (error nil)) - (require 'vc) - (require 'ediff-init) - )) -;; end pacifier +(defvar rcs-default-co-switches) (defcustom ediff-keep-tmp-versions nil "If t, do not delete temporary previous versions for the files on which diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index de2b5d4a7c8..e71290c7ef9 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -131,16 +131,21 @@ This exists as a variable so it can be set locally in certain buffers.") (((class grayscale color) (background light)) :background "gray85" + ;; We use negative thickness of the horizontal box border line to + ;; avoid making lines taller when fields become visible. + :box (:line-width (1 . -1) :color "gray80") :extend t) (((class grayscale color) (background dark)) :background "dim gray" + :box (:line-width (1 . -1) :color "gray46") :extend t) (t :slant italic :extend t)) "Face used for editable fields." - :group 'widget-faces) + :group 'widget-faces + :version "28.1") (defface widget-single-line-field '((((type tty)) :background "green3" @@ -4029,7 +4034,7 @@ is inline." (mapcar #'length (defined-colors)))) :tag "Color" :value "black" - :completions (or facemenu-color-alist (defined-colors)) + :completions (defined-colors) :sample-face-get 'widget-color-sample-face-get :notify 'widget-color-notify :match #'widget-color-match @@ -4044,7 +4049,10 @@ is inline." :tag " Choose " :action 'widget-color--choose-action) (widget-insert " ")) +(declare-function list-colors-display "facemenu") + (defun widget-color--choose-action (widget &optional _event) + (require 'facemenu) (list-colors-display nil nil (let ((cbuf (current-buffer)) @@ -4067,8 +4075,11 @@ is inline." (list (cons 'foreground-color value)) 'default))) +(declare-function facemenu-read-color "facemenu") + (defun widget-color-action (widget &optional event) "Prompt for a color." + (require 'facemenu) (let* ((tag (widget-apply widget :menu-tag-get)) (prompt (concat tag ": ")) (answer (facemenu-read-color prompt))) diff --git a/src/dispnew.c b/src/dispnew.c index b3e4587250f..f613f7b6568 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3588,6 +3588,7 @@ update_window (struct window *w, bool force_p) int yb; bool changed_p = 0, mouse_face_overwritten_p = 0; int n_updated = 0; + bool invisible_rows_marked = false; #ifdef HAVE_WINDOW_SYSTEM gui_update_window_begin (w); @@ -3679,13 +3680,36 @@ update_window (struct window *w, bool force_p) tempted to optimize redisplay based on lines displayed in the first redisplay. */ if (MATRIX_ROW_BOTTOM_Y (row) >= yb) - for (i = vpos + 1; i < w->current_matrix->nrows - 1; ++i) - SET_MATRIX_ROW_ENABLED_P (w->current_matrix, i, false); + { + for (i = vpos + 1; i < w->current_matrix->nrows - 1; ++i) + SET_MATRIX_ROW_ENABLED_P (w->current_matrix, i, false); + invisible_rows_marked = true; + } } /* Was display preempted? */ paused_p = row < end; + if (!paused_p && !invisible_rows_marked) + { + /* If we didn't mark the invisible rows in the current + matrix as invalid above, do that now. This can happen if + scrolling_window updates the last visible rows of the + current matrix, in which case the above loop doesn't get + to examine the last visible row. */ + int i; + for (i = 0; i < w->current_matrix->nrows - 1; ++i) + { + struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, i); + if (current_row->enabled_p + && MATRIX_ROW_BOTTOM_Y (current_row) >= yb) + { + for (++i ; i < w->current_matrix->nrows - 1; ++i) + SET_MATRIX_ROW_ENABLED_P (w->current_matrix, i, false); + } + } + } + set_cursor: /* Update the tab line after scrolling because a new tab diff --git a/src/editfns.c b/src/editfns.c index fb20fc96550..bc6553a7d2c 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1697,7 +1697,11 @@ they can be in either order. */) DEFUN ("buffer-string", Fbuffer_string, Sbuffer_string, 0, 0, 0, doc: /* Return the contents of the current buffer as a string. If narrowing is in effect, this function returns only the visible part -of the buffer. */) +of the buffer. + +This function copies the text properties of that part of the buffer +into the result string; if you don’t want the text properties, +use `buffer-substring-no-properties' instead. */) (void) { return make_buffer_string_both (BEGV, BEGV_BYTE, ZV, ZV_BYTE, 1); diff --git a/src/frame.c b/src/frame.c index a62347c1fb2..cfdf3b61938 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3595,7 +3595,7 @@ check_frame_pixels (Lisp_Object size, Lisp_Object pixelwise, int item_size) } DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 4, - "(list (selected-frame) (prefix-numeric-value current-prefix-arg))", + "(set-frame-property--interactive \"Frame height: \" (frame-height))", doc: /* Set text height of frame FRAME to HEIGHT lines. Optional third arg PRETEND non-nil means that redisplay should use HEIGHT lines but that the idea of the actual height of the frame should @@ -3620,7 +3620,7 @@ If FRAME is nil, it defaults to the selected frame. */) } DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 4, - "(list (selected-frame) (prefix-numeric-value current-prefix-arg))", + "(set-frame-property--interactive \"Frame width: \" (frame-width))", doc: /* Set text width of frame FRAME to WIDTH columns. Optional third arg PRETEND non-nil means that redisplay should use WIDTH columns but that the idea of the actual width of the frame should not diff --git a/src/gtkutil.c b/src/gtkutil.c index 11e59b9fae5..4634c35dd4c 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -5014,11 +5014,10 @@ update_frame_tool_bar (struct frame *f) GtkWidget *wbutton = NULL; Lisp_Object specified_file; bool vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY)); - const char *label - = (EQ (style, Qimage) || (vert_only && horiz)) ? NULL - : STRINGP (PROP (TOOL_BAR_ITEM_LABEL)) - ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) - : ""; + Lisp_Object label + = (EQ (style, Qimage) || (vert_only && horiz)) + ? Qnil + : PROP (TOOL_BAR_ITEM_LABEL); ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), j); @@ -5131,8 +5130,11 @@ update_frame_tool_bar (struct frame *f) /* If there is an existing widget, check if it's stale; if so, remove it and make a new tool item from scratch. */ - if (ti && xg_tool_item_stale_p (wbutton, stock_name, icon_name, - img, label, horiz)) + if (ti && xg_tool_item_stale_p (wbutton, stock_name, icon_name, img, + NILP (label) + ? NULL + : STRINGP (label) ? SSDATA (label) : "", + horiz)) { gtk_container_remove (GTK_CONTAINER (wtoolbar), GTK_WIDGET (ti)); @@ -5189,7 +5191,11 @@ update_frame_tool_bar (struct frame *f) #else if (w) gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); #endif - ti = xg_make_tool_item (f, w, &wbutton, label, i, horiz, text_image); + ti = xg_make_tool_item (f, w, &wbutton, + NILP (label) + ? NULL + : STRINGP (label) ? SSDATA (label) : "", + i, horiz, text_image); gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, j); } diff --git a/src/image.c b/src/image.c index 2f85e3035e8..576956d4dbb 100644 --- a/src/image.c +++ b/src/image.c @@ -3392,6 +3392,7 @@ static int xbm_scan (char **s, char *end, char *sval, int *ival) { unsigned char c UNINIT; + char *sval_end = sval + BUFSIZ; loop: @@ -3451,7 +3452,7 @@ xbm_scan (char **s, char *end, char *sval, int *ival) else if (c_isalpha (c) || c == '_') { *sval++ = c; - while (*s < end + while (*s < end && sval < sval_end && (c = *(*s)++, (c_isalnum (c) || c == '_'))) *sval++ = c; *sval = 0; diff --git a/src/keyboard.c b/src/keyboard.c index 9ee4c4f6d68..266ebaa5fdf 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3614,6 +3614,12 @@ kbd_buffer_store_buffered_event (union buffered_input_event *event, case ICONIFY_EVENT: ignore_event = Qiconify_frame; break; case DEICONIFY_EVENT: ignore_event = Qmake_frame_visible; break; case SELECTION_REQUEST_EVENT: ignore_event = Qselection_request; break; +#ifdef USE_FILE_NOTIFY + case FILE_NOTIFY_EVENT: ignore_event = Qfile_notify; break; +#endif +#ifdef HAVE_DBUS + case DBUS_EVENT: ignore_event = Qdbus_event; break; +#endif default: ignore_event = Qnil; break; } @@ -6679,6 +6685,7 @@ parse_solitary_modifier (Lisp_Object symbol) case 'c': MULTI_LETTER_MOD (ctrl_modifier, "ctrl", 4); MULTI_LETTER_MOD (ctrl_modifier, "control", 7); + MULTI_LETTER_MOD (click_modifier, "click", 5); break; case 'H': @@ -12380,8 +12387,6 @@ syms_of_keyboard_for_pdumper (void) eassert (initial_kboard == NULL); initial_kboard = allocate_kboard (Qt); - Vwhile_no_input_ignore_events = Qnil; - inhibit_record_char = false; } diff --git a/test/README b/test/README index 1e0e43a8aca..a348074aba7 100644 --- a/test/README +++ b/test/README @@ -22,7 +22,10 @@ following tags are recognized: * :unstable The test is under development. It shall run on demand only. -The Makefile in this directory supports the following targets: +The Makefile sets the environment variable $EMACS_TEST_DIRECTORY, +which points to this directory. This environment variable does not +exist when the tests are run outside make. The Makefile supports the +following targets: * make check Run all tests as defined in the directory. Expensive and unstable @@ -113,6 +116,7 @@ Some optional tests require packages from GNU ELPA. By default out somewhere else, use make GNU_ELPA_DIRECTORY=/path/to/elpa ... + There are also continuous integration tests on <https://hydra.nixos.org/jobset/gnu/emacs-trunk> (see diff --git a/test/lisp/cedet/semantic-utest.el b/test/lisp/cedet/semantic-utest.el index 67de4a5b02d..172ab62f895 100644 --- a/test/lisp/cedet/semantic-utest.el +++ b/test/lisp/cedet/semantic-utest.el @@ -1,6 +1,6 @@ ;;; semantic-utest.el --- Tests for semantic's parsing system. -*- lexical-binding:t -*- -;;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 2003-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> diff --git a/test/lisp/cedet/semantic/bovine/gcc-tests.el b/test/lisp/cedet/semantic/bovine/gcc-tests.el index e1a18c6c64c..93677d6c871 100644 --- a/test/lisp/cedet/semantic/bovine/gcc-tests.el +++ b/test/lisp/cedet/semantic/bovine/gcc-tests.el @@ -1,6 +1,6 @@ ;;; gcc-tests.el --- Tests for semantic/bovine/gcc.el -*- lexical-binding:t -*- -;;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 2003-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> diff --git a/test/lisp/cedet/semantic/format-resources/test-fmt.el b/test/lisp/cedet/semantic/format-resources/test-fmt.el index 941aaae8595..8458a8e6510 100644 --- a/test/lisp/cedet/semantic/format-resources/test-fmt.el +++ b/test/lisp/cedet/semantic/format-resources/test-fmt.el @@ -1,6 +1,6 @@ ;;; test-fmt.el --- test semantic tag formatting -*- lexical-binding: t -*- -;;; Copyright (C) 2012, 2019-2021 Free Software Foundation, Inc. +;; Copyright (C) 2012-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> diff --git a/test/lisp/cedet/semantic/format-tests.el b/test/lisp/cedet/semantic/format-tests.el index e82c97b4c43..149f408af15 100644 --- a/test/lisp/cedet/semantic/format-tests.el +++ b/test/lisp/cedet/semantic/format-tests.el @@ -1,6 +1,6 @@ ;;; semantic/format-tests.el --- Parsing / Formatting tests -*- lexical-binding:t -*- -;;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 2003-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> diff --git a/test/lisp/cedet/semantic/fw-tests.el b/test/lisp/cedet/semantic/fw-tests.el index 62d665dbb6e..7b1cd21bd1b 100644 --- a/test/lisp/cedet/semantic/fw-tests.el +++ b/test/lisp/cedet/semantic/fw-tests.el @@ -1,6 +1,6 @@ ;;; fw-tests.el --- Tests for semantic/fw.el -*- lexical-binding:t -*- -;;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 2003-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el index de1bc548e18..8a9a41f452f 100644 --- a/test/lisp/comint-tests.el +++ b/test/lisp/comint-tests.el @@ -44,6 +44,7 @@ "Password (again):" "Enter password:" "Enter Auth Password:" ; OpenVPN (Bug#35724) + "Verify password: " ; zip -e zipfile.zip ... (Bug#47209) "Mot de Passe :" ; localized (Bug#29729) "Passwort:") ; localized "List of strings that should match `comint-password-prompt-regexp'.") diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 2e5f3020b41..df1d26a074e 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -617,11 +617,26 @@ collection clause." (cl-labels ((len (xs) (if xs (1+ (len (cdr xs))) 0))) (should (equal (len (make-list 42 t)) 42))) - ;; Simple tail-recursive function. - (cl-labels ((len (xs n) (if xs (len (cdr xs) (1+ n)) n))) - (should (equal (len (make-list 42 t) 0) 42)) - ;; Should not bump into stack depth limits. - (should (equal (len (make-list 42000 t) 0) 42000))) + (let ((list-42 (make-list 42 t)) + (list-42k (make-list 42000 t))) + + (cl-labels + ;; Simple tail-recursive function. + ((len (xs n) (if xs (len (cdr xs) (1+ n)) n)) + ;; Slightly obfuscated version to exercise tail calls from + ;; `let', `progn', `and' and `or'. + (len2 (xs n) (or (and (not xs) n) + (let (n1) + (and xs + (progn (setq n1 (1+ n)) + (len2 (cdr xs) n1))))))) + (should (equal (len nil 0) 0)) + (should (equal (len2 nil 0) 0)) + (should (equal (len list-42 0) 42)) + (should (equal (len2 list-42 0) 42)) + ;; Should not bump into stack depth limits. + (should (equal (len list-42k 0) 42000)) + (should (equal (len2 list-42k 0) 42000)))) ;; Check that non-recursive functions are handled more efficiently. (should (pcase (macroexpand '(cl-labels ((f (x) (+ x 1))) (f 5))) diff --git a/test/lisp/image-tests.el b/test/lisp/image-tests.el index ab7585ca050..2f7afa2f38e 100644 --- a/test/lisp/image-tests.el +++ b/test/lisp/image-tests.el @@ -25,7 +25,7 @@ (require 'cl-lib)) (defconst image-tests--emacs-images-directory - (expand-file-name "../etc/images" (getenv "EMACS_TEST_DIRECTORY")) + (expand-file-name "images" data-directory) "Directory containing Emacs images.") (ert-deftest image--set-property () @@ -48,6 +48,19 @@ (setf (image-property image :width) nil) (should (equal image '(image))))) +(ert-deftest image-find-image () + (find-image '((:type xpm :file "undo.xpm"))) + (find-image '((:type png :file "newsticker/rss-feed.png" :ascent center)))) + +(ert-deftest image-type-from-file-name () + (should (eq (image-type-from-file-name "foo.jpg") 'jpeg)) + (should (eq (image-type-from-file-name "foo.png") 'png))) + +(ert-deftest image-type/from-filename () + ;; On emba, `image-load-path' does not exist. + (skip-unless (bound-and-true-p image-load-path)) + (should (eq (image-type "foo.jpg") 'jpeg))) + (ert-deftest image-type-from-file-header-test () "Test image-type-from-file-header." (should (eq (if (image-type-available-p 'svg) 'svg) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 6565919c771..be428fc2a64 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -6380,7 +6380,7 @@ process sentinels. They shall not disturb each other." ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for ;; remote processes in Emacs. That doesn't work for tramp-adb.el. (skip-unless (or (and (tramp--test-adb-p) (tramp--test-emacs27-p)) - (tramp--test-sh-p) (tramp--test-sshfs-p))) + (tramp--test-sh-p))) (skip-unless (not (tramp--test-crypt-p))) (skip-unless (not (tramp--test-docker-p))) (skip-unless (not (tramp--test-windows-nt-p))) @@ -6767,6 +6767,8 @@ If INTERACTIVE is non-nil, the tests are run interactively." ;; * Fix `tramp-test06-directory-file-name' for `ftp'. ;; * Implement `tramp-test31-interrupt-process' for `adb', `sshfs' and ;; for direct async processes. +;; * Check, why direct async processes do not work for +;; `tramp-test43-asynchronous-requests'. (provide 'tramp-tests) diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 61e4ece49b7..8078e9c9fa9 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -135,6 +135,9 @@ point in the distant past, and is still broken in perl-mode. " (should (equal (nth 3 (syntax-ppss)) nil)) (should (equal (nth 4 (syntax-ppss)) t)))))) +(defvar perl-continued-statement-offset) +(defvar perl-indent-level) + (ert-deftest cperl-test-heredocs () "Test that HERE-docs are fontified with the appropriate face." (require 'perl-mode) @@ -242,7 +245,7 @@ This test relies on the specific layout of the index alist as created by CPerl mode, so skip it for Perl mode." (skip-unless (eq cperl-test-mode #'cperl-mode)) (with-temp-buffer - (insert-file (ert-resource-file "grammar.pl")) + (insert-file-contents (ert-resource-file "grammar.pl")) (cperl-mode) (let ((index (cperl-imenu--create-perl-index)) current-list) @@ -447,4 +450,30 @@ have a face property." ;; The yadda-yadda operator should not be in a string. (should (equal (nth 8 (cperl-test-ppss code "\\.")) nil)))) +(ert-deftest cperl-test-bug-47112 () + "Check that in a bareword starting with a quote-like operator +followed by an underscore is not interpreted as that quote-like +operator. Also check that a quote-like operator followed by a +colon (which is, like ?_, a symbol in CPerl mode) _is_ identified +as that quote like operator." + (with-temp-buffer + (funcall cperl-test-mode) + (insert "sub y_max { q:bar:; y _bar_foo_; }") + (goto-char (point-min)) + (syntax-propertize (point-max)) + (font-lock-ensure) + (search-forward "max") + (should (equal (get-text-property (match-beginning 0) 'face) + 'font-lock-function-name-face)) + (search-forward "bar") + (should (equal (get-text-property (match-beginning 0) 'face) + 'font-lock-string-face)) + ; perl-mode doesn't highlight + (when (eq cperl-test-mode #'cperl-mode) + (search-forward "_") + (should (equal (get-text-property (match-beginning 0) 'face) + (if (eq cperl-test-mode #'cperl-mode) + 'font-lock-constant-face + font-lock-string-face)))))) + ;;; cperl-mode-tests.el ends here diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 1819775bda5..601eca6cd49 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -465,9 +465,15 @@ See bug#35036." (simple-tests--exec '(backward-char undo-redo undo-redo)) (should (equal (buffer-string) "abc")) (simple-tests--exec '(backward-char undo-redo undo-redo)) - (should (equal (buffer-string) "abcde"))) + (should (equal (buffer-string) "abcde")))) + +(ert-deftest simple-tests--undo-in-region () ;; Test undo/redo in region. (with-temp-buffer + ;; Enable `transient-mark-mode' so `region-active-p' works as + ;; expected. `region-active-p' is used to determine whether to + ;; perform regional undo in `undo'. + (transient-mark-mode) (buffer-enable-undo) (dolist (x '("a" "b" "c" "d" "e")) (insert x) @@ -505,6 +511,7 @@ See bug#35036." (ert-deftest simple-tests--undo-equiv-table () (with-temp-buffer (buffer-enable-undo) + (transient-mark-mode) (let ((ul-hash-table (make-hash-table :test #'equal))) (dolist (x '("a" "b" "c")) (insert x) diff --git a/test/manual/cedet/semantic-tests.el b/test/manual/cedet/semantic-tests.el index 61f1d118fd2..7169c78bea0 100644 --- a/test/manual/cedet/semantic-tests.el +++ b/test/manual/cedet/semantic-tests.el @@ -1,6 +1,6 @@ ;;; semantic-utest.el --- Miscellaneous Semantic tests. -*- lexical-binding: t; -*- -;;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 2003-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <zappo@gnu.org> diff --git a/test/src/undo-tests.el b/test/src/undo-tests.el index 055bf102dfc..a658bccf6dc 100644 --- a/test/src/undo-tests.el +++ b/test/src/undo-tests.el @@ -46,6 +46,7 @@ ;;; Code: (require 'ert) +(require 'facemenu) (ert-deftest undo-test0 () "Test basics of \\[undo]." @@ -87,6 +88,7 @@ (ert-deftest undo-test1 () "Test undo of \\[undo] command (redo)." + (require 'facemenu) (with-temp-buffer (buffer-enable-undo) (undo-boundary) |