1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 02:31:03 -08:00

Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-07-29 11:29:42 +08:00
commit 183c65e0c4
14 changed files with 257 additions and 149 deletions

View file

@ -669,6 +669,10 @@ This matches the hexadecimal digits: @samp{0} through @samp{9}, @samp{a}
through @samp{f} and @samp{A} through @samp{F}. through @samp{f} and @samp{A} through @samp{F}.
@end table @end table
The classes @samp{[:space:]}, @samp{[:word:]} and @samp{[:punct:]} use
the syntax-table of the current buffer but not any overriding syntax
text properties (@pxref{Syntax Properties}).
@node Regexp Backslash @node Regexp Backslash
@subsubsection Backslash Constructs in Regular Expressions @subsubsection Backslash Constructs in Regular Expressions
@cindex backslash in regular expressions @cindex backslash in regular expressions
@ -1341,6 +1345,9 @@ Match any @acronym{ASCII} character (codes 0--127).
Match any non-@acronym{ASCII} character (but not raw bytes). Match any non-@acronym{ASCII} character (but not raw bytes).
@end table @end table
The classes @code{space}, @code{word} and @code{punct} use the
syntax-table of the current buffer but not any overriding syntax text
properties (@pxref{Syntax Properties}).@*
Corresponding string regexp: @samp{[[:@var{class}:]]} Corresponding string regexp: @samp{[[:@var{class}:]]}
@item @code{(syntax @var{syntax})} @item @code{(syntax @var{syntax})}
@ -1920,7 +1927,8 @@ causing a match to fail early.
@item @item
Avoid or-patterns in favor of bracket expressions: write Avoid or-patterns in favor of bracket expressions: write
@samp{[ab]} instead of @samp{a\|b}. Recall that @samp{\s-} and @samp{\sw} @samp{[ab]} instead of @samp{a\|b}. Recall that @samp{\s-} and @samp{\sw}
are equivalent to @samp{[[:space:]]} and @samp{[[:word:]]}, respectively. are equivalent to @samp{[[:space:]]} and @samp{[[:word:]]}, respectively,
most of the time.
@item @item
Since the last branch of an or-pattern does not add a backtrack point Since the last branch of an or-pattern does not add a backtrack point

View file

