Commit graph

84546 commits

Author SHA1 Message Date
Lars Ingebrigtsen
0a2f0e7f8c Make with-buffer-unmodified-if-unchanged more efficient
* lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged):
Make more efficient.
2022-05-03 22:06:31 +02:00
Lars Ingebrigtsen
b7ddd0f2fd Make with-buffer-unmodified-if-unchanged more resilient
* lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged):
Make more resilient.
2022-05-03 22:04:39 +02:00
Stefan Monnier
b5db5a6443 with-buffer-unmodified-if-unchanged: Tweak the implementation
* lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged):
Skip the hash if the buffer was not modified at all.
Use `restore-buffer-modified-p`.
Also mention that it's imperative that the current buffer is preserved.
2022-05-03 15:35:47 -04:00
Lars Ingebrigtsen
5206596ea7 Make sorting not change buffer modification status always
* lisp/sort.el (sort-subr): Don't mark buffer modified if the
sorting didn't change anything (bug#4587).
2022-05-03 21:23:40 +02:00
Lars Ingebrigtsen
59353ec7b5 Add new macro with-buffer-unmodified-if-unchanged
* lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged):
New macro.
* lisp/textmodes/fill.el (fill-paragraph): Macro code copied from
here.  Adjust and use the macro.
2022-05-03 21:22:53 +02:00
Lars Ingebrigtsen
8ef34a065a Fix thinko in recent tool bar caching logic
* lisp/tool-bar.el (tool-bar--cache-key): New function.
(tool-bar--flush-cache, tool-bar-make-keymap): Use it.
2022-05-03 19:20:52 +02:00
Lars Ingebrigtsen
99fbf39d61 Make tool bar caching more sensible
* lisp/tool-bar.el (tool-bar-keymap-cache): Make into a non-weak
EQ hash table, which should be faster and not lose the contents
after a GC (bug#43397).
(tool-bar--flush-cache, tool-bar-make-keymap): Use the terminal
only as the key.
(tool-bar-local-item, tool-bar-local-item-from-menu): Flush the
cache after altering the tool bar.
2022-05-03 18:46:13 +02:00
Eli Zaretskii
39fb555a95 Allow desktop to restore frames and windows on TTY frames
* lisp/frameset.el (frameset-persistent-filter-alist): Add 'top',
'left', 'bottom', and 'right' to frame parameters that are shelved
and unshelved when switching from GUI to TTY frames and vice
versa.
(frameset--restore-frame): Accept two optional arguments DX and
DY, and offset by them each frame restored from TTY desktop, to
make such restored frames more prominently visible.  Force such
frames to be visible on GUI display, since the visibility
parameter is meaningless for TTY frames.
(frameset-restore): Pass DX and DY offsets to
'frameset--restore-frame', when restoring TTY frames on GUI
display.
* lisp/desktop.el (desktop-restore-frameset): Pass the
:force-onscreen argument of 'frameset-restore' as nil when
restoring frames on text-mode display.
(desktop-restore-forces-onscreen): Document that this option has
no real effect on restoring frames on text-mode display.
(desktop-restoring-frameset-p): Allow restoring frames in non-GUI
sessions, but disallow that when the selected frame is the
daemon's initial frame.  (Bug#55070)
2022-05-03 19:29:03 +03:00
Jim Porter
a3a7279a4a Improve the behavior of concatenating parts of Eshell arguments
Previously, concatenating a list to a string would first convert the
list to a string.  Now, the string is concatenated with the last
element of the list.

* lisp/eshell/esh-util.el (eshell-to-flat-string): Make obsolete.

* lisp/eshell/esh-arg.el (eshell-concat, eshell-concat-1): New
functions.
(eshell-resolve-current-argument): Use 'eshell-concat'.

* test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-concat-cmd):
Add check for concatenation of multiline output of subcommands.
(esh-var-test/quoted-interp-concat-cmd): New test.

* test/lisp/eshell/em-extpipe-tests.el (em-extpipe-test-13): Use
'eshell-concat'.

* doc/misc/eshell.texi (Expansion): Document this behavior.

