From 05971c4d9a49d377a17d6ffa4c9fa9616ac12769 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 11 Apr 2023 13:37:25 +0300 Subject: Add menu to 'c-ts-mode' and 'c++-ts-mode' * lisp/progmodes/c-ts-mode.el (c-ts-mode-menu): New menu. --- lisp/progmodes/c-ts-mode.el | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 83e89c3a335..2d54577cb09 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -1033,6 +1033,39 @@ recommended to enable `electric-pair-mode' with this mode." (setq-local treesit-font-lock-settings (c-ts-mode--font-lock-settings 'cpp)) (treesit-major-mode-setup))) +(easy-menu-define c-ts-mode-menu (list c-ts-mode-map c++-ts-mode-map) + "Menu for `c-ts-mode' and `c++-ts-mode'." + '("C/C++" + ["Comment Out Region" comment-region + :enable mark-active + :help "Comment out the region between the mark and point"] + ["Uncomment Region" (comment-region (region-beginning) + (region-end) '(4)) + :enable mark-active + :help "Uncomment the region between the mark and point"] + ["Indent Top-level Expression" c-ts-mode-indent-defun + :help "Indent/reindent top-level function, class, etc."] + ["Indent Line or Region" indent-for-tab-command + :help "Indent current line or region, or insert a tab"] + ["Forward Expression" forward-sexp + :help "Move forward across one balanced expression"] + ["Backward Expression" backward-sexp + :help "Move back across one balanced expression"] + "--" + ("Style..." + ["Set Indentation Style..." c-ts-mode-set-style + :help "Set C/C++ indentation style for current buffer"] + ["Show Current Indentation Style" (message "Indentation Style: %s" + c-ts-mode-indent-style) + :help "Show the name of the C/C++ indentation style for current buffer"] + ["Set Comment Style" c-ts-mode-toggle-comment-style + :help "Toglle C/C++ comment style between block and line comments"]) + "--" + ("Toggle..." + ["SubWord Mode" subword-mode + :style toggle :selected subword-mode + :help "Toggle sub-word movement and editing mode"]))) + ;; We could alternatively use parsers, but if this works well, I don't ;; see the need to change. This is copied verbatim from cc-guess.el. (defconst c-ts-mode--c-or-c++-regexp -- cgit v1.2.3 From 61fd017abde84bcf2c8a47f22db416a163533b91 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 11 Apr 2023 20:07:50 +0800 Subject: * configure.ac: Add -lbsd on Haiku. --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ed888982d5a..1fbe7435b22 100644 --- a/configure.ac +++ b/configure.ac @@ -1642,7 +1642,8 @@ case "$opsys" in ## Motif needs -lgen. unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;; - haiku) LIBS_SYSTEM="-lnetwork" ;; + # Haiku needs -lbsd for cfsetspeed. + haiku) LIBS_SYSTEM="-lnetwork -lbsd" ;; esac AC_SUBST([LIBS_SYSTEM]) -- cgit v1.2.3 From 7055fd8e43eebab5ad27c665a941d0612da7f173 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 11 Apr 2023 16:24:13 +0300 Subject: Improve documentation related to 'ispell-complete-word' * lisp/textmodes/ispell.el (ispell-alternate-dictionary) (ispell-complete-word-dict, ispell-complete-word): Doc fixes. (Bug#62775) --- lisp/textmodes/ispell.el | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index bb2bcfd8052..97c4ce9f32d 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -214,12 +214,14 @@ Must be greater than 1." ((file-readable-p "/usr/share/lib/dict/words") "/usr/share/lib/dict/words") ((file-readable-p "/sys/dict") "/sys/dict")) - "Alternate plain word-list dictionary for spelling help." + "Alternate plain word-list dictionary for spelling help. +This is also used by `ispell-lookup-words' and `ispell-complete-word'." :type '(choice file (const :tag "None" nil))) (defcustom ispell-complete-word-dict nil "Plain word-list dictionary used for word completion if -different from `ispell-alternate-dictionary'." +different from `ispell-alternate-dictionary'. +This is also used by `ispell-lookup-words' and `ispell-complete-word'." :type '(choice file (const :tag "None" nil))) (defcustom ispell-message-dictionary-alist nil @@ -2510,7 +2512,9 @@ Otherwise the variable `ispell-grep-command' contains the command Optional second argument contains the dictionary to use; the default is `ispell-alternate-dictionary', overridden by `ispell-complete-word-dict' -if defined." +if defined. If none of LOOKUP-DICT, `ispell-alternate-dictionary', +and `ispell-complete-word-dict' name an existing word-list file, +this function signals an error." ;; We don't use the filter for this function, rather the result is written ;; into a buffer. Hence there is no need to save the filter values. (if (null lookup-dict) @@ -3685,7 +3689,12 @@ If APPEND is non-nil, don't erase previous debugging output." If optional INTERIOR-FRAG is non-nil, then the word may be a character sequence inside of a word. -Standard ispell choices are then available." +Standard ispell choices are then available. + +This command uses a word-list file specified +by `ispell-alternate-dictionary' or by `ispell-complete-word-dict'; +if none of those name an existing word-list file, this command +signals an error." ;; FIXME: completion-at-point-function. (interactive "P") (let ((case-fold-search-val case-fold-search) -- cgit v1.2.3 From 372e024accd9b6e96c2dd92f89451192fb06b509 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 11 Apr 2023 17:47:48 +0300 Subject: ; Fix wallpaper-tests on XFCE * test/lisp/image/wallpaper-tests.el (wallpaper--find-command-args/return-list): Account for command-args being a function. (Bug#62673) --- test/lisp/image/wallpaper-tests.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/lisp/image/wallpaper-tests.el b/test/lisp/image/wallpaper-tests.el index 2e4e36030d4..c4167adbef2 100644 --- a/test/lisp/image/wallpaper-tests.el +++ b/test/lisp/image/wallpaper-tests.el @@ -129,12 +129,16 @@ (should (equal called fil-jpg))))) (ert-deftest wallpaper--find-command/return-string () - (should (or (not (wallpaper--find-command)) - (stringp (wallpaper--find-command))))) + (let ((cmd (wallpaper--find-command))) + (should (or (not cmd) + (stringp cmd))))) (ert-deftest wallpaper--find-command-args/return-list () - (should (or (not (wallpaper--find-command-args)) - (listp (wallpaper--find-command-args))))) + (let ((cmdargs (wallpaper--find-command-args))) + (if (functionp cmdargs) + (setq cmdargs (funcall cmdargs))) + (should (or (not cmdargs) + (listp cmdargs))))) (ert-deftest wallpaper--image-file-regexp/return-string () (should (stringp (wallpaper--image-file-regexp)))) -- cgit v1.2.3 From e9fef1d70ff6b5ed48681e6a1c62e650b108cd55 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 11 Apr 2023 22:59:45 +0300 Subject: vc-checkout: Try to use the vc-dir's backend first * lisp/vc/vc.el (vc-checkout): Try to use the vc-dir's backend before looking for the file's one. The latter doesn't work when the file doesn't exist on disk yet (bug#62674). --- lisp/vc/vc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 0e3519e2e5c..de1e38a0ef9 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1594,7 +1594,7 @@ After check-out, runs the normal hook `vc-checkout-hook'." (vc-call make-version-backups-p file) (vc-up-to-date-p file) (vc-make-version-backup file)) - (let ((backend (vc-backend file))) + (let ((backend (or vc-dir-backend (vc-backend file)))) (with-vc-properties (list file) (condition-case err (vc-call-backend backend 'checkout file rev) -- cgit v1.2.3 From 7972b76c2c7426745fad8ea0fc9325f475f728b6 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 12 Apr 2023 02:03:14 +0300 Subject: ; vc-checkout: Wrap var lookup in 'bound-and-true-p' --- lisp/vc/vc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index de1e38a0ef9..c64da1233d1 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1594,7 +1594,7 @@ After check-out, runs the normal hook `vc-checkout-hook'." (vc-call make-version-backups-p file) (vc-up-to-date-p file) (vc-make-version-backup file)) - (let ((backend (or vc-dir-backend (vc-backend file)))) + (let ((backend (or (bound-and-true-p vc-dir-backend) (vc-backend file)))) (with-vc-properties (list file) (condition-case err (vc-call-backend backend 'checkout file rev) -- cgit v1.2.3 From 6e6e8b5c974202d2691c1971be66c1cb3788b7c1 Mon Sep 17 00:00:00 2001 From: Earl Hyatt Date: Mon, 27 Mar 2023 20:57:31 -0400 Subject: Add more documentation for the keys of `package-vc-selected-packages`. * doc/emacs/package.texi (Specifying Package Sources): List the accepted keys in a new subsection of Fetching Package Sources. * lisp/emacs-lisp/package-vc.el (package-vc-selected-packages): Mention the `:doc` key. Add the `:doc` key to the Customize form, mention the new Info node, correct "TexInfo" to "Texinfo", avoid Git-specific terms for the description of `:branch`, mention guessing `:vc-backend` based on the URL. --- doc/emacs/package.texi | 77 +++++++++++++++++++++++++++++++++++++++++++ lisp/emacs-lisp/package-vc.el | 30 +++-------------- 2 files changed, 81 insertions(+), 26 deletions(-) diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index 7a2bc11d03c..2b03399b0a7 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -578,3 +578,80 @@ from the package directory (@pxref{Package Files}) to your checkout and initializes the code. Note that you might have to use @code{package-vc-refresh} to repeat the initialization and update the autoloads. + +@subsection Specifying Package Sources +@cindex package specification +@cindex specification, for source packages + + To install a package from source, Emacs must know where to get the +package's source code (such as a code repository) and basic +information about the structure of the code (such as the main file in +a multi-file package). A @dfn{package specification} describes these +properties. + + When supported by a package archive (@pxref{Package +Archives,,,elisp, The Emacs Lisp Reference Manual}), Emacs can +automatically download a package's specification from said archive. +If the first argument passed to @code{package-vc-install} is a symbol +naming a package, then Emacs will use the specification provided by +the archive for that package. + +@example +@group +;; Emacs will download BBDB's specification from GNU ELPA: +(package-vc-install 'bbdb) +@end group +@end example + + The first argument to @code{package-vc-install} may also be a +package specification. This allows you to install source packages +from locations other than the known archives listed in the user option +@code{package-archives}. A package specification is a list of the +form @code{(@var{name} . @var{spec})}, in which @var{spec} should be a +property list using any of the keys in the table below. + +For definitions of basic terms for working with code repositories and +version control systems, see @ref{VCS Concepts,,,emacs, The GNU Emacs +Manual}. + +@table @code +@item :url +A string providing the URL that specifies the repository from which to +fetch the package's source code. + +@item :branch +A string providing the revision of the code to install. Do not +confuse this with a package's version number. + +@item :lisp-dir +A string providing the repository-relative name of the directory to +use for loading the Lisp sources, which defaults to the root directory +of the repository. + +@item :main-file +A string providing the main file of the project, from which to gather +package metadata. If not given, the default is the package name with +".el" appended to it. + +@item :doc +A string providing the repository-relative name of the documentation +file from which to build an Info file. This can be a Texinfo file or +an Org file. + +@item :vc-backend +A symbol naming the VC backend to use for downloading a copy of the +package's repository (@pxref{Version Control Systems,,,emacs, The GNU +Emacs Manual}). If omitted, Emacs will attempt to make a guess based +on the provided URL, or, failing that, the process will fall back onto +the value of @code{package-vc-default-backend}. +@end table + +@example +@group +;; Specifying information manually: +(package-vc-install + '(bbdb :url "https://git.savannah.nongnu.org/git/bbdb.git" + :lisp-dir "lisp" + :doc "doc/bbdb.texi")) +@end group +@end example diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 2b73e187b14..af57095f8ce 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -142,32 +142,9 @@ is a symbol designating the package and SPEC is one of: - nil, if any package version can be installed; - a version string, if that specific revision is to be installed; -- a property list, describing a package specification. Valid - key/value pairs are - - `:url' (string) - The URL of the repository used to fetch the package source. - - `:branch' (string) - If given, the name of the branch to checkout after cloning the directory. - - `:lisp-dir' (string) - The repository-relative name of the directory to use for loading the Lisp - sources. If not given, the value defaults to the root directory - of the repository. - - `:main-file' (string) - The main file of the project, relevant to gather package metadata. - If not given, the assumed default is the package name with \".el\" - appended to it. - - `:vc-backend' (symbol) - A symbol of the VC backend to use for cloning the package. The - value ought to be a member of `vc-handled-backends'. If omitted, - `vc-clone' will fall back onto the archive default or on - `package-vc-default-backend'. - - All other keys are ignored. +- a property list, describing a package specification. For more + details, please consult the subsection \"Specifying Package + Sources\" in the Info node `(emacs)Fetching Package Sources'. This user option will be automatically updated to store package specifications for packages that are not specified in any @@ -181,6 +158,7 @@ archive." (:branch string) (:lisp-dir string) (:main-file string) + (:doc string) (:vc-backend symbol))))) :version "29.1") -- cgit v1.2.3 From 43290391ce2d870f5b63be09aa97c5bc906a33aa Mon Sep 17 00:00:00 2001 From: João Távora Date: Wed, 12 Apr 2023 13:08:14 +0100 Subject: ; Eglot: make version parseable by version-to-list * lisp/progmodes/eglot.el (Version): Correct version. --- lisp/progmodes/eglot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index cb9190a7523..a0581126b28 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2018-2023 Free Software Foundation, Inc. -;; Version: 1.12-emacs29 +;; Version: 1.12.29 ;; Author: João Távora ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot -- cgit v1.2.3 From 17d803d0a7545db360c917e576aa77cea10a9b29 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Wed, 12 Apr 2023 19:17:23 +0530 Subject: Fix detection of WebP images by their signature * lisp/image.el (image-type-header-regexps): The 4 characters between "RIFF" and "WEBP" in WebP images can also be newlines. (Bug#62790) --- lisp/image.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/image.el b/lisp/image.el index 6a8293fedf3..104fea407ff 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -51,7 +51,7 @@ static \\(unsigned \\)?char \\1_bits" . xbm) ("\\`\\(?:MM\0\\*\\|II\\*\0\\)" . tiff) ("\\`[\t\n\r ]*%!PS" . postscript) ("\\`\xff\xd8" . jpeg) ; used to be (image-jpeg-p . jpeg) - ("\\`RIFF....WEBPVP8" . webp) + ("\\`RIFF[^z-a][^z-a][^z-a][^z-a]WEBPVP8" . webp) (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)") (comment-re (concat "\\(?:!--" incomment-re "*-->[ \t\r\n]*<\\)"))) (concat "\\(?:<\\?xml[ \t\r\n]+[^>]*>\\)?[ \t\r\n]*<" -- cgit v1.2.3 From a22eb9ae0f9bfb745d05ea5b069b59592f19f1eb Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 13 Apr 2023 00:45:54 +0300 Subject: ruby-add-log-current-method: Reduce the use of 'nreverse' * lisp/progmodes/ruby-mode.el (ruby-add-log-current-method): Reduce the use of 'nreverse' (bug#62761). * test/lisp/progmodes/ruby-mode-tests.el (ruby-add-log-current-method-singleton-referencing-outer): New test. --- lisp/progmodes/ruby-mode.el | 4 ++-- test/lisp/progmodes/ruby-mode-tests.el | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index beccb8182a7..b252826680c 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1905,13 +1905,13 @@ See `add-log-current-defun-function'." (progn (unless (string-equal "self" (car mn)) ; def self.foo ;; def C.foo - (let ((ml (nreverse mlist))) + (let ((ml (reverse mlist))) ;; If the method name references one of the ;; containing modules, drop the more nested ones. (while ml (if (string-equal (car ml) (car mn)) (setq mlist (nreverse (cdr ml)) ml nil)) - (or (setq ml (cdr ml)) (nreverse mlist)))) + (setq ml (cdr ml)))) (if mlist (setcdr (last mlist) (butlast mn)) (setq mlist (butlast mn)))) diff --git a/test/lisp/progmodes/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el index 8a75c83d2c3..117385ea3e8 100644 --- a/test/lisp/progmodes/ruby-mode-tests.el +++ b/test/lisp/progmodes/ruby-mode-tests.el @@ -567,6 +567,22 @@ VALUES-PLIST is a list with alternating index and value elements." (search-backward "_") (should (string= (ruby-add-log-current-method) "C::D#foo")))) +(ert-deftest ruby-add-log-current-method-singleton-referencing-outer () + (ruby-with-temp-buffer (ruby-test-string + "module M + | module N + | module C + | class D + | def C.foo + | _ + | end + | end + | end + | end + |end") + (search-backward "_") + (should (string= (ruby-add-log-current-method) "M::N::C.foo")))) + (ert-deftest ruby-add-log-current-method-after-inner-class () (ruby-with-temp-buffer (ruby-test-string "module M -- cgit v1.2.3 From 864a4dc236395e441aafd23b9cbca099afdc5324 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 13 Apr 2023 08:18:33 +0300 Subject: Fix compilation of w32.c with old MinGW system headers * src/w32.c (CONSOLE_FONT_INFO): Make sure the definition is not visible for MinGW versions whose w32api's version is before 5.2.0. (Bug#52792) --- src/w32.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/w32.c b/src/w32.c index 8d344d2e6da..a6bc0f4b2ee 100644 --- a/src/w32.c +++ b/src/w32.c @@ -543,7 +543,14 @@ typedef LANGID (WINAPI *GetUserDefaultUILanguage_Proc) (void); typedef COORD (WINAPI *GetConsoleFontSize_Proc) (HANDLE, DWORD); -#if _WIN32_WINNT < 0x0501 +/* Old versions of mingw.org's MinGW, before v5.2.0, don't have a + _WIN32_WINNT guard for CONSOLE_FONT_INFO in wincon.h, and so don't + need the conditional definition below, which causes compilation + errors. Note: MinGW64 sets _WIN32_WINNT to a higher version, and + its w32api.h version stays fixed at 3.14. */ +#if _WIN32_WINNT < 0x0501 \ + && (__W32API_MAJOR_VERSION > 5 \ + || (__W32API_MAJOR_VERSION == 5 && __W32API_MINOR_VERSION >= 2)) typedef struct { DWORD nFont; -- cgit v1.2.3