@ -1268,6 +1268,9 @@ settings (@pxref{Sample configuration via Customize}).
(erc-server-reconnect-function #'erc-server-delayed-check-reconnect) (erc-server-reconnect-function #'erc-server-delayed-check-reconnect)
(erc-server-reconnect-timeout 30) (erc-server-reconnect-timeout 30)
;; Show new buffers in the current window instead of a split.
(erc-interactive-display 'buffer)
;; Insert a newline when I hit <RET> at the prompt, and prefer ;; Insert a newline when I hit <RET> at the prompt, and prefer
;; something more deliberate for actually sending messages. ;; something more deliberate for actually sending messages.
:bind (:map erc-mode-map :bind (:map erc-mode-map
@ -1391,6 +1394,16 @@ Indeed, you can always get back here by running @kbd{M-x
customize-group @key{RET} erc-server @key{RET}} from almost anywhere customize-group @key{RET} erc-server @key{RET}} from almost anywhere
in Emacs. in Emacs.
To make sure you've got this, try quickly customizing the option
@code{erc-interactive-display}, which lives in the @samp{Erc Buffers}
group (@kbd{M-x customize-group @key{RET} erc-buffers @key{RET}}). As
its doc string explains, the option controls where new buffers show up
when you do @kbd{M-x erc-tls @key{RET}} or issue certain ``slash''
commands, like @kbd{/JOIN #emacs-beginners @key{RET}}, at ERC's
prompt. Change its value to the symbol @code{buffer} by choosing
@samp{Use current window} (item @kbd{5}) from the option's
@samp{[Value Menu]}. Don't forget to save.
Now it's time to set some key bindings for @code{erc-mode-map}, a Now it's time to set some key bindings for @code{erc-mode-map}, a
major-mode keymap active in all ERC buffers. In general, it's best to major-mode keymap active in all ERC buffers. In general, it's best to
do this part either entirely or in conjunction with some lisp code in do this part either entirely or in conjunction with some lisp code in

View file

@ -14,29 +14,29 @@ GNU Emacs since Emacs version 22.1.
* Changes in ERC 5.6 * Changes in ERC 5.6
** Module 'keep-place' has gained a more flamboyant cousin. ** Module 'keep-place' has a more decorative cousin.
Remember your place in ERC buffers more easily while retaining the Remember your place in ERC buffers a bit more easily with the help of
freedom to look around, all with the help of a configurable, visible a configurable, visible indicator. Optionally sync the indicator to
indicator. Optionally sync the indicator to any progress made when any progress made while you haven't yet caught up to the live stream.
you haven't yet caught up to the live stream. See options See options 'erc-keep-place-indicator-style' and friends, and try M-x
'erc-keep-place-indicator-style' and friends, and try M-x
keep-place-indicator-mode to see it in action. keep-place-indicator-mode to see it in action.
** Module 'fill' offers a style based on 'visual-line-mode'. ** Module 'fill' offers an adaptive style based on 'visual-line-mode'.
This fill style mimics the "hanging indent" look of 'erc-fill-static' This style dynamically wraps messages to a window's width while
and provides some movement and editing commands to optionally tame the mimicking the "hanging indent" look of 'erc-fill-static'. It also
provides some movement and editing commands to optionally tame the
less familiar aspects of 'visual-line' behavior. An interactive less familiar aspects of 'visual-line' behavior. An interactive
helper called 'erc-fill-wrap-nudge' allows for dynamic "refilling" of helper called 'erc-fill-wrap-nudge' makes easy work of adjusting the
buffers on the fly. Set 'erc-fill-function' to 'erc-fill-wrap' to get overhang on the fly. Set 'erc-fill-function' to 'erc-fill-wrap' to
started. get started.
** A module for nickname highlighting has joined ERC. ** A module for nickname highlighting has joined ERC.
Automatic nickname coloring has come to ERC core. Users familiar with Automatic nickname coloring has come to ERC core. Users familiar with
'erc-hl-nicks', from which this module directly descends, will already 'erc-hl-nicks', from which this module directly descends, will already
be familiar with its suite of handy options. By default, each be familiar with its suite of handy options. By default, each
nickname in an ERC session receives a unique face with a unique (or nickname in an ERC session receives a unique face with a unique (or
evenly dealt) foreground color. Add 'nicks' to 'erc-modules' to get uniformly dealt) foreground color. Add 'nicks' to 'erc-modules' to
started. get started.
** A unified interactive entry point. ** A unified interactive entry point.
New users are often dismayed to discover that M-x ERC doesn't connect New users are often dismayed to discover that M-x ERC doesn't connect
@ -88,9 +88,9 @@ users to edit the 'erc-modules' widget instead.
Users can now add 'bufbar' to 'erc-modules' to achieve the same effect Users can now add 'bufbar' to 'erc-modules' to achieve the same effect
as toggling 'erc-status-sidebar-open' manually at the start of an IRC as toggling 'erc-status-sidebar-open' manually at the start of an IRC
session. The module has also been outfitted to show channels and session. The module has also been outfitted to show channels and
queries under their respective servers by default. To avoid queries under their servers by default. To avoid confusion, the major
confusion, the major mode used for the sidebar buffer itself, mode for the actual sidebar buffer itself, 'erc-status-sidebar-mode',
'erc-status-sidebar-mode', is no longer available interactively. is no longer available interactively.
** A new spin on a classic integration in erc-speedbar. ** A new spin on a classic integration in erc-speedbar.
Add 'nickbar' to 'erc-modules' to spawn a dynamically updating side Add 'nickbar' to 'erc-modules' to spawn a dynamically updating side
@ -252,20 +252,19 @@ versions.
For starters, the 'cursor-sensor-functions' property no longer For starters, the 'cursor-sensor-functions' property no longer
contains unique closures and thus no longer proves effective for contains unique closures and thus no longer proves effective for
traversing messages. To compensate, a new property, 'erc-timestamp', traversing messages. To compensate, a new property, 'erc-timestamp',
now spans message bodies but not the newlines delimiting them. now spans message bodies but not the newlines delimiting them. Also
Somewhat relatedly, the function 'erc-insert-aligned' has been affecting the `stamp' module is the deprecation of the function
deprecated and removed from the primary client code path. 'erc-insert-aligned' and its removal from client code. Additionally,
Additionally, the 'stamp' module now merges its 'invisible' property the module now merges its 'invisible' property with existing ones and
with existing ones, when present, and it includes all white space includes all white space around stamps when doing so.
around stamps when doing so.
Moreover, such "propertizing" of surrounding white space now extends This "propertizing" of surrounding white space also extends to all
to all 'stamp'-applied properties, like 'field', in all intervening 'stamp'-applied properties, like 'field', in all intervening space
space between message text and timestamps. This constitutes a between message text and timestamps. Technically, this constitutes a
breaking change from the perspective of detecting a timestamp's breaking change from the perspective of detecting a timestamp's
bounds. For example, ERC has always propertized leading space before bounds. However, ERC has always propertized leading space before
right-sided stamps on the same line as message text but not those right-sided stamps on the same line as message text but not those
folded onto the next line. This inconsistency made stamp detection folded onto the next line. Such inconsistency made stamp detection
overly complex and produced uneven results when toggling stamp overly complex and produced uneven results when toggling stamp
visibility. visibility.
@ -317,11 +316,11 @@ third-party code, the key takeaway is that more 'font-lock-face'
properties encountered in the wild may be combinations of faces rather properties encountered in the wild may be combinations of faces rather
than lone ones. than lone ones.
*** Prompt input split before 'erc-pre-send-functions' gets a say. *** 'erc-pre-send-functions' visits prompt input post-split.
Hook members are now treated to input whose lines have already been ERC now adjusts input lines to fall within allowed length limits
adjusted to fall within the allowed length limit. For convenience, before showing hook members the result. For compatibility,
third-party code can request that the final input be "re-filled" prior third-party code can request that the final input be adjusted again
to being sent. See doc string for details. prior to being sent. See doc string for details.
*** ERC's prompt survives the insertion of user input and messages. *** ERC's prompt survives the insertion of user input and messages.
Previously, ERC's prompt and its input marker disappeared while Previously, ERC's prompt and its input marker disappeared while
@ -329,18 +328,20 @@ running hooks during message insertion, and the position of its
"insert marker" (ERC's per-buffer process mark) was inconsistent "insert marker" (ERC's per-buffer process mark) was inconsistent
during these spells. To make insertion handling more predictable in during these spells. To make insertion handling more predictable in
preparation for incorporating various protocol extensions, the prompt preparation for incorporating various protocol extensions, the prompt
and its bounding markers have become perennial fixtures. To effect and its bounding markers have become perennial fixtures.
this change, small behavioral differences in message insertion have
been adopted. Crucially, 'erc-insert-marker' now has an "insertion To effect this change, small behavioral differences in message
type" of t, and 'erc-display-line-1' now calls 'insert' instead of insertion have been adopted. Crucially, 'erc-insert-marker' now has
'insert-before-prompt'. This allows user code to leave its own an "insertion type" of t, and 'erc-display-line-1' now calls 'insert'
markers via 'erc-insert-modify-hook' and 'erc-insert-post-hook' instead of 'insert-before-markers. This allows user code running on
instead of having to resort to workarounds. Message insertion for 'erc-insert-modify-hook' and 'erc-insert-post-hook' to leave its own
outgoing messages, in 'erc-display-msg', remains as before. In rare markers at the actual insertion point instead of resorting to
cases, these changes may mean third-party code needs tweaking, for workarounds. Message insertion for outgoing messages, in
example, requiring the use of 'insert-before-markers' instead of 'erc-display-msg', remains as before. In rare cases, these changes
'insert'. As always, users feeling unduly inconvenienced by these may mean third-party code needs tweaking, for example, requiring the
changes are encouraged to voice their concerns on the bug list. use of 'insert-before-markers' instead of 'insert'. As always, users
feeling unduly inconvenienced by these changes are encouraged to voice
their concerns on the bug list.
*** Miscellaneous changes *** Miscellaneous changes
Two helper macros from GNU ELPA's Compat library are now available to Two helper macros from GNU ELPA's Compat library are now available to

View file

@ -226,9 +226,9 @@ mnemonics of the following coding systems:
(put 'mode-line-mule-info 'risky-local-variable t) (put 'mode-line-mule-info 'risky-local-variable t)
(defvar mode-line-client (defvar mode-line-client
`("" `(:eval
(:propertize ("" (:eval (if (frame-parameter nil 'client) "@" ""))) (if (frame-parameter nil 'client)
help-echo ,(purecopy "emacsclient frame"))) ,(propertize "@" 'help-echo (purecopy "emacsclient frame"))))
"Mode line construct for identifying emacsclient frames.") "Mode line construct for identifying emacsclient frames.")
;; Autoload if this file no longer dumped. ;; Autoload if this file no longer dumped.
;;;###autoload ;;;###autoload

View file

@ -176,7 +176,7 @@ are available (see Info node `(emacs)Document View')."
;; non-MikTeX apps. Was available under: ;; non-MikTeX apps. Was available under:
;; http://blog.miktex.org/post/2005/04/07/Starting-mgsexe-at-the-DOS-Prompt.aspx ;; http://blog.miktex.org/post/2005/04/07/Starting-mgsexe-at-the-DOS-Prompt.aspx
((and (executable-find "mgs") ((and (executable-find "mgs")
(= 0 (shell-command "mgs -q -dNODISPLAY -c quit"))) (eql 0 (shell-command "mgs -q -dNODISPLAY -c quit")))
"mgs"))) "mgs")))
(t "gs")) (t "gs"))
"Program to convert PS and PDF files to PNG." "Program to convert PS and PDF files to PNG."
@ -216,7 +216,7 @@ are available (see Info node `(emacs)Document View')."
:type 'boolean :type 'boolean
:version "30.1") :version "30.1")
(defcustom doc-view-imenu-enabled (executable-find "mutool") (defcustom doc-view-imenu-enabled (and (executable-find "mutool") t)
"Whether to generate an imenu outline when \"mutool\" is available." "Whether to generate an imenu outline when \"mutool\" is available."
:type 'boolean :type 'boolean
:version "29.1") :version "29.1")
@ -577,8 +577,8 @@ Typically \"page-%s.png\".")
;; file. (TODO: We'd like to have something like that also ;; file. (TODO: We'd like to have something like that also
;; for other types, at least PS, but I don't know a good way ;; for other types, at least PS, but I don't know a good way
;; to test if a PS file is complete.) ;; to test if a PS file is complete.)
(if (= 0 (call-process "pdfinfo" nil nil nil (if (eql 0 (call-process "pdfinfo" nil nil nil
doc-view--buffer-file-name)) doc-view--buffer-file-name))
(revert) (revert)
(when (called-interactively-p 'interactive) (when (called-interactively-p 'interactive)
(message "Can't revert right now because the file is corrupted."))) (message "Can't revert right now because the file is corrupted.")))
@ -1962,7 +1962,7 @@ structure is extracted by `doc-view--imenu-subtree'."
(let ((outline nil) (let ((outline nil)
(fn (expand-file-name fn))) (fn (expand-file-name fn)))
(with-temp-buffer (with-temp-buffer
(unless (= 0 (call-process "mutool" nil (current-buffer) nil "show" fn "outline")) (unless (eql 0 (call-process "mutool" nil (current-buffer) nil "show" fn "outline"))
(imenu-unavailable-error "Unable to create imenu index using `mutool'")) (imenu-unavailable-error "Unable to create imenu index using `mutool'"))
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward doc-view--outline-rx nil t) (while (re-search-forward doc-view--outline-rx nil t)

View file

@ -443,12 +443,13 @@ parties.")
(cons (get-text-property m 'erc-timestamp) (cons (get-text-property m 'erc-timestamp)
(get-text-property spr 'erc-speaker))))) (get-text-property spr 'erc-speaker)))))
(ts (pop props)) (ts (pop props))
(props)
((not (time-less-p (erc-stamp--current-time) ts))) ((not (time-less-p (erc-stamp--current-time) ts)))
((time-less-p (time-subtract (erc-stamp--current-time) ts) ((time-less-p (time-subtract (erc-stamp--current-time) ts)
erc-fill--wrap-max-lull)) erc-fill--wrap-max-lull))
(speaker (next-single-property-change (point-min) 'erc-speaker)) (speaker (next-single-property-change (point-min) 'erc-speaker))
((not (eq (get-text-property speaker 'erc-ctcp) 'ACTION)))
(nick (get-text-property speaker 'erc-speaker)) (nick (get-text-property speaker 'erc-speaker))
(props)
((erc-nick-equal-p props nick)))) ((erc-nick-equal-p props nick))))
(set-marker erc-fill--wrap-last-msg (point-min)))) (set-marker erc-fill--wrap-last-msg (point-min))))

