Commit graph

177925 commits

Author SHA1 Message Date
Eshel Yaron
3ee021dc19
; (find-function-search-for-symbol): Be cautious with macros.
* lisp/emacs-lisp/find-func.el
(find-function-search-for-symbol): Only attempt to expand
macros in trusted buffers.  (Bug#77341)
2025-04-05 08:04:55 +02:00
Stefan Monnier
cd41247dc1 perl-mode.el: Avoid obsolete font-lock face vars
* lisp/progmodes/perl-mode.el (perl-mode-abbrev-table): Merge defvar
into the definition.
(perl-font-lock-keywords-1, perl-font-lock-keywords-2): Avoid obsolete
font-lock face vars.
2025-04-04 23:53:10 -04:00
Po Lu
d582ed9dc9 Disable desktop-restore-frames by default on Android
* lisp/desktop.el (desktop-restore-frames): Default to nil when
\(featurep 'android).

* doc/emacs/misc.texi (Saving Emacs Sessions): Adjust to match.
2025-04-05 10:30:36 +08:00
Paul D. Nelson
2bced74aa9 ediff-current-file: New optional startup-hooks arg
* lisp/vc/ediff.el (ediff-current-file): Add optional
startup-hooks argument, so that the user can write wrapper
commands with more finely customized behavior (bug#77323).
2025-04-05 09:36:29 +08:00
Stefan Monnier
1fdaad5253 lisp/emacs-lisp/warnings.el (display-warning): Don't quote lambda 2025-04-04 16:53:05 -04:00
Stefan Monnier
21920da6c7 (defclass): Don't duplicate the compiler macro
* lisp/emacs-lisp/eieio.el (eieio--constructor-macro): New function.
(defclass): Use it.
2025-04-04 16:48:57 -04:00
Stefan Monnier
fce3f0ad4a lisp/calc/calc-keypd.el (calc-keypad-vector-menu): Don't quote lambda 2025-04-04 16:45:25 -04:00
Stefan Monnier
9983551f46 Handle TeX-master holding a buffer
Cleanup initialization of the syntax tables, while we're at it.

* lisp/textmodes/reftex.el (reftex-syntax-table)
(reftex-syntax-table-for-bib): Move initialization into the declaration.
(reftex--prepare-syntax-tables): Delete function.
(reftex-mode): Delete call to it.
(reftex-TeX-master-file): Handle the case where `TeX-master` holds
a buffer (e.g. because of `reftex-find-duplicate-labels`).
Consolidate the two cases where we prompt the user.
2025-04-04 16:17:36 -04:00
Paul Nelson
03fc0e0fd5 Add RefTeX support for non-file buffers
* lisp/textmodes/reftex.el (reftex--get-buffer-identifier)
(reftex--get-directory, reftex--abbreviate-name)
(reftex--get-basename, reftex--get-truename): New helper
functions that handle both files and buffer objects.
(reftex--remove-buffer-from-master-index): New helper function.
(reftex-tie-multifile-symbols): Support non-file buffers, using
the above.
(reftex-TeX-master-file): Return current buffer when no file.
(reftex-access-scan-info): Remove check requiring file buffers.
(reftex-access-parse-file, reftex-check-parse-consistency): Skip
for non-file buffers.
(reftex-select-external-document): Use new helper function.
(reftex-locate-file): Return buffer objects directly.
(reftex-get-file-buffer-force): Handle buffer objects and
special 'buffer:' strings.
* lisp/textmodes/reftex-global.el (reftex-create-tags-file): Add
error handling for non-file buffers.  Leave TAGS unsupported in
non-file buffers.
(reftex-find-duplicate-labels)
(reftex-isearch-switch-to-next-file): Use new helper functions
that handle both files and buffer objects.
(reftex-isearch-switch-to-next-file): Use equal rather than
string= to compare strings/buffers.
* lisp/textmodes/reftex-index.el (reftex-display-index)
(reftex-index-change-entry): Use new helper functions.
(reftex-index-visit-phrases-buffer): Add error handling for
non-file buffers.  Leave phrases unsupported in non-file
buffers.
* lisp/textmodes/reftex-parse.el (reftex-do-parse)
(reftex-parse-from-file): Add support for non-file buffers.
(reftex-all-document-files, reftex-where-am-I)
(reftex-notice-new): Use new helper functions.
* lisp/textmodes/reftex-ref.el (reftex-label-info-update):
Support non-file buffers.
(reftex-label-info, reftex-replace-prefix-escapes, reftex-label)
(reftex-replace-prefix-escapes, reftex-offer-label-menu): Use
new helper functions.
* lisp/textmodes/reftex-sel.el (reftex-insert-docstruct): Use
new helper function.
* lisp/textmodes/reftex-toc.el (reftex-toc)
(reftex-recenter-toc-when-idle): Support non-file buffers.
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib)
(reftex-get-bibfile-list): Use new helper functions.
* lisp/textmodes/reftex-global.el
(reftex-save-all-document-buffers, reftex-ensure-write-access):
Ignore non-file buffers.
* lisp/textmodes/reftex-parse.el (reftex-all-document-files):
For non-file objects, do not apply relative path transformation.
* test/lisp/textmodes/reftex-tests.el
(reftex-all-used-citation-keys-buffer)
(reftex-renumber-simple-labels-buffer): New tests for operations
on non-file buffers.

RefTeX historically assumed that the buffers it operates on
visit files.  To handle non-file buffers:

Modify reftex-TeX-master-file so that it returns the buffer
object itself (as suggested by Stefan Monnier).  Modify each
caller to handle buffer objects, aided by some helper functions
added to reftex.el.  Replace 'string=' by 'equal' in places.

Use buffer-base-buffer, where appropriate, to handle indirect
buffers (file and non-file).

TAGS files and phrases buffers remain unsupported for non-file
buffers.
2025-04-04 14:37:33 -04:00
Vincenzo Pupillo
8c411381c6 ; Fix last change (bug#77017)
* lisp/textmodes/html-ts-mode.el
(html-ts-mode): Avoid the warning if the html language library is not
installed.
Avoids warning if html language library is not installed
when trying to associate mode with filename patterns.
* lisp/textmodes/html-ts-mode.el: Revert the last changes.
Avoids warning if any of the html, javascript, css language libraries
are not installed when attempting to associate mode with filename
templates.
2025-04-04 19:17:43 +03:00
Michael Albinus
99d70ce6c2 Fix Tramp problem with loooongish file names
* lisp/net/tramp-sh.el (tramp-readlink-file-truename): New defconst.
(tramp-bundle-read-file-names): Use new %m and %q format specifiers.
(tramp-sh-handle-file-truename): Use `tramp-readlink-file-truename'.
(tramp-bundle-read-file-names, tramp-get-remote-readlink): Simplify.
(tramp-expand-script): Add format specifiers %m and %q for test
commands.  Addapt readlink call.
Reported by Stacey Marshall <stacey.marshall@gmail.com>.
2025-04-04 14:29:00 +02:00
Martin Rudalics
ae6ac5cad8 Don't propertize prompt in 'minibuffer--regexp-propertize' (Bug#77497)
* lisp/minibuffer.el (minibuffer--regexp-propertize): Skip prompt
when propertizing user input (Bug#77497).
2025-04-04 09:00:15 +02:00
Paul Nelson
67c89a675d Add repeat-map for Python indentation commands
* lisp/progmodes/python.el (python-indent-repeat-map): New
keymap for repeating Python indentation commands when using
'repeat-mode' (bug#77417).
2025-04-04 09:42:43 +03:00
Yuan Fu
9869aa1a10
Tighten the criteria for a defun in typescript-ts-mode (bug#77369)
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode--defun-type-regexp): New
variable (backported from master).
(typescript-ts-mode--defun-predicate): New function.
(typescript-ts-base-mode): Use new predicate.
2025-04-03 16:51:26 -07:00
Visuwesh
839ef39a5e Fix C-x p p for remote directories with no Tramp connection
* lisp/progmodes/project.el (project-switch-project): Allow
Tramp to establish a new connection for remote directories.
(Bug#77425)
2025-04-04 02:19:45 +03:00
Stephen Gildea
37262eac05 * doc/emacs/custom.texi (File Variables): Reorganize
Reorganize the section on file-local variables to tighten the paragraphs
describing each syntax: line one and local variables section.
2025-04-03 09:51:57 -07:00
Juri Linkov
79fd696d14 * lisp/window.el (window-deletable-p): Improve tab handling.
Use frame parameter 'tab-bar-lines' instead of 'tab-bar-mode'.
Remove 'window-dedicated-p' (bug#71386).  Doc fix.
Add 'frame' arg to 'window-list-1' (bug#59862).
2025-04-03 19:28:41 +03:00
Stephen Berman
ae7f65f3f9 Fix obsolete documentation of desktop library
* doc/emacs/misc.texi (Saving Emacs Sessions): Replace
documentation of the long-deleted user option
'desktop-clear-preserve-buffers-regexp' with documentation of
'desktop-clear-preserve-buffers'.
2025-04-03 16:53:35 +02:00
Michael Albinus
fd5f817882 Improve Tramp's initial warnings
* lisp/net/tramp-cache.el (tramp-dump-connection-properties):
Adapt comment.

* lisp/net/tramp-compat.el (tramp-warning): Declare and use it.

* lisp/net/tramp-message.el (tramp-warning): Declare `indent'.
2025-04-03 14:57:06 +02:00
Sean Whitton
91a75c0d46 ; Add a check for liveness to last change 2025-04-03 16:44:10 +08:00
Sean Whitton
4ace02755b vc-setup-buffer: Fix leaving wrong default-directory
* lisp/vc/vc-dispatcher.el (vc-setup-buffer): Use run-with-timer
to ensure the buffer-local value gets set (bug#77306).
2025-04-03 16:31:36 +08:00
Eli Zaretskii
12b06992df ; Fix last change. 2025-04-03 09:12:07 +03:00
Laurent Stacul
8db310ce8b Fix etags for Ruby module definitions with ::
Problem: In Ruby we can define a nested module/class the safe
way (in the sense, if the parent module does not exist, it will
define it:

  module M
    module N
    end
  end

If M already exists, we can also write:

  module M::N; end

With the later notation, the tag generated by etags will be M::N.
When browsing the code, using xref-find-definitions when the point
is on N, will not be able to find the definition of N because the
implicit tag name is M::N.

This is the same problem with nested classes or even some rare
allowed definitions like explicitely defining a module/class from
the global namespace:

  class ::A; end

Solution: We need to give an explicit tag name.  To achieve this,
on module/class definition we truncate the name to the last found
column.
* lib-src/etags.c (Ruby_functions): Support "::" in module
definitions.
* test/manual/etags/README: Update instructions.
* test/manual/etags/ruby-src/test1.ru: Add identifiers with "::".
* test/manual/etags/CTAGS.good:
* test/manual/etags/CTAGS.good_crlf:
* test/manual/etags/CTAGS.good_update:
* test/manual/etags/ETAGS.good_1:
* test/manual/etags/ETAGS.good_2:
* test/manual/etags/ETAGS.good_3:
* test/manual/etags/ETAGS.good_4:
* test/manual/etags/ETAGS.good_5:
* test/manual/etags/ETAGS.good_6:
* test/manual/etags/ETAGS.good_7: Adapt expected results to the
change.  (Bug#77421)

Copyright-paperwork-exempt: yes
2025-04-03 08:50:59 +03:00
Paul Eggert
5039ad24a3 Pacify gcc -Wclobbered in Freplace_region_contents
* src/editfns.c (Freplace_region_contents): Redo slightly to
pacify gcc -Wclobbered, by hoisting the eassume out of SCHARS and
into the caller later, where it’ll do more good anyway.
2025-04-02 13:53:00 -07:00
Stefan Monnier
7cffcbb513 cl-macs.el: Fix minor merge snafu (bug#77348)
* lisp/emacs-lisp/cl-macs.el (cl-flet, cl-labels): Recover the changes
made in commit 4764261681 and accidentally undone by a later merge of
commit 63adf9dcf5.
2025-04-02 15:05:02 -04:00
Eli Zaretskii
df82855aeb Fix display of wide characters in display margins on TTY frames
* src/xdisp.c (display_line): Remove incomplete glyph sequence of
the last multi-column character, if not all of its glyphs fit in
the marginal area.  (Bug#77452)
2025-04-02 20:25:09 +03:00
Michael Albinus
1e865a2f28 Explain, how to suppress Tramp warnings
* doc/misc/tramp.texi (Frequently Asked Questions): Remove double item.
(Traces and Profiles): Mention `warning-suppress-types'.  (Bug#77422)
2025-04-02 18:37:22 +02:00
Eli Zaretskii
a9661e643b More thorough fix for image slices on mode/header-line
* src/xdisp.c (note_mode_line_or_margin_highlight): Remove
correction of DX and DY due to image slices, as this is now done
in 'mode_line_string'.
* src/dispnew.c (mode_line_string): Make DX and DY account for
image slices.  (Bug#77429)
2025-04-02 16:12:03 +03:00
Mauro Aranda
9cfc01056e Fix widget relationship in customize-themes
* lisp/cus-theme.el (customize-themes): The theme button should
be a sibling of the checkbox widget, not a child.  (Bug#77096)
2025-04-02 08:10:18 -03:00
Stefan Monnier
71b3298c0e (custom--standard-value-p): New function
* lisp/cus-edit.el (custom-variable-state)
(custom-variable-mark-to-reset-standard): Use `custom--standard-value-p`.

* lisp/custom.el (custom--standard-value-p): New function.
(customize-mark-to-save, custom-push-theme, enable-theme): Use it.

* lisp/help-fns.el (describe-variable): Use `custom--standard-value`.
Extracted from `customize-mark-to-save` by with `ignore-errors`
replaced by `with-demoted-errors`.
2025-04-01 18:06:31 -04:00
Elías Gabriel Pérez
da6da5744b Add 'project-customize-dirlocals'
* etc/NEWS: Add command entry.
* lisp/menu-bar.el (menu-bar-project-menu): Add command entry to
project menu.
* lisp/progmodes/project.el (project-customize-dirlocals):
New command.  (Bug#77229)
2025-04-01 22:36:03 +03:00
Stefan Kangas
a4ec9ca129 function-put: signal error with non-symbol
* lisp/subr.el (function-get): Signal an error if given a non-symbol
for consistency with 'get'.
* test/lisp/subr-tests.el (subr-butlast): Test for the above.
2025-04-01 21:25:33 +02:00
Juri Linkov
87da719b6c New treesit generic mode 'liquid-generic-ts-mode' (bug#77255)
* lisp/treesit.el (treesit-replace-font-lock-feature-settings):
Check the query language in addition to checking the feature.
(treesit-font-lock-fontify-region): Use treesit-font-lock-setting-*
accessors.

* lisp/treesit-x.el (treesit-generic-mode-setup): Append new
font-lock rules to an existing treesit-font-lock-settings
possibly inherited from the parent.
(treesit-generic-mode-setup): Use treesit-merge-font-lock-feature-list
to merge with an existing feature list inherited from the parent.
(liquid-generic-ts-mode): New treesit generic mode.
(alpinejs-generic-ts-setup): New treesit generic setup.
2025-04-01 20:20:43 +03:00
Mauro Aranda
883355cef7 Move a vc option to a preloaded file
Since vc-resolve-conflicts is referenced in backend files, which only
require vc at runtime, move it to vc-hooks to avoid a void
variable error.  (Bug#3860)

* lisp/vc/vc.el (vc-resolve-conflicts): Move from here...
* lisp/vc/vc-hooks.el (vc-resolve-conflicts): ...to here.
2025-04-01 14:16:02 -03:00
Stephen Gildea
a096207474 printed manuals: xrefs in and out of "Preparing Patches"
Fix two cases of links where the on-line manual is one document but the
manual is split into separate documents for printing:

* doc/emacs/package.texi (Fetching Package Sources): fix printed link to
"Preparing Patches" to point to separate document.
* doc/emacs/vc1-xtra.texi (Preparing Patches): fix printed link to
"Directory Variables" to point to separate document.
2025-04-01 09:02:08 -07:00
Eli Zaretskii
975d58c4c8 Fix :map property on sliced images on mode line and header line
* src/xdisp.c (note_mode_line_or_margin_highlight): Fix coordinates
for image slices wrt ':map' keyword when the image is on the mode
line or header line.  (Bug#77429)
2025-04-01 18:40:59 +03:00
Michael Albinus
3f9ac99fc7 Fix Tramp's file-attributes cache
* lisp/net/tramp-adb.el (tramp-adb-handle-file-executable-p):
Check also for sticky bit.
(tramp-adb-handle-file-readable-p): Simplify.

* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-executable-p):
Check also for sticky bit.  Force `file-attributes' check.

* lisp/net/tramp-sh.el (tramp-sh-handle-file-executable-p):
Check also for sticky bit.
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-writable-p): Simplify.

* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-executable-p):
Check also for sticky bit.
(tramp-sudoedit-handle-file-readable-p)
(tramp-sudoedit-handle-file-writable-p): Simplify.

* lisp/net/tramp.el (tramp-use-file-attributes): Fix docstring.
(tramp-handle-file-readable-p, tramp-handle-file-writable-p):
Force `file-attributes' check.  Use `file-truename' for symbolic links.
(tramp-check-cached-permissions): New optional argument FORCE.
Fix symlink check.  Check also for sticky bit.  (Bug#77402)

* test/lisp/net/tramp-tests.el
(tramp-test20-file-modes-without-file-attributes)
(tramp-test21-file-links-without-file-attributes): New tests.
2025-04-01 15:24:44 +02:00
Vincenzo Pupillo
31e744e581 Added a check to see if the 'speedbar-buffer' is still alive
Fix suggested by Rudi Schlatte <rudi@constantly.at>.
* lisp/speedbar.el (speedbar-frame-or-window): Added an additional check
to see if 'speedbar-buffer' is still alive (bug#77405).
2025-04-01 14:26:30 +03:00
Pip Cet
6cac92928a Fix compilation errors due to insufficient compiler safety (bug#63288)
The default safety level is 1.  Restoring the default safety level to
1 after it was temporarily 0 should reset byte-compile-delete-errors
to nil, its default level.  Failing to do that resulted in
miscompilation of code in highly-parallel builds.

* lisp/emacs-lisp/cl-macs.el (cl--do-proclaim): Change
'byte-compile-delete-errors' to become t only at 'safety' level 0, not
levels 1 or 2.

(cherry picked from commit 53a5dada41)
2025-04-01 14:21:10 +03:00
Eli Zaretskii
4f6fa90ec5 ; * doc/misc/cl.texi (Structures): Fix references and markup. 2025-04-01 14:19:54 +03:00
Ikumi Keita
9057126900 Suppress error in non-file buffer
* lisp/textmodes/reftex.el (reftex--suppress-nonfile-error): New
variable.
(reftex-TeX-master-file): Don't signal error in non-file buffer.
(AUCTeX bug#76615)
2025-04-01 12:25:52 +02:00
Lin Jian
bdee248172 Fix pkg description file name when pkg name has numbers (Bug#77143)
* lisp/subr.el (package--description-file): Match end of string and add
`snapshot` among the possible version names.

Copyright-paperwork-exempt: yes
2025-03-31 14:56:26 -04:00
Earl Hyatt
6f311883d2 Fix typo in test of read-only cl-defstruct slot.
* test/lisp/emacs-lisp/cl-macs-tests.el (mystruct)
(cl-lib-struct-accessors): Use ":read-only" instead of ":readonly".

* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-struct-accessors):
Test using `setf' on read-only accessor to make sure the correct keyword
is used.
2025-03-31 14:34:28 -04:00
Earl Hyatt
e04d1dafc7 Add cl-with-accessors
* lisp/emacs-lisp/cl-macs.el (cl-with-accessors): New macro.
* doc/misc/cl.texi (Structures): Mention the new macro.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-lib-struct-with-accessors):
New Test.
* etc/NEWS (New macro 'cl-with-accessors'.): Mention the macro.

This macro is useful when making repeated use of a structures accessor
functions, such as reading from a slot and then writing to a slot.  It
is similar to 'with-slots' from EIEIO, but uses accessor functions
instead of slot names.
2025-03-31 14:29:48 -04:00
Juri Linkov
a97a61b630 Improve logic of tab handling when quitting windows (bug#71386)
* lisp/window.el (window-deletable-p): Add tab logic that returns
the symbol 'tab' for a set of predefined conditions.
(window--delete): Call 'tab-bar-close-tab' when 'window-deletable-p'
returns the symbol 'tab'.
(quit-restore-window): Remove tab logic and merge it with frame logic.

* test/lisp/tab-bar-tests.el (tab-bar-tests-close-other-tabs-default)
(tab-bar-tests-close-other-tabs-with-arg): Clean up tabs afterwards.
(tab-bar-tests-quit-restore-window): New test.
2025-03-31 20:40:17 +03:00
Stefan Monnier
513a05dd87 (insert-kbd-macro): Polish
* lisp/macros.el (insert-kbd-macro): Straighten control flow, use `pp`
and `keymap-global-set`.
2025-03-31 12:01:18 -04:00
Stefan Monnier
10eb57169d lisp/macros.el (insert-kbd-macro): Fix anonymous case (bug#77317) 2025-03-31 11:36:20 -04:00
Stefan Monnier
b148e98de3 japan-util.el: Cosmetic changes
* lisp/language/japan-util.el (<toplevel>): Use `pcase-dolist` and `when`.
(japanese-string-conversion): Use `point-min`.
2025-03-31 10:21:58 -04:00
Eli Zaretskii
fa5cd6b4d9 Fix replace-region in japan-util.el
* lisp/language/japan-util.el (japanese-replace-region): Allow
STRING to be a character in addition  to a string.  Un-obsolete
it.
(japanese-katakana-region, japanese-hiragana-region)
(japanese-hankaku-region, japanese-zenkaku-region): Call
'japanese-replace-region' instead of 'replace-region-contents'.
(Bug#77397)
2025-03-31 16:55:49 +03:00
Martin Rudalics
1ed1cc8349 ; Twice mention 'tab' value in buffer display doc-strings (Bug#71386)
* lisp/window.el (display-buffer-record-window)
(window--display-buffer): Mention value 'tab' for TYPE argument
(Bug#71386).
2025-03-31 09:46:17 +02:00