* etc/NEWS: Announce the change (bug#55236).
2022-05-03 18:23:02 +02:00
Jim Porter
06423b5d1e Return a list of numbers if all lines of an Eshell subcommand are numeric
* lisp/eshell/esh-util.el (eshell-convertible-to-number-p)
(eshell-convert-to-number): New functions...
(eshell-convert): ... use them.

* test/lisp/eshell/esh-var-tests.el
(esh-var-test/interp-convert-cmd-string-newline): Add checks for
numeric output.

* doc/misc/eshell.texi (Dollars Expansion): Document the new behavior.

* etc/NEWS: Announce the change (bug#55236).
2022-05-03 18:23:00 +02:00
Jim Porter
f7a82699d6 Eshell variable expansion should always return strings inside quotes
This is closer in behavior to regular shells, and gives Eshell users
greater flexibility in how variables are expanded.

* lisp/eshell/esh-util.el (eshell-convert): Add TO-STRING argument.

* lisp/eshell/esh-var.el (eshell-parse-variable-ref): Add MODIFIER-P
argument and adjust how 'eshell-convert' and 'eshell-apply-indices'
are called.
(eshell-get-variable, eshell-apply-indices): Add QUOTED argument.

* test/lisp/eshell/esh-var-tests.el (eshell-test-value): New defvar.
(esh-var-test/interp-convert-var-number)
(esh-var-test/interp-convert-var-split-indices)
(esh-var-test/interp-convert-quoted-var-number)
(esh-var-test/interp-convert-quoted-var-split-indices)
(esh-var-test/interp-convert-cmd-string-newline)
(esh-var-test/interp-convert-cmd-multiline)
(esh-var-test/interp-convert-cmd-number)
(esh-var-test/interp-convert-cmd-split-indices)
(esh-var-test/quoted-interp-convert-var-number)
(esh-var-test/quoted-interp-convert-var-split-indices)
(esh-var-test/quoted-interp-convert-quoted-var-number)
(esh-var-test/quoted-interp-convert-quoted-var-split-indices)
(esh-var-test/quoted-interp-convert-cmd-string-newline)
(esh-var-test/quoted-interp-convert-cmd-multiline)
(esh-var-test/quoted-interp-convert-cmd-number)
(esh-var-test/quoted-interp-convert-cmd-split-indices): New tests.

* doc/misc/eshell.texi (Arguments): Expand this section, and document
the new behavior.
(Dollars Expansion): Provide more detail about '$(lisp)' and
'${command}' forms.

* etc/NEWS (Eshell): Announce this change (bug#55236).
2022-05-03 18:22:57 +02:00
Lars Ingebrigtsen
316c082d58 Make adding things to the tool bar show up on next redisplay
* lisp/tool-bar.el (tool-bar--flush-cache): New function.
(tool-bar-add-item): Flush the cache (bug#43397).
2022-05-03 18:19:13 +02:00
Lars Ingebrigtsen
0916fd3aaa Add new command 'package-update'
* doc/emacs/package.texi (Package Installation): Mention it.
* lisp/emacs-lisp/package.el (package-update): New command
(bug#18790).
2022-05-03 18:00:32 +02:00
Lars Ingebrigtsen
41e946f46e Fix key-parse problem with C-x ( ... sequences
* lisp/keymap.el (key-parse): Move the read-kbd-macro compat code
from here...
* lisp/subr.el (kbd): ... to here.  (And fix the logic, too.)
This allows `key-parse' to have a less puzzling result while
maintaining backwards compatibility (bug#38775).
2022-05-03 16:19:50 +02:00
Lars Ingebrigtsen
a4c96147d1 Make TAB work in makefile mode when transient mark mode is on
* lisp/progmodes/make-mode.el (makefile-mode): Insert a tab
instead of removing it (bug#37087).
2022-05-03 16:02:51 +02:00
Michael Albinus
47fe7a5983 Handle file name handler in write-region's VISIT arg
* lisp/net/tramp.el (tramp-skeleton-delete-directory): Move up.
(tramp-skeleton-write-region): New defmacro.  Handle also file
name handler in VISIT.  (Bug#55166)
(tramp-handle-write-region):
* lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
* lisp/net/tramp-sh.el (tramp-sh-handle-write-region):
* lisp/net/tramp-smb.el (tramp-smb-handle-write-region):
* lisp/net/tramp-sshfs.el (tramp-sshfs-handle-write-region): Use it.
2022-05-03 14:14:37 +02:00
Filipp Gunbin
0b626ff8d6 Rewrite sql-interactive-remove-continuation-prompt
* lisp/progmodes/sql.el (sql-starts-with-prompt-re): Remove.
(sql-ends-with-prompt-re): Remove
(sql-interactive-remove-continuation-prompt): Delete prompts from
anywhere in the process output, not just at the beginning of current
string.  Streamline logic, describe it in docstring.
* test/lisp/progmodes/sql-tests.el: Add tests
2022-05-03 12:35:34 +02:00
Lars Ingebrigtsen
0e8fc556b6 Make more buttons in *Help* respect `help-window-keep-selected'
* lisp/help-mode.el (help-function-cmacro, help-variable-def)
(help-face-def): Also respect `help-window-keep-selected' like the
other commands.
2022-05-03 12:23:25 +02:00
Lars Ingebrigtsen
cf0d289e38 Further mm-base64-line-p bug fixes
* lisp/gnus/mm-bodies.el (mm-base64-line-p): Fix parsing error
introduced by d90f54d.
2022-05-03 11:32:03 +02:00
Lars Ingebrigtsen
d5803a0c97 Fix mm-base64-line-p logic
* lisp/gnus/mm-bodies.el (mm-base64-line-p): Don't claim that an
empty line is base64.
2022-05-03 11:28:59 +02:00
Po Lu
2ec7521b41 ; * lisp/tooltip.el (tooltip-show-help): Fix typo in last change. 2022-05-03 16:13:59 +08:00
Po Lu
5adc84a27b Make menu bar help text work on macOS as well
* lisp/tooltip.el (tooltip-show-help): Resort to displaying
messages in the echo area on NS.

* src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Call
`show_help_echo' instead of storing an event into the keyboard
buffer.
2022-05-03 16:12:24 +08:00
Eli Zaretskii
1477d12882 ; Fix typo and wording of a doc string
* lisp/textmodes/reftex-parse.el (reftex-using-biblatex-p): Fix
typo and wording of the doc string.
2022-05-02 18:57:15 +03:00
Arash Esbati
7f81470250 Load multiple bibliographies with multibib package
* lisp/textmodes/reftex-parse.el (reftex-using-biblatex-p):
Recognize 'multibib' which allows multiple bibliography loading
macro calls.
(reftex-locate-bibliography-files): Prevent possible duplications
in bibliography database files.
2022-05-02 14:31:19 +02:00
Lars Ingebrigtsen
bcdcaf0219 Make the eval-in-debug error message prettier in non-recursive errors
* lisp/emacs-lisp/debug.el (debugger-eval-expression): Make the
error message (when recursive debugging is off) prettier.
2022-05-02 13:59:11 +02:00
Lars Ingebrigtsen
f639fa9f9e Make non-recursive error messages in edebug prettier
* lisp/emacs-lisp/edebug.el (edebug-eval-expression): Make the
error message (when recursive debugging is off) prettier.
2022-05-02 13:55:56 +02:00
Lars Ingebrigtsen
ee913faf9a Fix eldoc interaction with when' and unless'
* lisp/subr.el (when, unless): Remove the (fn...) bits from the
doc string, because the advertised calling convention is correct
the way it is (bug#27229).  This also makes eldoc highlight the
arguments correctly.
2022-05-02 12:30:19 +02:00
Lars Ingebrigtsen
10f347a062 Add a command to recreate the *scratch* buffer
* doc/emacs/building.texi (Lisp Interaction): Mention it.
* lisp/simple.el (scratch-buffer): New command.
2022-05-02 12:26:31 +02:00
Stefan Kangas
2fba71cf1f Fix handling double-click-time nil or t
* lisp/mouse.el (mouse-double-click-time): New function to always
return a number for `double-click-time'.
* lisp/emulation/viper-mous.el (viper-multiclick-timeout):
* lisp/foldout.el (foldout-mouse-swallow-events):
* lisp/help.el (help--read-key-sequence):
* lisp/org/org-mouse.el (org-mouse-show-context-menu): Use
'mouse-double-click-time' instead of 'double-click-time'.
* src/keyboard.c (syms_of_keyboard): Mention
'mouse-double-click-time' in doc string of 'double-click-time'.
* test/lisp/mouse-tests.el (mouse-test-mouse-double-click-time):
New test.
2022-05-02 12:03:08 +02:00
Lars Ingebrigtsen
f7a6dd4fcc Re-fix Gcc header tokenization in Gnus
* lisp/gnus/gnus-msg.el (gnus-inews-do-gcc): Split the Gcc header
on commas, but allow group names to contain spaces (bug#55217).
2022-05-02 11:37:35 +02:00
Lars Ingebrigtsen
97badaab79 Allow reusing the *Help* window with i'/s/ commands
* doc/emacs/help.texi (Help): Document it.

* lisp/help-mode.el (help-function-def--button-function): Use it.
* lisp/help-mode.el (help-goto-info): Use it.

* lisp/help.el (help-window-select): Mention it.
(help-window-keep-selected): New user option (bug#9054).

* lisp/info-look.el (info-lookup-symbol):
(info-lookup): Allow keeping the same window.
2022-05-02 11:30:52 +02:00
Lars Ingebrigtsen
95507dd403 Allow show-paren to show matching parentheses inside comments
* lisp/paren.el (show-paren--default): Improve blinking when
inside a comment (bug#5410).
2022-05-02 11:02:54 +02:00
Lars Ingebrigtsen
44243af8f2 Use xref-goto-xref as the xref mouse binding
* lisp/progmodes/xref.el (xref--button-map): Keep the
xref-goto-xref binding instead of select-and-show to be more
similar to grep buffers.
2022-05-02 10:01:55 +02:00
Lars Ingebrigtsen
e280df0e34 Fix the OMIT-NULLS + "" case in string-lines
* lisp/subr.el (string-lines): Respect OMIT-NULLS when given an
empty string.
2022-05-02 09:56:58 +02:00
Stefan Monnier
2fa11123e5 * lisp/gnus/gnus-util.el (gnus-byte-compile): Use lexical-binding 2022-05-02 01:14:42 -04:00
Lars Ingebrigtsen
51186ed69c Fix string-lines return for ""
* lisp/subr.el (string-lines): Return the correct result on ""
(bug#55213).
2022-05-01 23:05:06 +02:00
Lars Ingebrigtsen
4f395efa06 Change string-lines semantics slightly
* lisp/subr.el (string-lines): Change the semantics slightly --
don't return an empty string for a trailing newline.
2022-05-01 20:54:11 +02:00
Jim Porter
32ab756d82 Handle escaped characters in Eshell special references (e.g. buffers)
* lisp/eshell/esh-arg.el (eshell-parse-special-reference): Unescape
escaped characters.

* test/lisp/eshell/eshell-tests-helpers.el (with-temp-eshell): Restore
current buffer after evaluating BODY.

* test/lisp/eshell/eshell-tests.el (eshell-test/redirect-buffer)
(eshell-test/redirect-buffer-escaped): New tests (bug#55204).
2022-05-01 20:41:23 +02:00
Jim Porter
bb40507fed Handle escaped characters in Eshell argument predicates/modifiers
* lisp/eshell/em-pred.el (eshell-get-delimited-modifier-argument):
Unescape escaped characters.

* test/lisp/eshell/em-pred-tests.el (em-pred-test/predicate-escaping):
New test (bug#55204).
2022-05-01 20:41:21 +02:00
Jim Porter
ade1424a97 Use a common set of string delimiters for all Eshell predicates/modifiers
* lisp/eshell/em-pred.el (eshell-pred-delimiter-pairs): New variable.
(eshell-get-comparison-modifier-argument)
(eshell-get-numeric-modifier-argument)
(eshell-get-delimited-modifier-argument): New functions...
(eshell-pred-user-or-group, eshell-pred-file-time)
(eshell-pred-file-links, eshell-pred-file-size)
(eshell-pred-substitute, eshell-join-memebers, eshell-split-members):
... and use them here.
(eshell-include-members): Pass 'mod-char' and use
'eshell-get-delimited-modifier-argument'.
(eshell-pred-file-type, eshell-pred-file-mode): Use 'when-let'.
(eshell-modifier-alist): Pass modifier char to
'eshell-include-members'.

* test/lisp/eshell/em-pred-tests.el
(em-pred-test/predicate-delimiters): New test.
(em-pred-test/predicate-uid, em-pred-test/predicate-gid,
em-pred-test/modifier-include, em-pred-test/modifier-exclude): Remove
cases covered by 'em-pred-test/predicate-delimiters'.
(em-pred-test/modifier-substitute): Add test cases for new delimiter
styles.

* doc/misc/eshell.texi (Argument Predication and Modification):
Explain how string parameters are delimited.
(Argument Modifiers): Document some special delimiter behavior with
the 's/PATTERN/REPLACE/' modifier (bug#55204).

* etc/NEWS: Announce this change, and move the
'eshell-eval-using-options' entry to the Eshell section.
2022-05-01 20:41:18 +02:00
Stefan Monnier
788694d026 * lisp/minibuffer.el (completion--replace): Fix bug#55205 2022-05-01 13:04:44 -04:00
Po Lu
9370a4763a Replace NS code that implemented font panels in a different way
* doc/emacs/macos.texi (Mac / GNUstep Events): Document removal
of `ns-change-font' event.  The font panels are now implemented
normally, via `x-select-font'.

* lisp/term/common-win.el (x-setup-function-keys): Likewise.

* lisp/term/ns-win.el (global-map, ns-popup-font-panel): Remove.
(x-select-font, mouse-set-font, ns-input-font):
(ns-input-fontsize): Remove.
(ns-respond-to-change-font): Delete function.

* src/nsfns.m (Fns_popup_font_panel): Delete function.
(Fx_select_font): New function.
(syms_of_nsfns): Update subrs.
* src/nsterm.h (@interface EmacsView):
* src/nsterm.m (ns_select_1): New function.
(ns_select): Wrap around that instead.
([EmacsView changeFont:]): Exit nested event loop
([EmacsView showFontPanel:]): New function.
2022-05-01 21:39:54 +08:00
Lars Ingebrigtsen
7c8bec9e1f Don't enter the debugger from *Backtrace* or edebug on eval errors
* doc/lispref/debugging.texi (Error Debugging): Document it.

* doc/lispref/edebug.texi (Edebug Eval): Mention it.
* lisp/emacs-lisp/debug.el (debug-allow-recursive-debug): New user
option (bug#36145).
(debugger-eval-expression): Use it.

* lisp/emacs-lisp/edebug.el (edebug-eval-expression): Ditto.

This patch is based on a patch by Noam Postavsky.
2022-05-01 13:40:13 +02:00
Lars Ingebrigtsen
730ad4a373 Make scroll-other-window respect target window remappings
* lisp/window.el (scroll-other-window, scroll-other-window-down):
Moved from window.c and change implementation so that they respect
command remappings in the target window (bug#20236).
2022-05-01 12:47:41 +02:00
Lars Ingebrigtsen
159d8f7a0a Fix the mm-decode-content-transfer-encoding overflow better
* lisp/gnus/mm-bodies.el (mm-decode-content-transfer-encoding):
Use it.
(mm-base64-line-p): New function.
2022-05-01 10:20:07 +02:00
Po Lu
2fcbc74c33 * lisp/menu-bar.el (menu-bar-search-menu): Remove extra separator. 2022-05-01 07:23:50 +00:00
Lars Ingebrigtsen
4ea8ab77e2 Make `M-x apropos' respect help-window-select
* lisp/apropos.el (apropos-print): Respect help-window-select.
(apropos): Mention it (bug#46034).
2022-04-30 21:34:18 +02:00
Lars Ingebrigtsen
95dbe4b6ae Make load-path-shadows-mode a special mode
* lisp/emacs-lisp/shadow.el (load-path-shadows-mode): Make the
mode inherit from special-mode so that the `q' command works.
2022-04-30 20:34:35 +02:00
Lars Ingebrigtsen
0ea217d646 Fix compilation-max-output-line-length type
* lisp/progmodes/compile.el (compilation-max-output-line-length):
Fix the type.
2022-04-30 19:42:42 +02:00
Lars Ingebrigtsen
d90f54db22 Avoid regexp overflow in mm-decode-content-transfer-encoding
* lisp/gnus/mm-bodies.el (mm-decode-content-transfer-encoding):
The base64 may be huge, so avoid backtracking (bug#55195).
2022-04-30 19:14:35 +02:00