Juri Linkov [Wed, 22 Jan 2020 23:23:17 +0000 (01:23 +0200)]
Tab-bar related finishing touches.
* lisp/tab-bar.el (tab-bar-tab-name-ellipsis): Use shorter name
instead of tab-bar-tab-name-truncated-ellipsis.
(tab-bar-new-tab-to) <defcustom>: Add 'function' option.
(tab-bar-new-tab-to) <function>: Use it.
* lisp/tab-line.el (tab-line-close-tab): Add missing arg 'tab' to
tab-line-close-tab-function funcall.
Alan Mackenzie [Wed, 22 Jan 2020 19:50:30 +0000 (19:50 +0000)]
Make call_process call signal_after_change. This fixes bug #38691.
Now, functions such as call-proess-region invoke after-change-functions
correctly.
* src/callproc.c (call_process): Call prepare_to_modify_buffer in a single
place, no longer delegating the task to insert_1_both, etc. Call
signal_after_change in each of two code branches, such that
before-change-functions and after-change-functions are always called in
balanced pairs.
* lisp/image-dired.el (image-dired-rotate-thumbnail-left)
(image-dired-rotate-thumbnail-right)
(image-dired-rotate-original-left)
(image-dired-rotate-original-right): Move the text in the doc
strings about rotating the originals to the correct commands
(bug#38928).
Eli Zaretskii [Tue, 21 Jan 2020 16:23:32 +0000 (18:23 +0200)]
Avoid leaving artifacts when the system caret is used on w32
* src/xdisp.c (try_window_reusing_current_matrix, try_window_id):
* src/dispnew.c (scrolling_window) [HAVE_NTGUI]: If
w32-use-visible-system-caret is non-nil, disallow scrolling the
display are in scroll_run_hook. This avoids copying traces of the
caret, about which Emacs knows nothing, and thus considers those
pixels show the default background. (Bug#39188)
(gui_update_window_end): Block input only around part of the code,
as we did before this code was extracted from backend-specific
implementations.
* src/w32term.c (w32_update_window_begin, w32_update_window_end):
Only hide/show the caret when redisplaying the window where the
caret is shown.
Eli Zaretskii [Tue, 21 Jan 2020 15:58:23 +0000 (17:58 +0200)]
Improve display of temporary echo messages
* lisp/minibuffer.el (set-minibuffer-message): Fix cursor position
for the temporary display of an echo-area message when minibuffer
is active. Ensure the message is visible even if the end of the
completion candidates presented by the likes of Icomplete mode is
not visible due to its length, under resize-mini-windows = nil.
(Bug#38457)
Juri Linkov [Mon, 20 Jan 2020 23:03:37 +0000 (01:03 +0200)]
Allow optional truncation of tab names in tab-bar and tab-line (bug#38693)
* lisp/tab-line.el (tab-line-tab-name-truncated-max): New defcustom.
(tab-line-tab-name-truncated-buffer): Use tab-line-tab-name-truncated-max
consistently with similar options in tab-bar.el.
(tab-line-tabs-limit): Remove variable.
(tab-line-tabs-window-buffers): Remove use of tab-line-tabs-limit
that was an experimental feature before horizontal scrolling was implemented.
(tab-line-close-tab-function): Rename from tab-line-close-tab-action
and allow a customizaed function as option.
(tab-line-close-tab): Call function if tab-line-close-tab-function
is customized to a function.
* lisp/tab-bar.el (tab-bar-tab-name-function): Add option
tab-bar-tab-name-truncated.
(tab-bar-tab-name-truncated-max): New defcustom.
(tab-bar-tab-name-truncated-ellipsis): New variable.
(tab-bar-tab-name-truncated): New function.
* test/lisp/shell-tests.el (shell-tests-completion-before-semi):
Go back to actually testing completion before semicolon.
(shell-tests-completion-after-semi): Test completion after semicolon,
correctly (bug#39075).
Tino Calancha [Sun, 19 Jan 2020 10:13:02 +0000 (11:13 +0100)]
Fix shell-command-dont-erase-buffer feature
* lisp/simple.el (shell-command-dont-erase-buffer):
The default, nil, is backward compatible, i.e. it erases the buffer
only if the output buffer is not the current one; the new value 'erase
always erases the output buffer.
Update docstring.
(shell-command-save-pos-or-erase):
Add optional arg output-to-current-buffer.
Rename it so that it's not internal. All callers updated.
(shell-command-set-point-after-cmd): Rename it so that it's not internal.
All callers updated.
Adjust it to cover a side case.
(shell-command): Adjust logic to match the specification (Bug#39067).
Enable the feature when the output buffer is the current one.
(shell-command-on-region): Little tweak to follow
`shell-command-dont-erase-buffer' specification.
Eric Abrahamsen [Sat, 18 Jan 2020 19:08:11 +0000 (11:08 -0800)]
Ensure that gnus-summary-attach-article finds the right articles
* lisp/gnus/gnus-msg.el (gnus-summary-attach-article): Before
iterating over the articles to attach, first close any open
article. Using `set-buffer' required `gnus-summary-select-article' to
re-set the buffer every time, meaning we never got off the original
article.
* test/lisp/shell-tests.el (shell-tests-completion-before-semi):
Amend the shell.el tests to catch errors such as bug#39057.
* lisp/shell.el (shell--parse-pcomplete-arguments): Skip the
semi-colon as well. This avoids inflooping when a semi-colon is
typed by the user. (Bug#39057)
Amin Bandali [Sat, 18 Jan 2020 04:38:04 +0000 (23:38 -0500)]
Fix erc-notifications-notify for non-PRIVMSGs, broken in last commit
* lisp/erc/erc-desktop-notifications.el (erc-notifications-notify):
Take optional argument `privp', to be non-nil when notifying for a
PRIVMSG. This is to work around bug introduced in last commit, as
`erc-get-buffer' may return nil for non-PRIVMSG cases.
(erc-notifications-PRIVMSG): Call erc-notifications-notify with
non-nil `privp', as described above.
Amin Bandali [Sat, 18 Jan 2020 03:33:03 +0000 (22:33 -0500)]
Fix the notification action for PRIVMSG in erc-notifications-notify
* lisp/erc/erc-desktop-notifications.el (erc-notifications-notify):
explicitly request the buffer for `nick', rather than relying on
(current-buffer) returning it. That works fine for the very first
PRIVMSG sent by `nick', but ERC seems to handle subsequent PRIVMSGs
differently, where (current-buffer) would return the server buffer
rather than the existing buffer for PRIVMSGs from `nick'.
Dmitry Gutov [Fri, 17 Jan 2020 21:14:24 +0000 (00:14 +0300)]
Honor tags-case-fold-search during xref identifer completion
* etc/NEWS: New entry.
* lisp/progmodes/etags.el (tags-case-fold-search):
Mark as safe-local.
(find-tag--completion-ignore-case):
Extract from tags-completion-at-point-function, find-tag-tag and
etags--xref-find-definitions.
(xref-backend-identifier-completion-ignore-case):
New method. Use it here as well.
* lisp/progmodes/xref.el
(xref-backend-identifier-completion-ignore-case): New generic.
(xref--read-identifier): Use it here.
Damien Cassou [Fri, 27 Dec 2019 14:35:52 +0000 (15:35 +0100)]
Add unattended spell-checking to checkdoc
This commit makes checkdoc capable of spell-checking even when the
user isn't using it interactively. When TAKE-NOTES is non-nil,
checkdoc will run spell-checking (with ispell) and report spelling
mistakes.
Fixes: (bug#38583).
* lisp/textmodes/ispell.el (ispell-word): Extract part of it to
`ispell--run-on-word`.
(ispell--run-on-word): New function, extracted from `ispell-word`.
(ispell-error-checking-word): New function.
(ispell-correct-p): New function. Use `ispell--run-on-word` and
`ispell-error-checking-word`.
* lisp/emacs-lisp/checkdoc.el (checkdoc-current-buffer): Pass
TAKE-NOTES to `checkdoc-start`.
(checkdoc-continue): Pass TAKE-NOTES to `checkdoc-this-string-valid`.
(checkdoc-this-string-valid): Add optional argument TAKE-NOTES and
pass it to `checkdoc-this-string-valid-engine`.
(checkdoc-this-string-valid-engine): Add optional argument TAKE-NOTES
and pass it to `checkdoc-ispell-docstring-engine`.
(checkdoc-ispell-init): Call `ispell-set-spellchecker-params` and
`ispell-accept-buffer-local-defs`. These calls are required to
properly use ispell. The problem went unnoticed until now because
checkdoc was only using ispell through the high-level command
`ispell-word` which takes care of all the initialization for the user.
(checkdoc-ispell-docstring-engine): Add optional argument TAKE-NOTES
to force reporting of spell-checking errors. Throw error
when (checkdoc-ispell-init) fails configuring ispell. Replace a
few (if cond nil body) with (unless cond body). Replace (let ((var
nil))) with (let (var)). Replace (if (not (eq checkdoc-autofix-flag
'never)) body) with just body because `checkdoc-autofix-flag` is
checked at the beginning of the function.
Robert Pluim [Wed, 15 Jan 2020 11:24:43 +0000 (12:24 +0100)]
Make emacs prefer an existing ~/.emacs.d to an existing XDG location
* doc/emacs/custom.texi (Find Init): Update description of how Emacs
finds its init file directory and the interaction with
$XDG_CONFIG_HOME
(Early Init File): Correct XDG location of early-init.el
* etc/NEWS: Update description to make it clear the ~/.emacs.d is
preferred, even if the XDG location exists.
* lisp/startup.el: Prefer ~/.emacs.d even if the XDG location exists.
* lib-src/emacsclient.c (open_config): Prefer home directory the XDG
location.
Juri Linkov [Wed, 15 Jan 2020 23:30:33 +0000 (01:30 +0200)]
Move shell-related menu items to "Shell Commands" submenu (bug#37594)
* lisp/menu-bar.el (menu-bar-shell-commands-menu): New variable.
(menu-bar-tools-menu): Move shell-related menu items to
'menu-bar-shell-commands-menu' and add menu items for
'async-shell-command' and 'shell'.
Juri Linkov [Wed, 15 Jan 2020 00:02:53 +0000 (02:02 +0200)]
* lisp/isearch.el: Fix corner cases of isearch-lazy-count.
* lisp/isearch.el (isearch-mode): Reset isearch-lazy-count-current
and isearch-lazy-count-total to nil, so when isearch-mode is started,
there should be no counts from previous Isearch.
(isearch-lazy-highlight-new-loop): Call isearch-message after resetting
lazy-count variables only when isearch-mode is started. This avoids
the problem of inappropriate calls of isearch-message-function
when query-replace in the minibuffer performs lazy-highlighting that
used to call minibuffer-history-isearch-message unnecessarily.
Always use lexical-binding in lisp-interaction-mode (bug#38835)
* lisp/progmodes/elisp-mode.el (lisp-interaction-mode):
Set lexical-binding.
* lisp/startup.el (command-line, startup--get-buffer-create-scratch):
Don't set lexical-binding here.
* doc/lispref/variables.texi:
* etc/NEWS:
Make it clear that lisp-interaction-mode uses lexical-binding.
Amin Bandali [Mon, 18 Nov 2019 15:24:48 +0000 (10:24 -0500)]
Improve ERC's matching of nicks and URLs (bug#38257)
* lisp/erc/erc-{button,match}.el (erc-{button,match}-syntax-table):
Omit (, ), and '; as they're not valid nick characters, per RFC 2812
section 2.3.1. This enables correct matching/highlighting of nicks
when they're surrounded by parens, like (nick), and when adjacent to
an apostrophe, like nick's.
* lisp/erc/erc-button.el (erc-button-url-regexp): Use the regexp from
browse-url-button-regexp, which among other things, seems to handle
surrounding pair of parens better.
* lisp/calc/calc.el (calcDigit-start): Initialise calc-prev-char to
something more reasonable, so that non-algebraic entry of intervals
whose start is a single digit, like (1..10), works properly.
Reported by Michel Schinz.
Eli Zaretskii [Wed, 8 Jan 2020 18:53:00 +0000 (20:53 +0200)]
Fix build without threads
* src/systhread.c (sys_thread_create) [!THREADS_ENABLED]: Update
the function's signature to match prototype. Reported by Glenn
Morris <rgm@gnu.org>. (Bug#38632)
Eli Zaretskii [Wed, 8 Jan 2020 16:21:53 +0000 (18:21 +0200)]
Fix compression of directories in Dired
This fixes comporession and uncompression of directories on
MS-Windows, but also on other systems. The original code used
":" as the REGEXP of the directory entry in
dired-compress-file-suffixes, which on Windows always matched any
absolute file name, and can also match unusual file names on Posix
hosts. This false match would cause dired-compress-file to act as
if we are decompressing a directory, but use a command suitable
for compression, which would fail in interesting ways.
We now use a REGEXP that can never match any valid file name.
* lisp/dired-aux.el (dired-compress-file-suffixes): Make the
"compress directory" entry's REGEXP really fail to match any valid
file name.
(dired-compress-file): Adapt to the change in
dired-compress-file-suffixes. (Bug#39024)
(dired-compress): If the current file is a directory, or if the
uncompressed file is a directory, don't remove the original from
the listing, since it is left in the filesystem.