View file

@ -45,8 +45,8 @@
;; Use M-x erc-status-sidebar-kill RET to kill the sidebar buffer and ;; Use M-x erc-status-sidebar-kill RET to kill the sidebar buffer and
;; close the sidebar on all frames. ;; close the sidebar on all frames.
;; In addition to the commands above, you can also try the all-in-one, ;; In addition to the commands above, you can also try the all-in-one
;; "DWIM" command, `erc-bufbar-mode'. See its doc string for usage. ;; entry point `erc-bufbar-mode'. See its doc string for usage.
;; If you want the status sidebar enabled whenever you use ERC, add ;; If you want the status sidebar enabled whenever you use ERC, add
;; `bufbar' to `erc-modules'. Note that this library also has a major ;; `bufbar' to `erc-modules'. Note that this library also has a major
@ -130,8 +130,11 @@ buffers, using the functions
`erc-status-sidebar-pad-hierarchy' `erc-status-sidebar-pad-hierarchy'
for the above-mentioned purposes. ERC also accepts a list of for the above-mentioned purposes. ERC also accepts a list of
functions to preform these roles a la carte. See doc strings for functions to preform these roles a la carte. Since the members
a description of their expected arguments and return values." of the above sets aren't really interoperable, we don't offer
them here as customization choices, but you can still specify
them manually. See doc strings for a description of their
expected arguments and return values."
:package-version '(ERC . "5.6") ; FIXME sync on release :package-version '(ERC . "5.6") ; FIXME sync on release
:type '(choice (const channels-only) :type '(choice (const channels-only)
(const all-mixed) (const all-mixed)
@ -158,10 +161,12 @@ ACTION parameter."
:key-type symbol :key-type symbol
:value-type (sexp :tag "Value"))))) :value-type (sexp :tag "Value")))))
(defcustom erc-status-sidebar-singular t (defvar erc-status-sidebar--singular-p t
"Whether to show the sidebar on all frames or just one (default)." "Whether to restrict the sidebar to a single frame.
:package-version '(ERC . "5.6") ; FIXME sync on release This variable only affects `erc-bufbar-mode'. Disabling it does
:type 'boolean) not arrange for automatically showing the sidebar in all frames.
Rather, disabling it allows for displaying the sidebar in the
selected frame even if it's already showing in some other frame.")
(defvar hl-line-mode) (defvar hl-line-mode)
(declare-function hl-line-highlight "hl-line" nil) (declare-function hl-line-highlight "hl-line" nil)
@ -178,7 +183,7 @@ ACTION parameter."
If NO-CREATION is non-nil, the window is not created." If NO-CREATION is non-nil, the window is not created."
(let ((sidebar-window (get-buffer-window erc-status-sidebar-buffer-name (let ((sidebar-window (get-buffer-window erc-status-sidebar-buffer-name
erc-status-sidebar-singular))) erc-status-sidebar--singular-p)))
(unless (or sidebar-window no-creation) (unless (or sidebar-window no-creation)
(with-current-buffer (erc-status-sidebar-get-buffer) (with-current-buffer (erc-status-sidebar-get-buffer)
(setq-local vertical-scroll-bar nil)) (setq-local vertical-scroll-bar nil))
@ -214,7 +219,7 @@ The erc-status-sidebar buffer is left alone, but the window
containing it on the current frame is closed. See containing it on the current frame is closed. See
`erc-status-sidebar-kill'." `erc-status-sidebar-kill'."
(interactive "P") (interactive "P")
(mapcar #'delete-window (mapcar #'delete-window ; FIXME use `mapc'.
(get-buffer-window-list (erc-status-sidebar-get-buffer) (get-buffer-window-list (erc-status-sidebar-get-buffer)
nil (if all-frames t)))) nil (if all-frames t))))
@ -223,10 +228,8 @@ containing it on the current frame is closed. See
`(let ((buffer-read-only nil)) `(let ((buffer-read-only nil))
,@body)) ,@body))
;;;###autoload (defun erc-status-sidebar--open ()
(defun erc-status-sidebar-open () "Maybe open the sidebar, respecting `erc-status-sidebar--singular-p'."
"Open or create a sidebar."
(interactive)
(save-excursion (save-excursion
(if (erc-status-sidebar-buffer-exists-p) (if (erc-status-sidebar-buffer-exists-p)
(erc-status-sidebar-get-window) (erc-status-sidebar-get-window)
@ -237,11 +240,15 @@ containing it on the current frame is closed. See
;;;###autoload(autoload 'erc-bufbar-mode "erc-status-sidebar" nil t) ;;;###autoload(autoload 'erc-bufbar-mode "erc-status-sidebar" nil t)
(define-erc-module bufbar nil (define-erc-module bufbar nil
"Show `erc-track'-like activity in a side window. "Show `erc-track'-like activity in a side window.
When enabling, show the sidebar immediately if called from a When enabling, show the sidebar immediately in the current frame
connected ERC buffer. Otherwise, arrange for doing so on connect if called from a connected ERC buffer. Otherwise, arrange for
or whenever next displaying a new ERC buffer. When disabling, doing so on connect or whenever next displaying a new ERC buffer.
hide the status window if it's showing. With a negative prefix When disabling, hide the status window in all frames. With a
arg, also shutdown the session." negative prefix arg, also shutdown the session. Normally, this
module only allows one sidebar window in an Emacs session. To
override this, use `erc-status-sidebar-open' to force creation
and `erc-status-sidebar-close' to hide a single instance on the
current frame only."
((unless erc-track-mode ((unless erc-track-mode
(unless (memq 'track erc-modules) (unless (memq 'track erc-modules)
(erc--warn-once-before-connect 'erc-bufbar-mode (erc--warn-once-before-connect 'erc-bufbar-mode
@ -249,30 +256,38 @@ arg, also shutdown the session."
" This will affect \C-]all\C-] ERC sessions." " This will affect \C-]all\C-] ERC sessions."
" Add `track' to `erc-modules' to silence this message.")) " Add `track' to `erc-modules' to silence this message."))
(erc-track-mode +1)) (erc-track-mode +1))
(add-hook 'erc--setup-buffer-hook #'erc-status-sidebar-open) (add-hook 'erc--setup-buffer-hook #'erc-status-sidebar--open)
(unless erc--updating-modules-p (unless erc--updating-modules-p
(if (erc-with-server-buffer erc-server-connected) (if (erc-with-server-buffer erc-server-connected)
(erc-status-sidebar-open) (erc-status-sidebar--open)
(setq erc-bufbar-mode nil)
(when (derived-mode-p 'erc-mode) (when (derived-mode-p 'erc-mode)
(erc-error "Not initializing `erc-bufbar-mode' in %s" (erc-error "Not initializing `erc-bufbar-mode' in %s"
(current-buffer)))))) (current-buffer))))))
((remove-hook 'erc--setup-buffer-hook #'erc-status-sidebar-open) ((remove-hook 'erc--setup-buffer-hook #'erc-status-sidebar--open)
(erc-status-sidebar-close erc-status-sidebar-singular) (erc-status-sidebar-close 'all-frames)
(when-let ((arg erc--module-toggle-prefix-arg) (when-let ((arg erc--module-toggle-prefix-arg)
((numberp arg)) ((numberp arg))
((< arg 0))) ((< arg 0)))
(erc-status-sidebar-kill)))) (erc-status-sidebar-kill))))
;;;###autoload
(defun erc-status-sidebar-open ()
"Open or create a sidebar window in the current frame.
When `erc-bufbar-mode' is active, do this even if one already
exists in another frame."
(interactive)
(let ((erc-status-sidebar--singular-p (not erc-bufbar-mode)))
(erc-status-sidebar--open)))
;;;###autoload ;;;###autoload
(defun erc-status-sidebar-toggle () (defun erc-status-sidebar-toggle ()
"Toggle the sidebar open/closed on the current frame. "Toggle the sidebar open/closed on the current frame.
Do this regardless of `erc-status-sidebar-singular'." When opening, and `erc-bufbar-mode' is active, create a sidebar
even if one already exists in another frame."
(interactive) (interactive)
(if (get-buffer-window erc-status-sidebar-buffer-name nil) (if (get-buffer-window erc-status-sidebar-buffer-name nil)
(erc-status-sidebar-close) (erc-status-sidebar-close)
(let (erc-status-sidebar-singular) (erc-status-sidebar-open)))
(erc-status-sidebar-open))))
(defun erc-status-sidebar-get-channame (buffer) (defun erc-status-sidebar-get-channame (buffer)
"Return name of BUFFER with all leading \"#\" characters removed." "Return name of BUFFER with all leading \"#\" characters removed."
@ -413,11 +428,10 @@ name stand out."
erc-status-sidebar-pad-hierarchy)) erc-status-sidebar-pad-hierarchy))
(v v))) (v v)))
(chanlist (apply sort-fn (funcall list-fn nil) nil)) (chanlist (apply sort-fn (funcall list-fn nil) nil))
(window nil) (windows nil))
(winstart nil))
(with-current-buffer (erc-status-sidebar-get-buffer) (with-current-buffer (erc-status-sidebar-get-buffer)
(setq window (get-buffer-window nil erc-status-sidebar-singular) (dolist (window (get-buffer-window-list nil nil t))
winstart (and window (window-start window))) (push (cons window (window-start window)) windows))
(erc-status-sidebar-writable (erc-status-sidebar-writable
(delete-region (point-min) (point-max)) (delete-region (point-min) (point-max))
(goto-char (point-min)) (goto-char (point-min))
@ -443,9 +457,8 @@ name stand out."
0 cnlen 'help-echo 0 cnlen 'help-echo
"mouse-1: switch to buffer in other window" channame) "mouse-1: switch to buffer in other window" channame)
(funcall insert-fn channame chanbuf chanlist))) (funcall insert-fn channame chanbuf chanlist)))
(when winstart (when windows
(set-window-point window winstart) (map-apply #'set-window-start windows))
(with-selected-window window (recenter 0)))
(when (and erc-status-sidebar-highlight-active-buffer (when (and erc-status-sidebar-highlight-active-buffer
(marker-buffer erc-status-sidebar--active-marker)) (marker-buffer erc-status-sidebar--active-marker))
(goto-char erc-status-sidebar--active-marker) (goto-char erc-status-sidebar--active-marker)
@ -519,14 +532,28 @@ highlighted."
erc-kill-server-hook erc-kill-server-hook
erc-kick-hook erc-kick-hook
erc-disconnected-hook erc-disconnected-hook
erc-quit-hook)) erc-quit-hook)
"Hooks to refresh the sidebar on.
This may be set locally in the status-sidebar buffer under
various conditions, like when the option
`erc-status-sidebar-highlight-active-buffer' is non-nil.")
(defvar erc-status-sidebar--highlight-refresh-triggers
'(window-selection-change-functions)
"Triggers enabled with `erc-status-sidebar-highlight-active-buffer'.")
(defun erc-status-sidebar--refresh-unless-input ()
"Run `erc-status-sidebar-refresh' unless there are unread commands.
Also abstain when the user is interacting with the minibuffer."
(unless (or (input-pending-p) (minibuffer-window-active-p (selected-window)))
(erc-status-sidebar-refresh)))
(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. "Schedule sidebar refresh for execution after command stack is cleared.
Ignore arguments in IGNORE, allowing this function to be added to Ignore arguments in IGNORE, allowing this function to be added to
hooks that invoke it with arguments." hooks that invoke it with arguments."
(run-at-time 0 nil #'erc-status-sidebar-refresh)) (run-at-time 0 nil #'erc-status-sidebar--refresh-unless-input))
(defun erc-status-sidebar-mode--unhook () (defun erc-status-sidebar-mode--unhook ()
"Remove hooks installed by `erc-status-sidebar-mode'." "Remove hooks installed by `erc-status-sidebar-mode'."
@ -541,7 +568,7 @@ hooks that invoke it with arguments."
Note that preserve status needs to be reset when the window is Note that preserve status needs to be reset when the window is
manually resized, so `erc-status-sidebar-mode' adds this function manually resized, so `erc-status-sidebar-mode' adds this function
to the `window-configuration-change-hook'." to the `window-configuration-change-hook'."
(when (and (eq (selected-window) (let (erc-status-sidebar-singular) (when (and (eq (selected-window) (let (erc-status-sidebar--singular-p)
(erc-status-sidebar-get-window))) (erc-status-sidebar-get-window)))
(fboundp 'window-preserve-size)) (fboundp 'window-preserve-size))
(unless (eq (window-total-width) (window-min-size nil t)) (unless (eq (window-total-width) (window-min-size nil t))
@ -563,6 +590,10 @@ to the `window-configuration-change-hook'."
(add-hook 'window-configuration-change-hook (add-hook 'window-configuration-change-hook
#'erc-status-sidebar-set-window-preserve-size nil t) #'erc-status-sidebar-set-window-preserve-size nil t)
(when erc-status-sidebar-highlight-active-buffer
(setq-local erc-status-sidebar-refresh-triggers
`(,@erc-status-sidebar--highlight-refresh-triggers
,@erc-status-sidebar-refresh-triggers)))
(dolist (hk erc-status-sidebar-refresh-triggers) (dolist (hk erc-status-sidebar-refresh-triggers)
(add-hook hk #'erc-status-sidebar--post-refresh)) (add-hook hk #'erc-status-sidebar--post-refresh))

View file

@ -255,15 +255,14 @@ Only attributes that `tar-mode' can grok are mentioned.")
(decode-coding-string str coding) (decode-coding-string str coding)
str)) str))
(defvar tar-attr-vector '[nil nil nil nil nil nil nil nil]) (defvar tar-attr-vector (make-vector 8 nil))
(defun tar-parse-pax-extended-header (pos) (defun tar-parse-pax-extended-header (pos)
"Parse a pax external header of a Posix-format tar file." "Parse a pax external header of a Posix-format tar file."
(let ((end (+ pos 512)) (let ((end (+ pos 512))
(result tar-attr-vector) (result tar-attr-vector)
(coding 'utf-8-unix) (coding 'utf-8-unix)
attr value record-len value-len) attr value record-len value-len)
(dotimes (i 8) (fillarray result nil)
(aset result i nil))
(goto-char pos) (goto-char pos)
(while (and (< pos end) (while (and (< pos end)
(re-search-forward pax-extended-attribute-record-regexp (re-search-forward pax-extended-attribute-record-regexp

View file

@ -141,8 +141,10 @@ You can <\\`q'>uit; don't modify this file."))
;; modtime in that buffer, to cater to use case where the ;; modtime in that buffer, to cater to use case where the
;; file is about to be written to from some buffer that ;; file is about to be written to from some buffer that
;; doesn't visit any file, like a temporary buffer. ;; doesn't visit any file, like a temporary buffer.
(with-current-buffer (get-file-buffer (file-truename filename)) (let ((buf (get-file-buffer (file-truename filename))))
(set-visited-file-modtime)) (when buf ; If we cannot find the visiting buffer, punt.
(with-current-buffer buf
(set-visited-file-modtime))))
'unchanged))))) 'unchanged)))))
;;;###autoload ;;;###autoload

View file

@ -241,6 +241,46 @@
"<bob> " "<alice> " "<alice> " "<bob> " "<bob> " "<Dummy> " "<Dummy> ") "<bob> " "<alice> " "<alice> " "<bob> " "<bob> " "<Dummy> " "<Dummy> ")
(erc-fill-tests--compare "merge-02-right"))))) (erc-fill-tests--compare "merge-02-right")))))
(ert-deftest erc-fill-wrap--merge-action ()
:tags '(:unstable)
(unless (>= emacs-major-version 29)
(ert-skip "Emacs version too low, missing `buffer-text-pixel-size'"))
(erc-fill-tests--wrap-populate
(lambda ()
;; Set this here so that the first few messages are from 1970
(let ((erc-fill-tests--time-vals (lambda () 1680332400)))
(erc-fill-tests--insert-privmsg "bob" "zero.")
(erc-process-ctcp-query
erc-server-process
(make-erc-response
:unparsed ":bob!~u@fake PRIVMSG #chan :\1ACTION one\1"
:sender "bob!~u@fake" :command "PRIVMSG"
:command-args '("#chan" "\1ACTION one\1") :contents "\1ACTION one\1")
"bob" "~u" "fake")
(erc-fill-tests--insert-privmsg "bob" "two.")
;; Compat switch to opt out of overhanging speaker.
(let (erc-fill--wrap-action-dedent-p)
(erc-process-ctcp-query
erc-server-process
(make-erc-response
:unparsed ":bob!~u@fake PRIVMSG #chan :\1ACTION three\1"
:sender "bob!~u@fake" :command "PRIVMSG"
:command-args '("#chan" "\1ACTION three\1")
:contents "\1ACTION three\1")
"bob" "~u" "fake"))
(erc-fill-tests--insert-privmsg "bob" "four."))
(should (= erc-fill--wrap-value 27))
(erc-fill-tests--wrap-check-prefixes
"*** " "<alice> " "<bob> " "<bob> " "* bob " "<bob> " "* " "<bob> ")
(erc-fill-tests--compare "merge-wrap-01"))))
(ert-deftest erc-fill-line-spacing () (ert-deftest erc-fill-line-spacing ()
:tags '(:unstable) :tags '(:unstable)
(unless (>= emacs-major-version 29) (unless (>= emacs-major-version 29)

View file

@ -0,0 +1 @@
#("\n\n\n[Thu Jan 1 1970]\n*** This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect.[00:00]\n<alice> bob: come, you are a tedious fool: to the purpose. What was done to Elbow's wife, that he hath cause to complain of? Come me to what was done to her.\n<bob> alice: Either your unparagoned mistress is dead, or she's outprized by a trifle.\n\n[Sat Apr 1 2023]\n<bob> zero.[07:00]\n* bob one\n<bob> two.\n* bob three\n<bob> four.\n" 2 20 (erc-timestamp 0 line-prefix (space :width (- 27 (18))) field erc-timestamp) 20 21 (erc-timestamp 0 field erc-timestamp) 21 183 (erc-timestamp 0 wrap-prefix #2=(space :width 27) line-prefix #3=(space :width (- 27 (4)))) 183 190 (erc-timestamp 0 field erc-timestamp wrap-prefix #2# line-prefix #3# display #1=(#7=(margin right-margin) #("[00:00]" 0 7 (display #1# invisible timestamp font-lock-face erc-timestamp-face)))) 191 192 (erc-timestamp 0 wrap-prefix #2# line-prefix #4=(space :width (- 27 (8))) erc-command PRIVMSG) 192 197 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 197 199 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 199 202 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 202 315 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 315 316 (erc-timestamp 0 erc-command PRIVMSG) 316 348 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 349 350 (erc-timestamp 0 wrap-prefix #2# line-prefix #5=(space :width (- 27 (6))) erc-command PRIVMSG) 350 353 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 353 355 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 355 360 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 360 435 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 436 454 (erc-timestamp 1680332400 line-prefix (space :width (- 27 (18))) field erc-timestamp) 454 455 (erc-timestamp 1680332400 field erc-timestamp) 455 456 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #6=(space :width (- 27 (6))) erc-command PRIVMSG) 456 459 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #6# erc-command PRIVMSG) 459 466 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #6# erc-command PRIVMSG) 466 473 (erc-timestamp 1680332400 field erc-timestamp wrap-prefix #2# line-prefix #6# display #8=(#7# #("[07:00]" 0 7 (display #8# invisible timestamp font-lock-face erc-timestamp-face)))) 474 476 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9=(space :width (- 27 (6))) erc-ctcp ACTION erc-command PRIVMSG) 476 479 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9# erc-ctcp ACTION erc-command PRIVMSG) 479 483 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9# erc-ctcp ACTION erc-command PRIVMSG) 484 485 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10=(space :width (- 27 (6))) erc-command PRIVMSG) 485 488 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# erc-command PRIVMSG) 488 494 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# erc-command PRIVMSG) 495 497 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #11=(space :width (- 27 (2))) erc-ctcp ACTION erc-command PRIVMSG) 497 500 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #11# erc-ctcp ACTION erc-command PRIVMSG) 500 506 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #11# erc-ctcp ACTION erc-command PRIVMSG) 507 508 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12=(space :width (- 27 (6))) erc-command PRIVMSG) 508 511 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12# erc-command PRIVMSG) 511 518 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12# erc-command PRIVMSG))

View file

@ -57,20 +57,23 @@
"jpg"))))) "jpg")))))
(ert-deftest image-dired-thumb-name/per-directory () (ert-deftest image-dired-thumb-name/per-directory ()
(let ((image-dired-thumbnail-storage 'per-directory)) (let ((image-dired-thumbnail-storage 'per-directory)
(should (file-name-absolute-p (image-dired-thumb-name "foo.jpg"))) (rel-path "foo.jpg")
(should (file-name-absolute-p (image-dired-thumb-name "/tmp/foo.jpg"))) (abs-path "/tmp/foo.jpg")
(hash-name (concat (sha1 "foo.jpg") ".jpg")))
(should (file-name-absolute-p (image-dired-thumb-name rel-path)))
(should (file-name-absolute-p (image-dired-thumb-name abs-path)))
(should (equal (should (equal
(file-name-nondirectory (image-dired-thumb-name "foo.jpg")) (file-name-nondirectory (image-dired-thumb-name rel-path))
(file-name-nondirectory (image-dired-thumb-name "/tmp/foo.jpg")))) (file-name-nondirectory (image-dired-thumb-name abs-path))))
;; The cdr below avoids the system dependency in the car of the ;; The cdr below avoids the system dependency in the car of the
;; list returned by 'file-name-split': it's "" on Posix systems, ;; list returned by 'file-name-split': it's "" on Posix systems,
;; but the drive letter on MS-Windows. ;; but the drive letter on MS-Windows.
(should (equal (cdr (file-name-split (should (equal (cdr (file-name-split
(image-dired-thumb-name "/tmp/foo.jpg"))) (image-dired-thumb-name abs-path)))
'("tmp" ".image-dired" "foo.jpg.thumb.jpg"))) (list "tmp" ".image-dired" hash-name)))
(should (equal (file-name-nondirectory (should (equal (file-name-nondirectory
(image-dired-thumb-name "foo.jpg")) (image-dired-thumb-name rel-path))
"foo.jpg.thumb.jpg")))) hash-name))))
;;; image-dired-util-tests.el ends here ;;; image-dired-util-tests.el ends here

View file

@ -22,6 +22,7 @@
;;; Code: ;;; Code:
(require 'ert) (require 'ert)
(require 'ert-x)
(ert-deftest uniquify-basic () (ert-deftest uniquify-basic ()
(let (bufs old-names) (let (bufs old-names)
@ -58,35 +59,35 @@
(ert-deftest uniquify-dirs () (ert-deftest uniquify-dirs ()
"Check strip-common-suffix and trailing-separator-p work together; bug#47132" "Check strip-common-suffix and trailing-separator-p work together; bug#47132"
(let* ((root (make-temp-file "emacs-uniquify-tests" 'dir)) (ert-with-temp-directory root
(a-path (file-name-concat root "a/x/y/dir")) (let ((a-path (file-name-concat root "a/x/y/dir"))
(b-path (file-name-concat root "b/x/y/dir"))) (b-path (file-name-concat root "b/x/y/dir")))
(make-directory a-path 'parents) (make-directory a-path 'parents)
(make-directory b-path 'parents) (make-directory b-path 'parents)
(let ((uniquify-buffer-name-style 'forward) (let ((uniquify-buffer-name-style 'forward)
(uniquify-strip-common-suffix t) (uniquify-strip-common-suffix t)
(uniquify-trailing-separator-p nil)) (uniquify-trailing-separator-p nil))
(let ((bufs (list (find-file-noselect a-path) (let ((bufs (list (find-file-noselect a-path)
(find-file-noselect b-path)))) (find-file-noselect b-path))))
(should (equal (mapcar #'buffer-name bufs) (should (equal (mapcar #'buffer-name bufs)
'("a/dir" "b/dir"))) '("a/dir" "b/dir")))
(mapc #'kill-buffer bufs))) (mapc #'kill-buffer bufs)))
(let ((uniquify-buffer-name-style 'forward) (let ((uniquify-buffer-name-style 'forward)
(uniquify-strip-common-suffix nil) (uniquify-strip-common-suffix nil)
(uniquify-trailing-separator-p t)) (uniquify-trailing-separator-p t))
(let ((bufs (list (find-file-noselect a-path) (let ((bufs (list (find-file-noselect a-path)
(find-file-noselect b-path)))) (find-file-noselect b-path))))
(should (equal (mapcar #'buffer-name bufs) (should (equal (mapcar #'buffer-name bufs)
'("a/x/y/dir/" "b/x/y/dir/"))) '("a/x/y/dir/" "b/x/y/dir/")))
(mapc #'kill-buffer bufs))) (mapc #'kill-buffer bufs)))
(let ((uniquify-buffer-name-style 'forward) (let ((uniquify-buffer-name-style 'forward)
(uniquify-strip-common-suffix t) (uniquify-strip-common-suffix t)
(uniquify-trailing-separator-p t)) (uniquify-trailing-separator-p t))
(let ((bufs (list (find-file-noselect a-path) (let ((bufs (list (find-file-noselect a-path)
(find-file-noselect b-path)))) (find-file-noselect b-path))))
(should (equal (mapcar #'buffer-name bufs) (should (equal (mapcar #'buffer-name bufs)
'("a/dir/" "b/dir/"))) '("a/dir/" "b/dir/")))
(mapc #'kill-buffer bufs))))) (mapc #'kill-buffer bufs))))))
(ert-deftest uniquify-home () (ert-deftest uniquify-home ()
"uniquify works, albeit confusingly, in the presence of directories named \"~\"" "uniquify works, albeit confusingly, in the presence of directories named \"~\""
@ -147,16 +148,18 @@ uniquify-trailing-separator-p is ignored"
(project-vc-name "foo1/bar") (project-vc-name "foo1/bar")
bufs) bufs)
(save-excursion (save-excursion
(should (file-exists-p "../README")) (let ((default-directory (expand-file-name "test/" source-directory)))
(push (find-file-noselect "../README") bufs) (should (file-exists-p "../README"))
(push (find-file-noselect "other/README") bufs) (push (find-file-noselect "../README") bufs)
(should (equal (mapcar #'buffer-name bufs) (push (find-file-noselect "other/README") bufs)
'("README<other>" "README<bar>"))) (should (equal (mapcar #'buffer-name bufs)
(push (find-file-noselect "foo2/bar/README") bufs) '("README<other>" "README<bar>")))
(should (equal (mapcar #'buffer-name bufs) (push (find-file-noselect "foo2/bar/README") bufs)
'("README<foo2/bar>" "README<other>" "README<foo1/bar>"))) (should (equal (mapcar #'buffer-name bufs)
(while bufs '("README<foo2/bar>" "README<other>"
(kill-buffer (pop bufs)))))) "README<foo1/bar>")))
(while bufs
(kill-buffer (pop bufs)))))))
(provide 'uniquify-tests) (provide 'uniquify-tests)
;;; uniquify-tests.el ends here ;;; uniquify-tests.el ends here

View file

@ -38,8 +38,12 @@ Create a test directory and a buffer whose `buffer-file-name' and
Finally, delete the buffer and the test directory." Finally, delete the buffer and the test directory."
(declare (debug (body))) (declare (debug (body)))
`(ert-with-temp-directory temp-dir `(ert-with-temp-directory temp-dir
(let ((name (concat (file-name-as-directory temp-dir) (let ((name
"userfile")) ;; Use file-truename for when 'temporary-file-directory'
;; is a symlink, to make sure 'buffer-file-name' is set
;; below to a real existing file.
(file-truename (concat (file-name-as-directory temp-dir)
"userfile")))
(create-lockfiles t)) (create-lockfiles t))
(with-temp-buffer (with-temp-buffer
(setq buffer-file-name name (setq buffer-file-name name
@ -184,7 +188,8 @@ the case)."
;; Just changing the file modification on disk doesn't hurt, ;; Just changing the file modification on disk doesn't hurt,
;; because file contents in buffer and on disk look equal. ;; because file contents in buffer and on disk look equal.
(shell-command (format "touch %s" (buffer-file-name))) (shell-command (format "touch %s"
(shell-quote-argument (buffer-file-name))))
(insert "bar") (insert "bar")
(when cl (filelock-tests--should-be-locked)) (when cl (filelock-tests--should-be-locked))
@ -198,7 +203,8 @@ the case)."
;; Changing the file contents on disk hurts when buffer is ;; Changing the file contents on disk hurts when buffer is
;; modified. There shall be a query, which we answer. ;; modified. There shall be a query, which we answer.
;; *Messages* buffer is checked for prompt. ;; *Messages* buffer is checked for prompt.
(shell-command (format "echo bar >>%s" (buffer-file-name))) (shell-command (format "echo bar >>%s"
(shell-quote-argument (buffer-file-name))))
(cl-letf (((symbol-function 'read-char-choice) (cl-letf (((symbol-function 'read-char-choice)
(lambda (prompt &rest _) (message "%s" prompt) ?y))) (lambda (prompt &rest _) (message "%s" prompt) ?y)))
(ert-with-message-capture captured-messages (ert-with-message-capture captured-messages