1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00
Commit Graph

93 Commits

Author SHA1 Message Date
Sean Whitton
8903106bb7 Mark if-let and when-let obsolete
* lisp/subr.el (if-let*, when-let*, if-let, when-let): Mark
if-let and when-let obsolete (bug#73853 and elsewhere).  Move
docstring text around so that if-let* and when-let* descriptions
no longer refer to if-let and when-let.

* etc/NEWS: Announce the change.

* admin/admin.el (reminder-for-release-blocking-bugs):
* doc/misc/erc.texi (display-buffer):
* lisp/ansi-color.el (ansi-color-apply)
(ansi-color--face-vec-face):
* lisp/ansi-osc.el (ansi-osc-apply-on-region)
(ansi-osc-hyperlink):
* lisp/arc-mode.el (archive-goto-file)
(archive-next-file-displayer):
* lisp/auth-source-pass.el (auth-source-pass-search)
(auth-source-pass--parse-data)
(auth-source-pass--find-match-many):
* lisp/autorevert.el (auto-revert-notify-rm-watch):
* lisp/buff-menu.el (Buffer-menu-unmark-all-buffers)
(Buffer-menu-group-by-root):
* lisp/calendar/parse-time.el (parse-iso8601-time-string):
* lisp/cedet/pulse.el (pulse-tick):
* lisp/comint.el (comint--fontify-input-ppss-flush-indirect)
(comint--intersect-regions):
* lisp/completion-preview.el (completion-preview--try-table)
(completion-preview--capf-wrapper, completion-preview--update):
* lisp/cus-edit.el (setopt--set)
(custom-dirlocals-maybe-update-cons, custom-dirlocals-validate):
* lisp/custom.el (load-theme):
* lisp/descr-text.el (describe-char):
* lisp/desktop.el (desktop--emacs-pid-running-p):
* lisp/dired-x.el (menu):
* lisp/dired.el (dired-font-lock-keywords)
(dired-insert-directory, dired--insert-disk-space, dired-mode):
* lisp/dnd.el (dnd-handle-multiple-urls):
* lisp/dom.el (dom-remove-attribute):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
* lisp/emacs-lisp/bytecomp.el (bytecomp--custom-declare):
* lisp/emacs-lisp/comp-common.el (comp-function-type-spec):
* lisp/emacs-lisp/comp-cstr.el (comp--all-classes)
(comp-cstr-set-range-for-arithm, comp--cstr-union-1-no-mem)
(comp-cstr-intersection-no-mem, comp-cstr-fixnum-p)
(comp-cstr-type-p):
* lisp/emacs-lisp/comp-run.el (comp-subr-trampoline-install)
(native--compile-async):
* lisp/emacs-lisp/comp.el (comp--get-function-cstr)
(comp--function-pure-p, comp--intern-func-in-ctxt)
(comp--addr-to-bb-name, comp--emit-assume, comp--maybe-add-vmvar)
(comp--add-call-cstr, comp--compute-dominator-tree)
(comp--dom-tree-walker, comp--ssa-rename)
(comp--function-call-maybe-fold, comp--fwprop-call)
(comp--call-optim-func):
* lisp/emacs-lisp/edebug.el (edebug-global-prefix)
(edebug-remove-instrumentation):
* lisp/emacs-lisp/eieio.el (initialize-instance):
* lisp/emacs-lisp/ert-x.el (ert-resource-directory):
* lisp/emacs-lisp/ert.el (ert--expand-should-1)
(ert-test-location, ert-write-junit-test-report)
(ert-test--erts-test):
* lisp/emacs-lisp/icons.el (icon-complete-spec, icon-string)
(icons--create):
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--make-autoload)
(loaddefs-generate--parse-file):
* lisp/emacs-lisp/multisession.el
(multisession-edit-mode--revert, multisession-edit-value):
* lisp/emacs-lisp/package-vc.el (package-vc--read-archive-data)
(package-vc--version, package-vc--clone):
* lisp/emacs-lisp/package.el (package--reload-previously-loaded):
* lisp/emacs-lisp/pp.el (pp--insert-lisp):
* lisp/emacs-lisp/subr-x.el (add-display-text-property):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print):
* lisp/emacs-lisp/timer.el (run-at-time):
* lisp/emacs-lisp/vtable.el (vtable-goto-table)
(vtable-goto-column, vtable-update-object, vtable--insert-line)
(vtable--compute-widths, vtable--make-keymap):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/epa-file.el (epa-file-insert-file-contents):
* lisp/epa.el (epa-show-key):
* lisp/erc/erc-backend.el (erc--split-line, erc--conceal-prompt)
(PRIVMSG, erc--get-isupport-entry):
* lisp/erc/erc-button.el (erc-button-add-nickname-buttons)
(erc--button-next):
* lisp/erc/erc-common.el (erc--find-group):
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static)
(erc-fill--wrap-escape-hidden-speaker)
(erc-fill--wrap-unmerge-on-date-stamp)
(erc-fill--wrap-massage-initial-message-post-clear)
(erc-fill-wrap, erc-fill--wrap-rejigger-region):
* lisp/erc/erc-goodies.el (erc--scrolltobottom-all)
(erc--keep-place-indicator-on-window-buffer-change)
(keep-place-indicator, erc--keep-place-indicator-adjust-on-clear)
(erc-keep-place-move, erc--command-indicator-display):
* lisp/erc/erc-ibuffer.el (erc-members):
* lisp/erc/erc-join.el (erc-join--remove-requested-channel)
(erc-autojoin--join):
* lisp/erc/erc-networks.el
(erc-networks--id-qualifying-init-parts, erc-networks--id-reload)
(erc-networks--id-ensure-comparable)
(erc-networks--reclaim-orphaned-target-buffers)
(erc-networks--server-select):
* lisp/erc/erc-nicks.el (erc-nicks-invert)
(erc-nicks--redirect-face-widget-link, erc-nicks--highlight)
(erc-nicks--highlight-button)
(erc-nicks--list-faces-help-button-action, erc-nicks-list-faces)
(erc-nicks-refresh, erc-nicks--colors-from-faces)
(erc-nicks--track-prioritize)
(erc-nicks--remember-face-for-track):
* lisp/erc/erc-notify.el (querypoll, erc--querypoll-get-next)
(erc--querypoll-on-352, erc--querypoll-send):
* lisp/erc/erc-sasl.el (erc-sasl--read-password):
* lisp/erc/erc-services.el
(erc-services-issue-ghost-and-retry-nick):
* lisp/erc/erc-speedbar.el (erc-speedbar--ensure, nickbar)
(erc-speedbar-toggle-nicknames-window-lock)
(erc-speedbar--compose-nicks-face):
* lisp/erc/erc-stamp.el (erc-stamp--recover-on-reconnect)
(erc-stamp-prefix-log-filter, erc--conceal-prompt)
(erc--insert-timestamp-left, erc-insert-timestamp-right)
(erc-stamp--defer-date-insertion-on-post-modify)
(erc-insert-timestamp-left-and-right)
(erc-stamp--redo-right-stamp-post-clear)
(erc-stamp--reset-on-clear, erc-stamp--dedupe-date-stamps):
* lisp/erc/erc-status-sidebar.el (bufbar)
(erc-status-sidebar-prefer-target-as-name)
(erc-status-sidebar-default-allsort, erc-status-sidebar-click):
* lisp/erc/erc-track.el (erc-track--shortened-names-get)
(erc-track--setup, erc-track--select-mode-line-face)
(erc-track-modified-channels, erc-track--collect-faces-in)
(erc-track--switch-buffer, erc-track--replace-killed-buffer):
* lisp/erc/erc-truncate.el (erc-truncate--setup)
(erc-truncate-buffer):
* lisp/erc/erc.el (erc--ensure-query-member)
(erc--ensure-query-members, erc--remove-channel-users-but)
(erc--cusr-change-status, erc--find-mode, erc--update-modules)
(erc-log-irc-protocol, erc--refresh-prompt)
(erc--restore-important-text-props)
(erc--order-text-properties-from-hash, erc-send-input-line)
(erc-cmd-IGNORE, erc--unignore-user, erc-cmd-QUERY)
(erc-cmd-BANLIST, erc--speakerize-nick)
(erc--format-speaker-input-message, erc-channel-receive-names)
(erc-send-current-line, erc-format-target-and/or-network)
(erc-kill-buffer-function, erc-restore-text-properties)
(erc--get-eq-comparable-cmd):
* lisp/eshell/em-alias.el (eshell-maybe-replace-by-alias--which)
(eshell-maybe-replace-by-alias):
* lisp/eshell/em-glob.el (eshell-glob-convert):
* lisp/eshell/em-pred.el (eshell-pred-user-or-group)
(eshell-pred-file-time, eshell-pred-file-type)
(eshell-pred-file-mode, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-prompt.el (eshell-forward-paragraph)
(eshell-next-prompt):
* lisp/eshell/esh-arg.el (eshell-resolve-current-argument):
* lisp/eshell/esh-cmd.el (eshell-do-eval, eshell/which)
(eshell-plain-command--which, eshell-plain-command):
* lisp/eshell/esh-io.el (eshell-duplicate-handles)
(eshell-protect-handles, eshell-get-target, eshell-close-target):
* lisp/eshell/esh-proc.el (eshell-sentinel):
* lisp/eshell/esh-var.el (eshell-parse-variable-ref)
(eshell-get-variable, eshell-set-variable):
* lisp/faces.el (face-at-point):
* lisp/ffap.el (ffap-in-project):
* lisp/filenotify.el (file-notify--rm-descriptor):
* lisp/files-x.el (read-dir-locals-file)
(connection-local-update-profile-variables)
(connection-local-value):
* lisp/files.el (file-remote-p, abbreviate-file-name)
(set-auto-mode, hack-local-variables)
(revert-buffer-restore-read-only):
* lisp/find-dired.el (find-dired-sort-by-filename):
* lisp/font-lock.el (font-lock--filter-keywords):
* lisp/gnus/gnus-art.el (article-emojize-symbols):
* lisp/gnus/gnus-int.el (gnus-close-server):
* lisp/gnus/gnus-search.el (gnus-search-transform)
(gnus-search-indexed-parse-output, gnus-search-server-to-engine):
* lisp/gnus/gnus-sum.el (gnus-collect-urls, gnus-shorten-url):
* lisp/gnus/gnus.el (gnus-check-backend-function):
* lisp/gnus/message.el (message-send-mail):
* lisp/gnus/mml.el (mml-generate-mime, mml-insert-mime-headers):
* lisp/gnus/nnatom.el (nnatom--read-feed, nnatom--read-article)
(nnatom--read-article-or-group-authors, nnatom--read-publish)
(nnatom--read-update, nnatom--read-links):
* lisp/gnus/nnfeed.el (nnfeed--read-server, nnfeed--write-server)
(nnfeed--parse-feed, nnfeed--group-data, nnfeed-retrieve-article)
(nnfeed-retrieve-headers, nnfeed--print-part)
(nnfeed-request-article, nnfeed-request-group)
(nnfeed-request-list, nnfeed--group-description)
(nnfeed-request-group-description)
(nnfeed-request-list-newsgroups, nnfeed-request-rename-group):
* lisp/gnus/nnmh.el (nnmh-update-gnus-unreads):
* lisp/help-fns.el (help-find-source)
(help-fns--insert-menu-bindings, help-fns--mention-first-release)
(help-fns--mention-shortdoc-groups)
(help-fns--customize-variable-version)
(help-fns--face-custom-version-info, describe-mode):
* lisp/help-mode.el (help-make-xrefs):
* lisp/help.el (help-key-description, help--describe-command):
* lisp/hfy-cmap.el (htmlfontify-load-rgb-file):
* lisp/ibuf-ext.el (ibuffer-jump-to-filter-group)
(ibuffer-kill-filter-group, ibuffer-kill-line)
(ibuffer-save-filter-groups, ibuffer-save-filters, filename)
(basename, file-extension, ibuffer-diff-buffer-with-file-1)
(ibuffer-mark-by-file-name-regexp)
(ibuffer-mark-by-content-regexp):
* lisp/ibuf-macs.el (ibuffer-aif, ibuffer-awhen):
* lisp/ibuffer.el (ibuffer-mouse-toggle-mark)
(ibuffer-toggle-marks, ibuffer-mark-interactive)
(ibuffer-compile-format, process, ibuffer-map-lines):
* lisp/image.el (image--compute-map)
(image--compute-original-map):
* lisp/image/exif.el (exif-parse-buffer):
* lisp/image/image-converter.el (image-convert-p, image-convert)
(image-converter--find-converter):
* lisp/image/image-dired-util.el
(image-dired-file-name-at-point):
* lisp/image/image-dired.el (image-dired-track-original-file)
(image-dired--on-file-in-dired-buffer)
(image-dired--with-thumbnail-buffer)
(image-dired-jump-original-dired-buffer)
(image-dired--slideshow-step, image-dired-display-image):
* lisp/image/wallpaper.el (wallpaper--init-action-kill)
(wallpaper--find-setter, wallpaper--find-command)
(wallpaper--find-command-args, wallpaper--x-monitor-name):
* lisp/info-look.el (info-lookup-interactive-arguments)
(info-complete)::(:mode):
* lisp/info.el (info-pop-to-buffer, Info-read-node-name-1):
* lisp/international/emoji.el (emoji--adjust-displayable-1)
(emoji--add-recent):
* lisp/jsonrpc.el (jsonrpc--call-deferred)
(jsonrpc--process-sentinel, jsonrpc--remove):
* lisp/keymap.el (keymap-local-lookup):
* lisp/mail/emacsbug.el (report-emacs-bug-hook)
(submit-emacs-patch):
* lisp/mail/ietf-drums.el (ietf-drums-parse-addresses):
* lisp/mail/mailclient.el (mailclient-send-it):
* lisp/mail/rfc6068.el (rfc6068-parse-mailto-url):
* lisp/mail/undigest.el (rmail-digest-parse-mixed-mime):
* lisp/minibuffer.el (completion-metadata-get)
(completions--after-change)
(minibuffer-visible-completions--filter):
* lisp/net/browse-url.el (browse-url-url-at-point)
(browse-url-file-url, browse-url-emacs):
* lisp/net/dbus.el (dbus-byte-array-to-string)
(dbus-monitor-goto-serial):
* lisp/net/dictionary.el (dictionary-search):
* lisp/net/eww.el (eww--download-directory)
(eww-auto-rename-buffer, eww-open-in-new-buffer, eww-submit)
(eww-follow-link, eww-read-alternate-url)
(eww-copy-alternate-url):
* lisp/net/goto-addr.el (goto-address-at-point):
* lisp/net/mailcap.el (mailcap-mime-info):
* lisp/net/rcirc.el (rcirc, rcirc-connect, rcirc-send-string)
(rcirc-kill-buffer-hook, rcirc-print, rcirc-when)
(rcirc-color-attributes, rcirc-handler-NICK)
(rcirc-handler-TAGMSG, rcirc-handler-BATCH):
* lisp/net/shr.el (shr-descend, shr-adaptive-fill-function)
(shr-correct-dom-case, shr-tag-a):
* lisp/net/sieve.el (sieve-manage-quit):
* lisp/outline.el (outline-cycle-buffer):
* lisp/pcmpl-git.el (pcmpl-git--tracked-file-predicate):
* lisp/proced.el (proced-auto-update-timer):
* lisp/progmodes/bug-reference.el
(bug-reference-try-setup-from-vc):
* lisp/progmodes/c-ts-common.el (c-ts-common--fill-paragraph):
* lisp/progmodes/c-ts-mode.el (c-ts-mode--preproc-offset)
(c-ts-mode--anchor-prev-sibling, c-ts-mode-indent-defun):
* lisp/progmodes/compile.el (compilation-error-properties)
(compilation-find-file-1):
* lisp/progmodes/eglot.el (eglot--check-object)
(eglot--read-server, eglot-upgrade-eglot)
(eglot-handle-notification, eglot--CompletionParams)
(eglot-completion-at-point, eglot--sig-info)
(eglot-register-capability):
* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load)
(elisp-eldoc-var-docstring-with-value):
* lisp/progmodes/erts-mode.el (erts-mode--goto-start-of-test):
* lisp/progmodes/flymake.el (flymake--update-eol-overlays)
(flymake-eldoc-function):
* lisp/progmodes/gdb-mi.el (gdb-breakpoints-list-handler-custom)
(gdb-frame-handler):
* lisp/progmodes/go-ts-mode.el (go-ts-mode-docstring)
(go-ts-mode--comment-on-previous-line-p)
(go-ts-mode--get-test-regexp-at-point)
(go-ts-mode-test-this-file):
* lisp/progmodes/grep.el (lgrep, rgrep-default-command)
(grep-file-at-point):
* lisp/progmodes/perl-mode.el (perl--end-of-format-p):
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--anchor-prev-sibling, php-ts-mode--indent-defun):
* lisp/progmodes/project.el (project--other-place-command)
(project--find-default-from, project--transplant-file-name)
(project-prefixed-buffer-name, project--remove-from-project-list)
(project-prompt-project-name, project-remember-projects-under)
(project--switch-project-command)
(project-uniquify-dirname-transform, project-mode-line-format):
* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration)
(python--treesit-fontify-union-types)
(python-shell-get-process-name, python-shell-restart)
(python-shell-completion-at-point, python-ffap-module-path)
(python-util-comint-end-of-output-p, python--import-sources)
(python-add-import, python-remove-import, python-fix-imports):
* lisp/progmodes/xref.el (xref--add-log-current-defun):
* lisp/repeat.el (repeat-echo-message-string):
* lisp/saveplace.el (save-place-dired-hook):
* lisp/server.el (server-save-buffers-kill-terminal):
* lisp/shadowfile.el (shadow-make-fullname)
(shadow-contract-file-name, shadow-define-literal-group):
* lisp/shell.el (shell-highlight-undef-mode):
* lisp/simple.el (command-completion-using-modes-p)
(command-execute, file-user-uid, file-group-gid)
(first-completion, last-completion, switch-to-completions):
* lisp/startup.el (startup--load-user-init-file):
* lisp/tab-line.el (tab-line-tabs-buffer-group-by-project):
* lisp/tar-mode.el (tar-goto-file, tar-next-file-displayer):
* lisp/term/android-win.el (android-encode-select-string)
(gui-backend-set-selection):
* lisp/term/haiku-win.el (haiku-dnd-convert-string)
(haiku-select-encode-xstring, haiku-select-encode-utf-8-string):
* lisp/textmodes/emacs-news-mode.el (emacs-news--buttonize):
* lisp/textmodes/ispell.el (ispell-completion-at-point):
* lisp/textmodes/sgml-mode.el (sgml-validate)
(html-mode--complete-at-point):
* lisp/textmodes/tex-mode.el (tex-recenter-output-buffer)
(xref-backend-references):
* lisp/thingatpt.el (thing-at-point-file-at-point)
(thing-at-point-face-at-point):
* lisp/thread.el (thread-list--get-status):
* lisp/time.el (world-clock-copy-time-as-kill, world-clock):
* lisp/touch-screen.el (touch-screen-handle-touch):
* lisp/treesit.el (treesit-language-at, treesit-node-at)
(treesit-node-on, treesit-buffer-root-node)
(treesit-node-field-name, treesit-local-parsers-at)
(treesit-local-parsers-on, treesit--cleanup-local-range-overlays)
(treesit-font-lock-recompute-features)
(treesit-font-lock-fontify-region, treesit-transpose-sexps)
(treesit-add-log-current-defun, treesit-major-mode-setup)
(treesit--explorer-refresh, treesit-install-language-grammar):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/vc/smerge-mode.el (smerge-diff):
* lisp/vc/vc-dir.el (vc-dir):
* lisp/vc/vc-dispatcher.el (vc-do-async-command):
* lisp/vc/vc-git.el (vc-git-dir--branch-headers)
(vc-git-dir--stash-headers, vc-git--log-edit-summary-check)
(vc-git-stash-list):
* lisp/vc/vc.el (vc-responsible-backend, vc-buffer-sync-fileset)
(vc-clone):
* lisp/visual-wrap.el (visual-wrap--apply-to-line):
* lisp/wid-edit.el (widget-text)
(widget-editable-list-insert-before):
* lisp/window-tool-bar.el
(window-tool-bar--keymap-entry-to-string):
* lisp/window.el (display-buffer, display-buffer-full-frame)
(window-point-context-set, window-point-context-use)
(window-point-context-use-default-function):
* lisp/xdg.el (xdg-current-desktop):
* lisp/xwidget.el (xwidget-webkit-callback):
* lisp/yank-media.el (yank-media--get-selection)
(yank-media-types):
* test/lisp/comint-tests.el
(comint-tests/test-password-function):
* test/lisp/completion-preview-tests.el
(completion-preview-tests--capf):
* test/lisp/cus-edit-tests.el (with-cus-edit-test):
* test/lisp/erc/erc-scenarios-base-local-modules.el
(-phony-sblm-):
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify):
* test/lisp/erc/erc-services-tests.el
(erc-services-tests--asp-parse-entry):
* test/lisp/erc/erc-tests.el (erc-modules--internal-property)
(erc--find-mode, erc-tests--update-modules):
* test/lisp/erc/resources/erc-d/erc-d-i.el
(erc-d-i--parse-message):
* test/lisp/erc/resources/erc-d/erc-d-t.el
(erc-d-t-kill-related-buffers, erc-d-t-with-cleanup):
* test/lisp/erc/resources/erc-d/erc-d-tests.el
(erc-d-i--parse-message--irc-parser-tests):
* test/lisp/erc/resources/erc-d/erc-d-u.el
(erc-d-u--read-exchange-slowly):
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--expire)
(erc-d--finalize-done, erc-d--command-handle-all):
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common-with-cleanup):
* test/lisp/erc/resources/erc-tests-common.el
(erc-tests--common-display-message)
(erc-tests-common-create-subprocess):
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25058):
* test/lisp/international/mule-tests.el
(mule-cmds-tests--ucs-names-missing-names):
* test/lisp/progmodes/python-tests.el
(python-tests-get-shell-interpreter)
(python-tests--get-interpreter-info):
* test/lisp/progmodes/ruby-ts-mode-tests.el
(ruby-ts-resource-file):
* test/lisp/replace-tests.el (replace-tests-with-undo):
* test/src/emacs-tests.el (emacs-tests--seccomp-debug):
* test/src/process-tests.el (process-tests--emacs-command)
(process-tests--emacs-binary, process-tests--dump-file):
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation):
Replace use of the now-obsolete if-let and when-let.
2024-10-24 16:50:07 +08:00
F. Jason Park
e3c45b9d70 Remove erc-fill binding for cycling visual movement
* etc/ERC-NEWS: Announce removal of troublesome key binding first
introduced in ERC 5.6 as part of the `erc-fill-wrap' module.
* lisp/erc/erc-fill.el (erc-fill-wrap-mode-map): Remove key binding for
`erc-fill-wrap-cycle-visual-movement'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-wrap-visual-keys--body)
(erc-fill-wrap-visual-keys--prompt): Replace "C-c a" key simulations.
(Bug#73553)
2024-09-29 16:43:39 -07:00
F. Jason Park
51d5419fdc Redo ERC truncation and /CLEAR hook mechanism
* etc/ERC-NEWS: Mention option `erc-truncate-padding-size'.
* lisp/erc/erc-fill.el (erc-fill-wrap-mode, erc-fill-wrap-enable)
(erc-fill-wrap-disable): Manage membership in the `erc--clear-function'
advice stack for own function that massages a buffer's oldest inserted
message, post truncation.
(erc-fill--wrap-massage-initial-message-post-clear): New function.
* lisp/erc/erc-log.el (erc-log-mode, erc-log-enable): Don't add
`erc-save-buffer-in-logs' to `erc--pre-clear-functions'.  Use local
advice around common interface variable instead, as noted below.
(erc-log-disable): Likewise, don't remove `erc-save-buffer-in-logs' from
`erc--pre-clear-functions'.
(erc-log-setup-logging): Add `erc-log--save-on-clear' to
`erc--clear-function'.
(erc-log-disable-logging): Remove `erc-log--save-on-clear' to
`erc-clear-function'.
(erc-save-buffer-in-logs): Abort when `erc--insert-marker' is non-nil.
(erc-log--save-on-clear): New function, a thin wrapper around
`erc-save-buffer-in-logs', adapting it to the `erc--clear-function'
advice interface.
* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-enable): Don't
add `erc-stamp--reset-on-clear' to `erc--pre-clear-functions'.
(erc-stamp-disable): Don't remove `erc-stamp--reset-on-clear' from
`erc--pre-clear-functions'.
(erc-stamp--find-insertion-point): Account for initial position being
`bobp'.
(erc-stamp--defer-date-insertion-on-post-modify): Accommodate the rare
non-list `erc-insert-post-hook' when shadowing.
(erc-stamp--setup): Add and remove `erc-stamp--reset-on-clear' to and
from `erc--clear-function' advice stack.
(erc-stamp--redo-right-stamp-post-clear): New function.
(erc-stamp--update-saved-position): Remove unused function.  This was
originally added along with `erc-stamp--reset-on-clear' as part of
bug#60936.
(erc-stamp--reset-on-clear): Expect end of truncation boundary to be at
`erc-insert-marker'.  Rework to use new `erc--clear-function' interface
and run on `erc-timer-hook' instead of `erc-insert-done-hook'.
* lisp/erc/erc-truncate.el (erc-truncate-padding-size): New option to
help tamp down on disruptions when reading scroll back caused by overly
frequent truncation.
(erc-truncate-enable, erc-truncate-disable): Add and remove
`erc-truncate--setup' to and from `erc-mode-hook', and run it when
needed.
(erc-truncate--buffer-size): New variable.
(erc-truncate--setup): New function.
(erc-truncate-buffer-to-size): Guard execution with
`erc-truncate--padding-size' and `erc--inhibit-clear-p'.  Reflow for
readability, removing obsolete comments.  Call hooks with marker instead
of buffer position, as per the new `erc--clear-function' interface.
(erc-truncate-buffer): Defer execution to `erc-timer-hook' when running
post-insertion via a response handler.
(erc-truncate--inhibit-when-local-and-interactive): New function.
* lisp/erc/erc.el (erc-mode): Add `erc--skip-past-headroom-on-clear'
to `erc--clear-function' in all ERC buffers.
(erc--with-spliced-insertion): Account for marker being `bobp'.
(erc--insert-before-markers-transplanting-hidden): Make more robust by
accommodating initial `point' possibly being `bobp'.
(erc--clear-function): New variable, a function-valued local-advice
interface to replace `erc--pre-clear-functions'.
(erc--pre-clear-functions): Remove unused variable.
(erc--skip-past-headroom-on-clear): New function.
(erc--inhibit-clear-p): New variable.
(erc-cmd-CLEAR): Call hooks with markers instead of position.  Signal
`user-error' when `erc--inhbiit-clear-p' is non-nil.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp)
(erc-scenarios-log--cmd-clear/date-stamps): Rename former to latter,
update assertions, and use common helper.
(erc-scenarios-log--cmd-clear/left-stamps): New test.
(erc-scenarios-log--truncate): Move body to function of the same name,
and update assertions.
(erc-scenarios-log--truncate/left-stamps): New test.  (Bug#72736)
2024-09-29 16:43:38 -07:00
F. Jason Park
054602533c Improve inconsistent handling of ban lists in ERC
* etc/ERC-NEWS: Mention new function `erc-sync-banlist' in new section
for ERC 5.6.1.
* lisp/erc/erc-backend.el (erc-server-MODE): Don't call
`erc-banlist-update'.
* lisp/erc/erc-fill.el (erc--determine-fill-column-function): New
method for `fill' and `fill-wrap' modules.
* lisp/erc/erc-pcomplete.el (pcomplete/erc-mode/BANLIST)
(pcomplete/erc-mode/BL)
(pcomplete/erc-mode/MASSUNBAN, pcomplete/erc-mode/MUB):
New functions.
* lisp/erc/erc.el: Map ERC 5.6.1 to Emacs 31.1 in
`customize-package-emacs-version-alist'.
(erc-channel-banlist): Deprecate practice of using the symbol property
`received-from-server' of as a state flag because it's error-prone and
bleeds into other connections.
(erc--channel-banlist-synchronized-p): New variable to indicate
whether the ban list has been initialized.  The presence of a local
binding for `erc-channel-banlist' could probably be used for the same
purpose but would surely require rewriting `erc-cmd-BANLIST' and
`erc-cmd-MASSUNBAN'.
(erc-sync-banlist): New function, announced in ERC-NEWS.
(erc--wrap-banlist-cmd): New function.
(erc-banlist-fill-padding): New variable.
(erc--determine-fill-column-function): New generic function.
(erc-cmd-BANLIST): Move forward declaration of `erc-fill-column' from
top level into function body.  Always reset `received-from-server' to
nil.  Improve column calculations.
(erc-cmd-MASSUNBAN): Always reset `received-from-server' to nil.
(erc-banlist-finished): Deprecate function unused since 2003.
(erc--banlist-update): New function.
(erc-banlist-update): Deprecate function because its logic is faulty
and it doesn't handle mixed mode letters, like "MODE #foobar
+mb *@127.0.0.1".  See https://modern.ircdocs.horse/#mode-message.  It
also depends on an obsolete convention regarding the symbol property
`received-from-server' of `erc-channel-banlist'.  Basically, this
function used to run upon receipt of any "MODE" command from the
server.  However, actual updates to the variable `erc-channel-banlist'
only happened if `received-from-server' was t, which could only be the
case after the user issued a /MASSUNBAN.  And that behavior was
determined to be a bug.  This mode framework stuff was introduced as
part of bug#67220 for ERC 5.6.
(erc--handle-channel-mode): New function, a method for standard
channel-mode letter "b".
* test/lisp/erc/erc-tests.el (erc--channel-modes)
(erc--channel-modes/graphic-p): Assert contents of
`erc-channel-banlist' updated on "MODE".  (Bug#72736)
2024-09-29 16:43:30 -07:00
F. Jason Park
8f326e0ba2 ; Rename internal variable in erc-fill
* lisp/erc/erc-fill.el (erc--fill-wrap-scrolltobottom-exempt-p):
Rename to `erc-fill--wrap-scrolltobottom-exempt-p' so prefix matches
library and feature.
(erc-fill--wrap-ensure-dependencies): Update variable name.
* lisp/erc/erc-truncate.el (erc-max-buffer-size): Don't mention
`erc-insert-post-hook' in doc string because truncation now happens
elsewhere.
(erc-truncate-buffer-to-size): Update obsolete comment that describes
pre-5.5/Emacs 29 behavior.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--wrap-populate):
Update variable name.
* test/lisp/erc/resources/erc-d/erc-d-tests.el
(erc-d-u--canned-load-dialog--basic)
(erc-d-u--canned-load-dialog--intermingled)
(erc-d-u--rewrite-for-slow-mo): Timeouts.
* test/lisp/erc/resources/erc-d/resources/basic.eld: Timeouts.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common--make-bindings): Use updated variable name.
(Bug#72736)
2024-09-29 16:13:01 -07:00
F. Jason Park
1bbb322017 ; * lisp/erc/erc-fill.el (erc-fill-wrap-mode): Doc fix. 2024-08-04 22:27:40 -07:00
Stefan Kangas
c85f67a66d Checkdoc fixes in erc/*.el
* lisp/erc/erc-backend.el (erc-server-parameters):
* lisp/erc/erc-button.el (erc-button--display-error-with-buttons):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-fill.el (erc-fill-wrap-refill-buffer):
* lisp/erc/erc-speedbar.el (erc-speedbar--last-ran):
* lisp/erc/erc-stamp.el (erc-stamp--current-time):
* lisp/erc/erc-track.el (erc-make-mode-line-buffer-name):
* lisp/erc/erc.el (erc-interactive-display, erc-modules, erc-cmd-CLEAR)
(erc-update-current-channel-member, erc--format-user-modes)
(erc-check-text-conversion): Checkdoc fixes.
2024-07-08 16:41:02 +02:00
F. Jason Park
7aa91b299e Fix date-stamp regression in erc-fill-wrap
* lisp/erc/erc-fill.el (erc-fill-wrap, erc-fill-wrap-enable)
(erc-fill-wrap-disable): Add and remove `erc-stamp--insert-date-hook'
member.
(erc-fill--wrap-continued-predicate): Add function-valued variable for
modules to influence `erc-fill--wrap-continued-message-p', which was
originally introduced as part of bug#60936.
(erc-fill--wrap-rejigger-last-message): Move toward beginning of file.
(erc-fill--wrap-unmerge-on-date-stamp): New function.
(erc-fill-wrap): Use `erc-fill--wrap-continued-predicate'.  Restore
recently deleted hunk that reset the wrap marker upon seeing a date
stamp.
* test/lisp/erc/erc-scenarios-fill-wrap.el: New file.
* test/lisp/erc/resources/fill/wrap/merge-datestamp.eld: New file.
2024-05-27 16:47:24 -07:00
F. Jason Park
86184cba21 Don't nest date stamp insertions in erc-stamp
* etc/ERC-NEWS: Don't mention certain insertion-adjacent hooks being
suppressed for date stamps, which is no longer true.
* lisp/erc/erc-common.el (erc--solo): New utility function.
* lisp/erc/erc-fill.el (erc-fill-wrap): Don't move last-message marker
when encountering a date stamp.
* lisp/erc/erc-stamp.el (erc-stamp--recover-on-reconnect): Restore
`erc-stamp--date-stamps' on reconnect and rejoin.
(erc-stamp--insert-date-hook): Fix erroneous doc string.
(erc-stamp--date): New struct type.
(erc-stamp--deferred-date-stamp): New internal variable to pass state
between hook members.
(erc-stamp--date-stamps): New internal variable to store a reference
to all inserted timestamps.
(erc-stamp--propertize-left-date-stamp): Don't hide messages because
this function runs on `erc-insert-modify-hook'.  Prefer doing so
later, in `erc-insert-post-hook'.
(erc-stamp--find-insertion-point): New helper function.
(erc-stamp--insert-date-stamp-as-phony-message): Remove.
(erc-stamp--lr-date-on-pre-modify): Remove function.  Portions of body
now appear in `erc-stamp--defer-date-insertion-on-post-modify'.
(erc-stamp--defer-date-insertion-on-post-modify)
(erc-stamp--defer-date-insertion-on-post-insert)
(erc-stamp--defer-date-insertion-on-post-send): New functions,
although the first incorporates parts of the now defunct
`erc-stamp--lr-date-on-pre-modify'.
(erc-stamp--date-mode): Update hook-member functions.
(erc-stamp-prepend-date-stamps-p): Revise doc.
(erc-insert-timestamp-left-and-right): Remove code to initialize a
date stamp in place through a nested call to `erc-display-message'.
Instead, "pre-render" date stamp and stash it for retrieval by
the function `erc-stamp--defer-date-insertion-on-post-modify'.
(erc-stamp--setup): Kill variables `erc-stamp--deferred-date-stamp'
and `erc-stamp--date-stamps'.
(erc-stamp--reset-on-clear): Remove trimmed stamps from
`erc-stamp--date-stamps'.
* lisp/erc/erc.el (erc--msg-props): Document `erc--hide' in doc
string.
(erc--with-inserted-msg): Remove unused macro.
(erc--insert-line-splice-function): New variable.
(erc--with-spliced-insertion): New macro.
(erc--insert-line-function): Expand doc string.
(erc--remove-from-prop-value-list): Tweak doc string.
(erc--insert-before-markers-transplanting-hidden): New function.
(erc--hide-message): Remember managed `invisible' prop value.  Do so
by recording them in the `erc--hide' "msg prop".
(erc--delete-inserted-message, erc--delete-inserted-message-naively):
Rename former to latter to emphasize that it's largely impractical for
general use.
(erc--ranked-properties): Add `erc--hide'.
* test/lisp/erc/erc-button-tests.el
(erc-button-tests--erc-button-alist--function-as-form): Use
`erc-display-message' helper.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg)
(erc-fill-tests--wrap-populate, erc-fill-wrap-tests--merge-action)
(erc-fill-line-spacing): Use `erc-display-message' wrappers to
intercept `erc-timer-hook' modifications.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--invisible-stamp): Add convenience commands to
`extended-command-history' when running interactively.
* test/lisp/erc/erc-tests.el
(erc--insert-before-markers-transplanting-hidden): New test.
(erc--delete-inserted-message, erc--delete-inserted-message-naively):
Update test name as well as namesake function in body.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common-with-cleanup): Validate `erc-stamp--date-stamps'
members after every scenario test.
(erc-scenarios-common--assert-date-stamps): New function.
* test/lisp/erc/resources/erc-tests-common.el: Require `erc-stamp'
atop file when compiling.
(erc-tests--common-display-message)
(erc-tests-common-display-message)
(erc-tests-common-with-date-aware-display-message): New functions and
macro for running `erc-display-message' while intercepting additions
to `erc-timer-hook' made by date-stamp-related post-insertion hooks.
(erc-tests-common-snapshot-compare): Insert expected output into its
own buffer for easier review during interactive sessions.  This change
is unrelated to the rest of this commit.  (Bug#60936)
2024-04-19 13:54:52 -07:00
F. Jason Park
21b372a57b Improve erc-fill-wrap-merge refilling and movement
* lisp/erc/erc-fill.el (erc-fill--wrap-escape-hidden-speaker): Add
parameter to suppress escaping of hidden prefixes.
(erc-fill--wrap-beginning-of-line): Remember original value of point,
and pass it to `erc-fill--wrap-escape-hidden-speaker'.
(erc-fill--wrap-previous-line, erc-fill--wrap-next-line): Guard call
to `erc-fill--wrap-escape-hidden-speaker' with conditional check for
`erc-fill-wrap-merge'.
(erc-fill--wrap-insert-merged-pre): Add additional text property,
`erc-fill--wrap-merge', to help identify `display' regions servicing
`erc-fill-wrap-merge'.  This should make resolving inconsistencies
easier when "splicing" new messages between existing ones.
(erc-fill-wrap): Add `erc-fill--wrap-merge' text property to merged
speaker region.
(erc-fill--wrap-rejigger-region): Remove assertion disallowing a
non-nil `erc-fill--wrap-rejigger-last-message'.  Instead, adopt the
existing value of that variable when shadowing it for the remaining
extent of the function's execution.  When removing the `display'
property, also look for nonempty replacement text, such as values
specified by the option `erc-fill-wrap-merge-indicator'.
(erc-fill--wrap-merged-button-p): Look for `erc-fill--wrap-merge'
property instead of `display'.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
(Bug#60936)
2024-04-19 13:54:52 -07:00
F. Jason Park
c572c30fb1 Simplify option erc-merge-wrap-merge-indicator
* lisp/erc/erc-fill.el (erc-fill-wrap-merge-indicator): Reduce
offering of acceptable values by removing leading symbols and ditching
the `post' variant entirely.  The justification for the latter move
hinges on it not being well suited to next-gen requirements involving
the splicing and deletion of inserted messages.  Meeting these would
be overly burdensome and involve scanning the buffer in both
directions for every such operation.  This option is new in ERC 5.6,
which is yet unreleased.
(erc-fill--wrap-massage-legacy-indicator-type): New function to warn
of obsolete `erc-fill-wrap-merge-indicator' value and perform a
migration for the current session.
(erc-fill-wrap, erc-fill-wrap-enable): Preform preflight compat check
for obsolete `erc-fill-wrap-merge-indicator' value types.
(erc-fill-wrap-disable): Don't bother killing nonexistent variable
`erc-fill--wrap-merge-indicator-post'.
(erc-fill--wrap-merge-indicator-post): Remove unused variable.
(erc-fill--wrap-insert-merged-post): Remove unused function.
(erc-fill--wrap-insert-merged-pre): Adapt to simplified format for
option `erc-merge-wrap-merge-indicator'.
(erc-fill-wrap): Remove conditional dispatch because there is only one
path and only one indicator style.
(erc-fill--wrap-rejigger-region): Remove reference to nonexistent
variable `erc-fill--wrap-merge-indicator-post'.
* test/lisp/erc/erc-fill-tests.el
(erc-fill-wrap--merge-action/indicator-pre): Update format of value
for option `erc-fill-wrap-merge-indicator'.
(erc-fill-wrap--merge-action/indicator-post): Remove test focusing on
obsolete and unsupported `post' variant of option
`erc-fill-wrap-merge-indicator'.
(erc-fill--wrap-massage-legacy-indicator-type): New test.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
Delete file.  (Bug#60936)
2024-04-19 13:54:52 -07:00
F. Jason Park
9668b4f97c Make erc-fill-wrap depend on scrolltobottom
* lisp/erc/erc-fill.el (erc-fill-mode): Add reference to
`erc-fill-wrap-mode' in doc string.
(erc--fill-wrap-scrolltobottom-exempt-p): New variable to allow tests
involving `fill-wrap' to opt out of having to enable `scrolltobottom'.
(erc-fill--wrap-ensure-dependencies): Warn and enable
`erc-scrolltobottom-mode' if necessary.
(erc-fill-wrap-mode): Mention workaround for automatically enabling
`scrolltobottom'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--wrap-populate):
Exempt tests from `scrolltobottom' dependency.
* test/lisp/erc/resources/erc-scenarios-common.el: Load `erc-fill'
when compiling.
(erc-scenarios-common--print-trace): Exempt tests using `fill-wrap'
from the `scrolltobottom' dependency by making
`erc--fill-wrap-scrolltobottom-exempt-p' non-nil during test runs.
(Bug#60936)
2024-02-16 19:58:35 -08:00
F. Jason Park
e288e1b2f3 Remove "erc-" prefixed Compat definitions
* lisp/erc/erc-compat.el: Remove NO-ERROR argument from top-level
`require' for library `compat' because it's guaranteed to be present.
(erc-compat-function, erc-compat-call): Redefine as obsolete aliases
for unprefixed namesakes.
* lisp/erc/erc-fill.el (erc-fill-wrap-nudge): Use `compat-call'
instead of `erc-compat-call'.
2024-02-16 19:58:35 -08:00
Po Lu
ecf08f0621 Merge from savannah/emacs-29
dc4e6b1329 ; Update copyright years in more files
64b3777631 ; Run set-copyright from admin.el
8e1c56ae46 ; Add 2024 to copyright years

# Conflicts:
#	doc/misc/modus-themes.org
#	doc/misc/texinfo.tex
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	etc/themes/modus-operandi-theme.el
#	etc/themes/modus-themes.el
#	etc/themes/modus-vivendi-theme.el
#	lib/alloca.in.h
#	lib/binary-io.h
#	lib/c-ctype.h
#	lib/c-strcasecmp.c
#	lib/c-strncasecmp.c
#	lib/careadlinkat.c
#	lib/cloexec.c
#	lib/close-stream.c
#	lib/diffseq.h
#	lib/dup2.c
#	lib/filemode.h
#	lib/fpending.c
#	lib/fpending.h
#	lib/fsusage.c
#	lib/getgroups.c
#	lib/getloadavg.c
#	lib/gettext.h
#	lib/gettime.c
#	lib/gettimeofday.c
#	lib/group-member.c
#	lib/malloc.c
#	lib/md5-stream.c
#	lib/md5.c
#	lib/md5.h
#	lib/memmem.c
#	lib/memrchr.c
#	lib/nanosleep.c
#	lib/save-cwd.h
#	lib/sha1.c
#	lib/sig2str.c
#	lib/stdlib.in.h
#	lib/strtoimax.c
#	lib/strtol.c
#	lib/strtoll.c
#	lib/time_r.c
#	lib/xalloc-oversized.h
#	lisp/auth-source-pass.el
#	lisp/emacs-lisp/lisp-mnt.el
#	lisp/emacs-lisp/timer.el
#	lisp/info-look.el
#	lisp/jit-lock.el
#	lisp/loadhist.el
#	lisp/mail/rmail.el
#	lisp/net/ntlm.el
#	lisp/net/webjump.el
#	lisp/progmodes/asm-mode.el
#	lisp/progmodes/project.el
#	lisp/progmodes/sh-script.el
#	lisp/textmodes/flyspell.el
#	lisp/textmodes/reftex-toc.el
#	lisp/textmodes/reftex.el
#	lisp/textmodes/tex-mode.el
#	lisp/url/url-gw.el
#	m4/alloca.m4
#	m4/clock_time.m4
#	m4/d-type.m4
#	m4/dirent_h.m4
#	m4/dup2.m4
#	m4/euidaccess.m4
#	m4/fchmodat.m4
#	m4/filemode.m4
#	m4/fsusage.m4
#	m4/getgroups.m4
#	m4/getloadavg.m4
#	m4/getrandom.m4
#	m4/gettime.m4
#	m4/gettimeofday.m4
#	m4/gnulib-common.m4
#	m4/group-member.m4
#	m4/inttypes.m4
#	m4/malloc.m4
#	m4/manywarnings.m4
#	m4/mempcpy.m4
#	m4/memrchr.m4
#	m4/mkostemp.m4
#	m4/mktime.m4
#	m4/nproc.m4
#	m4/nstrftime.m4
#	m4/pathmax.m4
#	m4/pipe2.m4
#	m4/pselect.m4
#	m4/pthread_sigmask.m4
#	m4/readlink.m4
#	m4/realloc.m4
#	m4/sig2str.m4
#	m4/ssize_t.m4
#	m4/stat-time.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/stdio_h.m4
#	m4/stdlib_h.m4
#	m4/stpcpy.m4
#	m4/strnlen.m4
#	m4/strtoimax.m4
#	m4/strtoll.m4
#	m4/time_h.m4
#	m4/timegm.m4
#	m4/timer_time.m4
#	m4/timespec.m4
#	m4/unistd_h.m4
#	m4/warnings.m4
#	nt/configure.bat
#	nt/preprep.c
#	test/lisp/register-tests.el
2024-01-02 10:28:14 +08:00
Po Lu
8e1c56ae46 ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
F. Jason Park
7576926bea Replace erc--get-inserted-msg-bounds with functions
* lisp/erc/erc-fill.el (erc-fill--wrap-rejigger-region): Call
`erc--get-inserted-msg-end' instead of `erc--get-inserted-msg-bounds'
with `end' arg.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Call
`erc--get-inserted-msg-beg' with `point' instead of
`erc--get-inserted-msg-bounds' with `beg' arg.
* lisp/erc/erc.el (erc--get-inserted-msg-beg-at,
erc--get-inserted-msg-end-at): New macros.
(erc--get-inserted-msg-beg, erc--get-inserted-msg-end): New functions.
(erc--get-inserted-msg-bounds): Convert to function with different
signature, and refactor.  This was introduced for the yet unreleased
5.6 (Emacs 30) by bug#60936.
(erc--get-inserted-msg-prop): Use `erc--get-inserted-msg-beg' instead
of `erc--get-inserted-msg-bounds' with `beg' arg.
(erc--delete-inserted-message): Update call site of
`erc--get-inserted-msg-bounds' to match new signature.
(erc-cmd-CLEAR): Use `erc--get-inserted-msg-beg' instead of
`erc--get-inserted-msg-bounds' with `beg' arg.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-right-fools-invisible): Call
`erc--get-inserted-msg-end' instead of `erc--get-inserted-msg-bounds'.
* test/lisp/erc/erc-tests.el (erc-tests--get-inserted-msg-setup,
erc-tests--assert-get-inserted-msg,
erc-tests--assert-get-inserted-msg/basic,
erc-tests--assert-get-inserted-msg/stamp,
erc-tests--assert-get-inserted-msg-readonly-with): New helper
functions.
(erc--get-inserted-msg-beg/basic, erc--get-inserted-msg-beg/readonly,
erc--get-inserted-msg-beg/stamp,
erc--get-inserted-msg-beg/readonly/stamp,
erc--get-inserted-msg-end/basic, erc--get-inserted-msg-end/stamp,
erc--get-inserted-msg-end/readonly,
erc--get-inserted-msg-end/readonly/stamp,
erc--get-inserted-msg-bounds/readonly,
erc--get-inserted-msg-bounds/stamp,
erc--get-inserted-msg-bounds/readonly/stamp): New tests.
(erc--get-inserted-msg-bounds, erc--get-inserted-msg-bounds/basic):
Move `beg' and `end' cases to separate test variants and rename former
to latter.
2023-12-27 21:32:25 -08:00
F. Jason Park
9d961b3107 Demote erc-fill-line-spacing to a normal variable
* etc/ERC-NEWS: Remove section from 5.6 announcing user option
`erc-fill-line-spacing'.
* lisp/erc/erc-fill.el (erc-fill-line-spacing): Change from an option
to a variable and note unfortunate UX hiccups.
(erc-fill-wrap-merge, erc-fill-wrap-merge-indicator, fill-wrap):
Remove mention of the option, now variable, `erc-fill-line-spacing'.
(Bug#60936)
2023-12-17 20:17:55 -08:00
F. Jason Park
49bfea4386 Use templates for formatting chat messages in ERC
* doc/misc/erc.texi: Replace option `erc-format-nick-function' with
`erc-show-speaker-membership-status'.
* etc/ERC-NEWS: Mention shift to template-based speaker formatting.
Also mention in-buffer STATUSMSG support and various name changes and
new formatting-related options.
* lisp/erc/erc-backend.el (erc-format-privmessage): Remove forward
declaration.
(erc--determine-speaker-message-format-args): Add forward declaration.
(erc--statusmsg-target): New utility function for detecting whether
the current target is status-prefixed.
(erc-current-message-catalog): Move here from lisp/erc/erc.el.
(erc--message-speaker-catalog): New variable.
(erc--speaker-status-prefix-wanted-p): New variable specifically for
the function `erc-format-@nick' to signal it wants status-prefixes
prepended to the displayed nick.
(erc-server-PRIVMSG): Initialize `let'-bound value of
`erc--msg-prop-overrides' to a dummy `erc--tmp' property with a null
value that `erc-display-message' will "strip" before calling its
hooks.  Move away from the rather blunt symbol `msg' as a useful value
for `erc--msg'.  Instead, allow `erc-display-message' to assign the
most appropriate value based on context.  Also, bind the variable
`erc-current-message-catalog' to whatever the buffer's
`erc--message-speaker-catalog' happens to be.  Future internal modules
can set this to alternative catalogs as needed.  Additionally, detect
STATUSMSG prefixes on targets and inform the formatting logic of the
verdict.  Lastly, and most importantly, use the function
`erc--determine-speaker-message-format-args' instead of
`erc-format-privmessage' for message formatting.  Pass along the
returned "catalog key" and spec parameters to `erc-display-message'.
However, for NOTICEs, continue to render the string, as before, for
the two "echo notice" hooks.
* lisp/erc/erc-common.el (erc--ctcp-response): New "subsclass" of
`erc-response' for smuggling extra information to CTCP query handlers
in a mostly backwards-compatible way.  The same approach could be
taken with the "echo notice" hooks mentioned above.
* lisp/erc/erc-dcc.el (erc-dcc-chat-filter): Add `erc--spkr' and
`erc--speaker' properties even though these chat buffers are not
`erc-mode' buffers.
* lisp/erc/erc-fill.el (erc-fill--wrap-last-msg,
erc-fill--wrap-max-lull): Add doc strings.
(erc-fill--wrap-continued-message-p): Rework to look for `erc--spkr'-
`erc--msg' combinations as indicators of speaker continuity.
(erc-fill--wrap-rejigger-region): Remove reference to the no longer
relevant `erc-stamp-type'.  Instead, use the `erc--msg' property
combined with the `erc-timestamp' field to detect date stamps because
all are currently left-sided.
* lisp/erc/erc-stamp.el (erc-stamp--propertize-left-date-stamp): Don't
add superfluous `erc-stamp-type' property.
* lisp/erc/erc.el (erc--msg-props): Revise purpose and meaning of
`erc--msg' by removing possible value `msg', which was previously
meant to indicate that a message had a "speaker".  Instead, rely on
the separate `erc--spkr' property to convey this information, with
`erc--msg' now expressing a "type" or "role".
(erc--use-language-catalog-for-ctcp-action-p): New variable, a
compatibility switch to help transition from the `ACTION' entry of the
language catalog to the `ctcp-action' family of entries in the new
`-speaker' catalog.
(erc--ensure-spkr-prop): Update to include any passed-in environmental
overrides.
(erc--send-action-display): Restore pre-5.6 behavior when
compatibility flag enabled.  Otherwise, use new `-speaker' catalog for
formatting inserted message.
(erc--send-message-external): Overhaul to behave more faithfully in
mimicking a line submitted at the prompt of the current target buffer.
(erc--own-property-names): Remove `erc-stamp-type'.
(erc-ensure-target-buffer-on-privmsg): Add new choice variant for old
default behavior and change meaning of default to mean "except for
STATUSMSGs".  This option is newly revived for ERC 5.6.
(erc--message-speaker-statusmsg, erc--message-speaker-statusmsg-input,
erc--message-speaker-input, erc--message-speaker-input-chan-privmsg,
erc--message-speaker-input-chan-notice,
erc--message-speaker-input-query-privmsg,
erc--message-speaker-input-query-notice,
erc--message-speaker-chan-privmsg, erc--message-speaker-query-privmsg,
erc--message-speaker-chan-notice, erc--message-speaker-query-notice,
erc--message-speaker-ctcp-action,
erc--message-speaker-ctcp-action-input,
erc--message-speaker-ctcp-action-statusmsg,
erc--message-speaker-ctcp-action-statusmsg-input): New variables for
new `speaker' format-template catalog.
(erc--speakerize-nick): New helper function.
(erc--determine-speaker-message-format-args): New function to find the
appropriate format key from various contextual parameters.  Could
become the default of a function-valued variable for internal use.
(erc-show-speaker-membership-status): New option.
(erc-format-nick-function, erc-speaker-from-channel-member-function):
Declare former as an obsolete alias for the latter, and redefine
purpose slightly.
(erc-format-nick-function, erc-determine-speaker-from-user): Rename
former to latter and obsolete the old name.
(erc-format-nick, erc-determine-speaker-from-user): Rename former to
latter and obsolete old name.
(erc-format-@nick): Deprecate and adapt for use with new
template-based formatting paradigm.
(erc-format-my-nick): Move `erc-speaker' text prop toward head of
list, meaning it will end up beneath `font-lock-face' in the final
output.
(erc--format-speaker-input-message): New function to replace
`erc-format-my-nick' in-tree.
(erc-process-ctcp-query): Don't bind `erc--msg' to `msg'.  Instead,
rely on `erc-display-message' to set it to the current template key.
(erc-ctcp-query-ACTION): Prefer using formatting template, but attempt
to simulate pre-5.6 behavior when compatibility flag enabled.
(erc-display-msg): Use `erc--format-speaker-input-message' instead of
`erc-format-my-nick'.  Ignore `erc--msg-prop-overrides' with null
values.
(erc-current-message-catalog): Move to erc-backend.el.
* test/lisp/erc/erc-scenarios-base-statusmsg.el: New file.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--left/display-margin-mode): Expect format catalog
key instead of unhelpful `msg' as value of `erc--msg' prop.
* test/lisp/erc/erc-tests.el (erc-message): Render format template in
mock function and expect string in assertions.
(erc-tests--format-privmessage): New function, a helper for the
following test.
(erc-format-privmessage, erc--determine-speaker-message-format-args):
Rename former to latter and suppress deprecation warning.
(erc--determine-speaker-message-format-args/queries,
erc--determine-speaker-message-format-args/queries-as-channel): New
tests.
(erc-tests--format-my-nick): New helper function for the following
test.
(erc--format-speaker-input-message): New test.
* test/lisp/erc/resources/base/display-message/statusmsg.eld: New
file.  (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Update.
2023-12-17 20:17:55 -08:00
F. Jason Park
236a416be7 Add erc--spkr text property to chat messages
* etc/ERC-NEWS: Mention combined face ordering for "/me" messages.
* lisp/erc/erc-backend.el (erc-server-PRIVMSG): Bind
`erc--msg-prop-overrides' for the extent of this function's execution,
which means a large amount of code will see this variable as being
non-nil.  However, no calls to `erc-display-message' or
`erc-display-msg' should occur other than the one handling the final
insertion.  Code needing to influence the current message's "msg
props" can push new pairs onto this value, which will override any
existing collisions.
* lisp/erc/erc-fill.el (erc-fill): Switch to `erc--spkr' as sentinel
property.
(erc-fill--wrap-continued-message-p): Look for `erc--spkr' property
instead of `erc-speaker'.
* lisp/erc/erc.el (erc--msg-props): Mention `erc--spkr' in doc.
(erc--send-action-perform-ctcp): Add `erc--spkr' property.  Fix bug in
which `erc-my-nick-face' appeared below `erc-input-face' in the
speaker portion.
(erc--ensure-spkr-prop): New helper function to propagate speaker
metadata.
(erc--ranked-properties): Add `erc--spkr', `erc--ctcp', and
`erc--ephemeral'.
(erc-display-message): Use default hash table size when initializing.
Remove unnecessary assignment of `msg' to `erc--msg' for PRIVMSG and
NOTICE commands.  Bind `string' below `erc--msg-props' so that
implementers of the function form of the `erc-format-message'
templating interface can read and write the current context's "msg
props".
(erc--own-property-names): Add all `erc--msg-props' props by
subsumation.
(erc--get-speaker-bounds): Use `erc--spkr' instead of `erc--msg' as a
sentinel to detect a chat message guaranteed to have an `erc--speaker'
text-property interval.
(erc-format-privmessage, erc-format-my-nick, erc-ctcp-query-ACTION):
Add `erc--spkr' to `erc--msg-prop-overrides' when available.
* test/lisp/erc/erc-fill-tests.el: (erc-fill-tests--insert-privmsg):
Bind `erc--msg-prop-overrides'.
(erc-fill-tests--compare): Require environment variable value to match
current test name exactly when saving snapshots.  Add `erc--msg-props'
individually to white list.
* test/lisp/erc/erc-tests.el (erc--order-text-properties-from-hash):
Include `erc--spkr'.  (Bug#60936)  (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
2023-12-17 20:17:55 -08:00
F. Jason Park
1e2b156f04 Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties.  Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936)  (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-17 20:17:54 -08:00
F. Jason Park
61b22ae9f3 Sequester some special-variable declarations in ERC
* lisp/erc/erc-backend.el (erc-log-p): Remove declaration entirely.
(erc-server-reconnect): Move declaration for `erc-reuse-buffers' here.
(erc-process-sentinel-1): Move `erc-kill-server-buffer-on-quit'
declaration here.
(erc--conceal-prompt): Move `erc-prompt-hidden' declaration here.
(erc-server-INVITE): Move `erc-invitation' declaration here.
(erc-server-PART): Move `erc-kill-buffer-on-part' declaration here.
(erc-server-PRIVMSG): Move declarations for `erc-minibuffer-ignored',
`erc-receive-query-display', `erc-receive-query-display-defer',
`erc--cmem-from-nick-function', `erc-format-nick-function', and
`erc-format-query-as-channel-p' here.
(erc-server-401): Move `erc-whowas-on-nosuchnick' declaration here.
(erc-server-475): Move `erc--called-as-input-p' and
`erc-prompt-for-channel-key' declarations here.
* lisp/erc/erc-common.el (erc-log-p): Remove declaration for
`erc-log-p' and replace with actual definition.
(erc-log-aux): Move `erc-dbuf' declaration from top level into
function body.
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Note in
the doc string that this function produces side effects.
* lisp/erc/erc-networks.el (erc-determine-network,
erc-networks--copy-server-buffer-functions): Move some variable
declarations to function body.
(erc-settings, erc-get): Deprecate for now and explain why in doc
strings.  We could deprecate them unconditionally, but they never
provided usable code, and their names are short and valuable.
* lisp/erc/erc.el (tabbar--local-hlf, motif-version-string,
gtk-version-string): Prefer moving these single-serving declarations
to function bodies, if only to make closures from this library less
cluttered when debugging.  This should also help avoid stray
declarations.
(erc-hooks, erc-timer-hook): Revise doc strings.
(erc-log-p): Move definition to erc-common.el.
(erc-cmd-SV): Mimic `emacs-version' and stick with `featurep', here in
combination with special-variable declarations, instead of `boundp' or
similar.
(erc-header-line-uses-tabbar-p): Explain that this has nothing to do
with `tab-bar'.
(erc-update-mode-line-buffer): Only assign when bound.  This has been
verified to work with version 2.0 on EmacsWiki.
* test/lisp/erc/erc-scenarios-base-reconnect.el: Timeouts.
* test/lisp/erc/erc-scenarios-base-renick.el: Timeouts.
* test/lisp/erc/resources/join/network-id/foonet-again.eld: Timeouts.
2023-12-17 20:17:54 -08:00
F. Jason Park
01e7178917 ; Fix erc--channel-modes test on graphical displays
* lisp/erc/erc-fill.el (erc-fill--wrap-insert-merged-post): Use
correct variable.
* test/lisp/erc/erc-scenarios-display-message.el: Mute unrelated noisy
test.
* test/lisp/erc/erc-tests.el (erc--channel-modes): Bail out following
first group of assertions when running on a graphical display.
(erc--channel-modes/graphic-p): New test asserting different values
for graphical terminals.  Note that this too is tagged as :unstable.
See also: d2ce30afdd "; Mark test for erc--update-channel-modes as
:unstable".
2023-11-26 14:25:27 -08:00
F. Jason Park
0a6d0a4959 Simplify option erc-fill-wrap-merge-indicator
* lisp/erc/erc-fill.el (erc-fill-function): Add hyperlink to
`erc-fill-wrap-mode' in doc string.
(erc-fill-wrap-merge-indicator-face): New face.  The rationale for
adding this is that hard-coding `erc-fill-wrap-merge-indicator' to use
specific non-ERC faces forces folks to customize the option by
specifying a value manually, which may not be easy for new users,
seeing as its :type is relatively complex.
(erc-fill-wrap-merge-indicator): Add new preset without leading
space, for narrow windows, and replace `shadow' with
`erc-fill-wrap-merge-indicator-face' everywhere.
(erc-fill-wrap-mode): Add configuration hint to doc string for related
options when facing narrow windows.
(erc-fill--wrap-insert-merged-post, erc-fill--wrap-insert-merged-pre):
Fix sloppy thinko in which "-pre" and "-post" stash variables for
precomputed values were swapped.  Also accommodate :type string
variant for option `erc-fill-wrap-merge-indicator'.
(erc-fill--wrap-rejigger-region): Clear pre-computed merge-indicator
value.  (Bug#60936)
2023-11-25 15:59:58 -08:00
F. Jason Park
7cbe6ae712 Add merged-message indicator option for erc-fill-wrap
* lisp/erc/erc-fill.el (erc-fill): Use `when-let' instead of
`when-let*'.
(erc-fill-wrap-merge): Mention companion options in doc string.
(erc-fill-wrap-merge-indicator): New option to display a
distinguishing "indicator" in the form of a one-character string
between messages from the same speaker.
(erc-fill-wrap-mode, erc-fill-wrap-disable): Mention
`erc-fill-wrap-merge-indicator' in doc string and kill related local
variables.
(erc-fill--wrap-merge-indicator-pre,
erc-fill--wrap-merge-indicator-post): New internal variables for
caching merge indicator.
(erc-fill--wrap-insert-merged-post, erc-fill--wrap-insert-merged-pre):
New functions for adding merge indicators either before or after a
message.
(erc-fill-wrap): Add logic for deferring to merge-indicator helpers
when needed.
* test/lisp/erc/erc-fill-tests.el (erc-fill-wrap-tests--merge-action,
erc-fill-wrap--merge-action): Move body of latter test into former, a
new fixture function.
(erc-fill-wrap--merge-action/indicator-pre,
erc-fill-wrap--merge-action/indicator-post): New tests.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
New test data file.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
New test data file.  (Bug#60936)
2023-11-24 13:38:52 -08:00
F. Jason Park
8bb68a522f Optionally align prompt to prefix in erc-fill-wrap
* lisp/erc/erc-fill.el (erc-fill-wrap-align-prompt): New option for
aligning prompt with leading portion of messages at the common "static
center" pivot-column barrier, so it appears "dedented" along with all
speaker name tags.  Tests for this functionality appear in the
subsequent patch of this same change set.
(erc-fill-wrap-use-pixels): Demote from user option to normal variable
because it has no practical use other than for testing.  Don't rename
as internal variable to spare the improbable user of ERC on HEAD who's
already customized this.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Take care to disable prompt-in-left-margin behavior when option
`erc-fill-wrap-align-prompt' is non-nil.
(erc-fill--wrap-measure): Improve doc string and always attempt to
leverage `buffer-text-pixel-size', even when the variable
`erc-fill-wrap-use-pixels' is nil.
(erc-fill--wrap-indent-prompt): New function to massage prompt
`line-prefix' after updates, such as changes to away status.
(Bug#51082)
2023-11-24 13:38:52 -08:00
F. Jason Park
ece62f5c1c ; Prepare for ERC 5.6 release
* doc/misc/erc.texi: Minor tweak in SASL section.
* etc/ERC-NEWS: Revise various sections under 5.6.
* lisp/erc/erc-button.el (erc-button-alist): Remove comment.
(erc-nick-popup-alist): Remove comment.
* lisp/erc/erc-fill.el (erc-fill-wrap-margin-width): Remove comment.
(erc-fill-wrap-margin-side): Remove comment.
(erc-fill-line-spacing): Remove comment.
(erc-fill-wrap-use-pixels): Remove comment.
(erc-fill-wrap-visual-keys): Remove comment.
(erc-fill-wrap-force-screen-line-movement): Remove comment.
(erc-fill-wrap-merge): Remove comment.
* lisp/erc/erc-goodies.el (erc-scrolltobottom-all): Remove comment.
(erc-keep-place-indicator-style): Remove comment.
(erc-keep-place-indicator-buffer-type): Remove comment.
(erc-keep-place-indicator-follow): Remove comment.
* lisp/erc/erc-networks.el (erc-server-alist): Remove comment.
* lisp/erc/erc-nicks.el (erc-nicks): Remove comment.
* lisp/erc/erc-speedbar.el
(erc-speedbar-nicknames-window-width): Remove comment.
(erc-speedbar-hide-mode-topic): Remove comment.
(erc-speedbar-my-nick-face): Remove comment.
* lisp/erc/erc-stamp.el (erc-timestamp-format-right): Remove comment.
(erc-echo-timestamp-zone): Remove comment.
(erc-timestamp-use-align-to): Remove comment.
* lisp/erc/erc-status-sidebar.el
(erc-status-sidebar-highlight-active-buffer): Remove comment.
(erc-status-sidebar-style): Remove comment.
(erc-status-sidebar-click-display-action): Remove comment.
* lisp/erc/erc.el: Bump required Compat version to 29.1.4.3 in
Package-Requires header.
(erc-notice-face): Remove comment.
(erc-action-face): Remove comment.
(erc-interactive-display): Remove comment.
(erc-auto-reconnect-display-timeout): Remove comment.
(erc-reconnect-display-server-buffers): Remove comment.
(erc-modules): Remove comment.
* test/lisp/erc/resources/base/display-message/multibuf.eld: Remove
reference to specific ERC version in QUIT command reason.
* test/lisp/erc/resources/base/assoc/reconplay/foonet.eld: Timeout.
2023-11-12 20:37:49 -08:00
F. Jason Park
9acd8c8e53 Tidy up ERC's internal text-property API
* lisp/erc/erc-fill.el (erc-fill--spaced-commands): Remove unused
internal variable originally intended for ERC 5.6.
(erc-fill): Check for `erc-msg' being `msg', which carries the same
meaning as `erc-cmd' being `PRIVMSG' or `NOTICE', except that inserted
outgoing messages now no longer normally have an `erc-cmd' property.
(erc-fill-wrap-mode, erc-fill-wrap-disable): Kill
`erc-fill--wrap-last-msg'.
(erc-fill--wrap-max-lull): Convert from buffer-local to normal
variable.
(erc-fill--wrap-continued-message-p): Rework slightly to guard against
resetting the "last speaker" marker when the `erc-ephemeral' text
property is present.  This tells insert- and send-related hook members
to pretend the current message doesn't exist when performing stateful
operations.  That is, modules should expect the message being inserted
to possibly disappear or be replaced.  Also, look for `erc-msg' being
`msg' instead of `erc-cmd' being `PRIVMSG', and fix bug involving only
checking `erc-ctcp' in the current message.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Don't insert timestamps
when the `erc-ephemeral' text property is present.
* lisp/erc/erc.el (erc--msg-props): Add doc string explaining the
purpose of this variable and the various text properties most commonly
present in its value.
(erc--msg-prop-overrides): Add doc string.
(erc-send-action): Don't set `erc-cmd' prop on outgoing CTCP ACTIONs.
(erc-display-message): Reverse overrides to prefer items toward the
front of the alist.
(erc-process-ctcp-query): Include existing overrides from environs.
(erc-send-current-line): Include existing overrides from environs.
(erc-display-msg): Fix doc string and reverse overrides.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Remove stray comment.
(erc-fill-tests--save-p): Set value from environment variable.
(erc-fill-tests--compare): Limit writing snapshots to one test at a
time.
(erc-fill-wrap--merge-action): Fix expected output for non-action
messages that follow action messages.  These were previously merged
but escaped detection.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
(Bug#60936)
2023-10-27 13:09:29 -07:00
F. Jason Park
7ffc79690a Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'.  Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'.  Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers.  At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way.  Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string.  Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'.  But only do this when
PARSED is nil, and MSG is a string.  Call `erc--route-insertion'
instead of `erc-display-line'.  Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-20 14:53:24 -07:00
Mauro Aranda
baf778c7ca More defcustom fixes in ERC (Bug#66520)
* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation): Change
:type to choice, to allow nil.
* lisp/erc/erc-goodies.el (erc-keep-place-indicator-style): Fix
copy-pasta.
* lisp/erc/erc-networks.el (erc-networks-alist): Don't advertise that
MATCHER can be a function since it doesn't look like that's ever been
the case, reaching as far back as erc-networks.el's introduction to
the old CVS repo, in 2006.  (Bug#66520)
2023-10-13 07:47:01 -07:00
F. Jason Park
52af0a5fb9 Add command to refill buffer in erc-fill-wrap-mode
* lisp/erc/erc-fill.el (erc-fill-function, erc-fill-wrap-mode):
Mention new command `erc-fill-wrap-refill-buffer' in doc string.
(erc-fill--wrap-rejigger-last-message): New internal variable.
(erc-fill--wrap-rejigger-region, erc-fill-wrap-refill-buffer): New
command and helper function for fixing alignment issues that arise,
for example, from adjusting pixel-display widths of buffer text during
a session.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--simulate-refill):
New function for approximating `erc-fill-wrap-refill-buffer'.
(erc-fill-wrap--merge): Assert refilling is idempotent.  (Bug#60936)
2023-10-13 07:47:01 -07:00
F. Jason Park
f8af241192 Treat previous/next-line specially in erc-fill-wrap
* lisp/erc/erc-fill.el (erc-fill-wrap-visual-keys): Mention option
`erc-fill-wrap-force-screen-line-movement' in doc string.
(erc-fill-wrap-force-screen-line-movement): New option to suppress
logical-line movement with `previous-line' and `next-line' when
`erc-fill-wrap-mode' is enabled.
(erc-fill--wrap-move): Accept trailing args.
(erc-fill--wrap-previous-line, erc-fill--wrap-next-line): Use
`erc-fill--wrap-move', like all the other `fill-wrap' commands.
(Bug#60936)
2023-10-13 07:47:01 -07:00
F. Jason Park
5e2be1e0ba Swap hook positions of erc-fill and erc-match-message
* etc/ERC-NEWS: Fix new order of reserved modify-hook members.
* lisp/erc/erc-fill.el: Increase depth of `erc-fill' in both modify
hooks from 40 to 60.
* lisp/erc/erc-match.el (erc-match-mode, erc-match-enable,
erc-match-disable): Use general module setup function
`erc-match--setup' for buffer-local modifications instead of calling
`erc-match--modify-invisibility-spec' directly.  Add and remove new
post-modify hook `erc-match--on-insert-post'.
(erc-hide-fools): Use `erc--msg-props' for communicating to
post-processing step for applying invisible props instead of doing so
immediately.
(erc-match--on-insert-post): New function to apply module-specific
`invisible' props.  Will likely be replaced by a general service to do
the same, perhaps provided by a future "erc-ignore"-like module.
(erc-match--modify-invisibility-spec, erc-match--setup): Rename former
to latter and only operate on current buffer.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-fools-invisible,
erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-right-invisible-fill-wrap,
erc-scenarios-match--stamp-both-invisible-fill-static): Update
expected order of ERC-owned `invisible' prop members `match-fools' and
`timestamp'.
* test/lisp/erc/erc-tests.el (erc--essential-hook-ordering): Swap
expected order of `erc-fill' and `erc-add-timestamp' in both hooks.
(Bug#64301)
2023-10-13 07:47:01 -07:00
F. Jason Park
c68dc7786f Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled.  Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string.  Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper.  Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence.  Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil.  Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled.  Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage.  Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages.  Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer.  Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session.  Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action):  Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative.  Bind and
initialize `erc--msg-props' for use by all hooks.  Respect
`erc--msg-prop-overrides' when non-nil.  Don't add `erc-command'
property.  Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks.  Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space.  Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message.  In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message.  Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-10-13 07:47:01 -07:00
F. Jason Park
019baf2859 Remove newline from erc-fill regexp
* lisp/erc/erc-fill.el (erc-fill): Remove newline from character
alternative in pattern for skipping past blank and whitespace-only
lines.  It seems that as of e61a0398 "regex.c: Consolidate the two
analysis functions", Emacs no longer sees a newline-dollar sequence as
matching an empty line.  Also lose `save-match-data', which doesn't
appear to serve any purpose here.
2023-10-02 17:21:26 -07:00
F. Jason Park
98af493e0f Add line-wise movement commands for erc-fill-wrap
* lisp/erc/erc-fill.el (erc-fill-line-spacing): Revise doc string.
(erc-fill--wrap-escape-hidden-speaker): New helper function to move
point to beginning of visible text.
(erc-fill--wrap-beginning-of-line): Factor out adjustment for hidden
speakers.
(erc-fill--wrap-previous-line, erc-fill--wrap-next-line): Add commands
for moving to previous and next line in a manner consistent with the
value of `erc-fill--wrap-visual-keys'.
(erc-fill-wrap-mode-map): Add remap bindings for `next-line' and
`previous-line'.
(erc-fill-wrap-mode): Revise doc string.
(erc-fill-wrap-nudge): Fix vertical anchoring so that point's line
remains steadier throughout the adjustment.  (Bug#60936)
2023-08-15 17:13:52 -07:00
F. Jason Park
8623159b4a Fix CTCP ACTION regression in erc-fill-wrap
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Return
nil when current message is a CTCP ACTION.  This fixes a regression
introduced by 63d8b2a59a "Make erc-fill-wrap work with left-sided
stamps".
* test/lisp/erc/erc-fill-tests.el: (erc-fill-wrap--merge-action):
New test.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: New
test data file.  (Bug#60936)
2023-07-28 16:34:31 -07:00
F. Jason Park
af547c4bbe Improve ERC's internal invisibility API
* etc/ERC-NEWS: Mention that line endings have moved from the end to
the beginning of hidden messages.
* lisp/erc/erc-fill.el (erc-fill--wrap-ensure-dependencies): Warn when
users have `erc-legacy-invisible-bounds-p' enabled, and force it to
its default value of nil in the current buffer.
(erc-fill-wrap-mode, erc-fill-wrap-enable): Move business involving
compat variable for enabling legacy hidden-message behavior to helper.
* lisp/erc/erc-match.el (erc-match--hide-fools-offset-bounds): Move
internal variable from to main library file and rename to
`erc-legacy-invisible-bounds-p'.  Also make obsolete and flip
semantics so a non-nil value enables the traditional behavior.
(erc-match--hide-message): Move to main library file and rename to
`erc--hide-message'.  Add a property-value parameter instead of
hard-coding to `erc-match'.  Also, condition behavior on renamed
compatibility flag `erc-legacy-invisible-bounds-p'.
(erc-hide-fools): Call `erc--hide-message' with own value for
`invisible' property specifically for fools.  That is, use
`match-fools' rather than `erc-match' or `erc-match-fools' to save
room when visually inspecting.  This retains the module name as a
prefix to hopefully minimize collisions with invisibility spec members
owned by non-ERC minor modes.  The `timestamp' spec member owned by
erc-stamp likewise lacks a namespace prefix, but its feature/group
affiliation is self-evident.
(erc-match--modify-invisibility-spec): Use toggle command
non-interactively for adding and removing invisibility spec member.
(erc-match-toggle-hidden-fools): Add explicit override argument and
defer to general helper for actually modifying spec.
(erc-match--toggle-hidden): New helper for toggling invisibility
spec.
* lisp/erc/erc.el (erc--merge-prop): If new value is a list, prepend
onto existing.  Add note about possible space optimization.
(erc-legacy-invisible-bounds-p): New obsolete compat variable to
enable traditional pre-5.6 invisibility interval on hidden messages.
Replaces `erc-match--hide-fools-offset-bounds-p' but has an inverted
meaning.  The new default value of nil means invisibility covers a
shifted interval consisting of the message body plus the line ending
immediately preceding it.
(erc--hide-message): New function, formerly `erc-match--hide-message'
from erc-match.el introduced in ERC 5.6.
* test/lisp/erc/erc-scenarios-match.el:
(erc-scenarios-match--invisible-stamp): Fix comment and use API
function in interactive convenience setup.
(erc-scenarios-match--find-bol): New test helper.
(erc-scenarios-match--find-eol): Fix bug affecting interactive use.
(erc-scenarios-match--stamp-left-fools-invisible,
erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-right-invisible-fill-wrap,
erc-scenarios-match--stamp-both-invisible-fill-static): Update
`invisible' property from `erc-match' to `match-fools'.
(erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-both-invisible-fill-static): Move test
body to function of same name for use in multiple cases.
(erc-scenarios-match--stamp-right-fools-invisible--nooffset,
erc-scenarios-match--stamp-both-invisible-fill-static--nooffset): New
test variants asserting proper hiding with old pre-5.6 invisibility
interval.
* test/lisp/erc/erc-tests.el (erc-tests--equal-including-properties):
Relocate macro higher in same file.
(erc--merge-prop): New test.  (Bug#64301)
2023-07-22 07:33:07 -07:00
F. Jason Park
63d8b2a59a Make erc-fill-wrap work with left-sided stamps
* etc/ERC-NEWS: Remove all mention of option `erc-timestamp-align-to'
supporting a value of `margin', which has been abandoned.  Do mention
leading white space before stamps now having stamp-related properties.
* lisp/erc/erc-backend.el (erc--reveal-prompt, erc--conceal-prompt):
New generic functions with default implementations factored out from
`erc--unhide-prompt' and `erc--hide-prompt'.
(erc--prompt-hidden-p): New internal predicate function.
(erc--unhide-prompt): Defer to `erc--reveal-prompt', and set
`erc-prompt' text property to t.
(erc--hide-prompt): Defer to `erc--conceal-prompt', and set
`erc-prompt' text property to `hidden'.
* lisp/erc/erc-compat.el (erc-compat--29-browse-url-irc): Don't
use `function-equal'.
* lisp/erc/erc-fill.el (erc-fill-wrap-margin-width,
erc-fill-wrap-margin-side): New options to control side and initial
width of `fill-wrap' margin.
(erc-fill--wrap-beginning-of-line): Fix bug involving non-string
valued `display' props.
(erc-fill-wrap-toggle-truncate-lines): New command to re-enable
`visual-line-mode' when toggling off `truncate-lines'.
(erc-fill-wrap-mode-map): Remap `toggle-truncate-lines' to
`erc-fill-wrap-toggle-truncate-lines'.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Update doc string, persist a few local vars, and conditionally set
`erc-stamp--margin-left-p'.  When deactivating, disable
`visual-line-mode' first.
(erc-fill--wrap-continued-message-p): Use `erc-speaker' instead of
heuristics when comparing nicks between consecutive messages.
(erc-fill-wrap-nudge): Update doc string and account for left-sided
stamps.
(erc-timestamp-offset): Add comment regarding conditional guard based
on function-valued option.
* lisp/erc/erc-stamp.el (erc-timestamp-use-align-to): Remove value
variant `margin', which was originally intended to be new in ERC 5.6.
This functionality was all but useless without the internal minor mode
`erc-stamp--display-margin-mode' active.
(erc-stamp-right-margin-width): Remove unused option new in 5.6.
(erc-stamp--display-margin-force): Remove unused function.
(erc-stamp--margin-width, erc-stamp--margin-left-p): New internal
variables.
(erc-stamp--init-margins-on-connect): New function for initializing
mode-managed margin after connecting.
(erc-stamp--adjust-right-margin, erc-stamp--adjust-margin): Rename
function to latter and accommodate left-hand stamps.
(erc-stamp--inherited-props): Move definition higher up in same file.
(erc-stamp--display-margin-mode): Update function name, and adjust
setup and teardown to accommodate left-handed stamps.  Don't add
advice around `erc-insert-timestamp-function'.
(erc-stamp--last-prompt, erc-stamp--display-prompt-in-left-margin):
New function and helper var to convert a normal inserted prompt so
that it appears in the left margin.
(erc-stamp--refresh-left-margin-prompt): Helper for other modules to
quickly refresh prompt outside of insert hooks.
(erc--reveal-prompt, erc--conceal-prompt): New implementations for
when `erc-stamp--display-margin-mode' is active.
(erc-insert-timestamp-left): Convert to generic function and provide
implementation for `erc-stamp--display-margin-mode'.
(erc-stamp--omit-properties-on-folded-lines): New variable, an escape
hatch for propertizing white space before right-side stamps folded
over onto another line.
(erc-insert-timestamp-right): Don't expect `erc-timestamp-align-to' to
ever be the symbol `margin'.  Move handling for that case to one
contingent on the internal minor mode `erc-stamp--display-margin-mode'
being active.  Add text properties preceding stamps that occupy a line
by their lonesome.  See related news entry for rationale.  This is
arguably a breaking change.
* lisp/erc/erc.el (erc--refresh-prompt-hook): New hook variable for
modules to adjust prompt properties whenever it's refreshed.
(erc--refresh-prompt): Fix bug in which user-defined prompt functions
failed to hide when quitting in server buffers.  Run new hook
`erc--refresh-prompt-hook'.
(erc-display-prompt): Add comment noting that the text property
`erc-prompt' now actually matters: it's t while a session is running
and `hidden' when disconnected.
* test/lisp/erc/erc-fill-tests.el (erc-fill--left-hand-stamps): New
test.
* test/lisp/erc/erc-stamp-tests.el
(erc-stamp-tests--use-align-to--nil,
erc-stamp-tests--use-align-to--t): New functions forged from old test
bodies to allow optionally asserting pre-5.6 behavior regarding
leading white space on right-hand stamps that exist on their own line.
(erc-timestamp-use-align-to--nil, erc-timestamp-use-align-to--t):
Parameterize with compatibility flag.
(erc-timestamp-use-align-to--margin,
erc-stamp--display-margin-mode--right): Rename test to latter.
* test/lisp/erc/erc-tests.el (erc-hide-prompt): Add some assertions
for new possible value of `erc-prompt' text property.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: New test
data file.  (Bug#60936)
2023-07-22 07:33:07 -07:00
F. Jason Park
6a96b86268 Add text props for CTCP messages and speakers in ERC
* etc/ERC-NEWS: Mention reduction in boldness of `erc-notice-face' and
`erc-action-face'.
* lisp/erc/erc-fill.el (erc-fill-spaced-commands,
erc-fill--spaced-commands): Rename former to latter and demote from
user option to internal variable.
(erc-fill): Change `erc-fill-spaced-commands' to
`erc-fill--spaced-commands'.
(erc-fill--wrap-continued-message-p): Use more precise `erc-ctcp' text
prop instead of face-based heuristic to detect CTCP ACTION message.
(erc-fill--wrap-action-dedent-p): New variable to toggle whether
`line-prefix' is applied to CTCP ACTION messages.  This exists less
to accommodate user preferences and more for third-party code that
assumes the first non-whitespace span in every message is a nick.
(erc-fill-wrap): Look for `erc-speaker' property before falling back
on word at point.  Use `erc-ctcp' to detect CTCP ACTION messages.
* lisp/erc/erc.el (erc-notice-face, erc-action-face): Prefer weight of
`semi-bold' when available so that buttonization is at least somewhat
perceptible in notices and action messages.
(erc-send-action): Ensure nickname passed to `erc-display-message' has
`erc-speaker' property and `erc-ctcp' ACTION property.
(erc--own-property-names): Add `erc-speaker' to lineup.
(erc-format-privmessage): Don't clobber `erc-nick-prefix-face'.  That
is, retain face applied to a leading stretch of characters in the
`nick' parameter, but continue to discard trailing faces.
(erc-format-my-nick, erc-ctcp-query-ACTION): Add new text property
`erc-speaker' to the nick portion of the formatted speaker label.  Do
this to assist modules, like `button' and `match', that currently
re-parse speakers in inserted messages.
(erc-process-ctcp-query): Add `erc-ctcp' property to entire message
before insertion hooks see it.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--compare): Warn
about certain unreliable comparisons if generalizing helper for use by
other modules.
* test/lisp/erc/erc-tests.el (erc-tests--equal-including-properties):
New helper compat macro.
(erc-format-privmessage): New test.  (Bug#64301)
2023-07-13 18:45:31 -07:00
F. Jason Park
d880a08f95 Cement ordering of essential hook members in ERC
* etc/ERC-NEWS: Add new section explaining the pinning of certain hook
members owned by built-in modules to fixed depths.
* lisp/erc/erc-button.el (erc-button-mode, erc-button-enable): Change
hook depth for `erc-button-add-buttons' from 90 to 30.
* lisp/erc/erc-fill.el (erc-fill-mode, erc-fill-enable): Change hook
depth for `erc-fill' from 0 to 40.
* lisp/erc/erc-match.el (erc-match-mode, erc-match-enable): Change
hook depth for `erc-match-message' from 90 to 60.
* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-enable): Change
hook depth for `erc-add-timestamp' from 90 to 50.
* test/lisp/erc/erc-tests.el
(erc-tests--assert-printed-in-subprocess): Add fixture for testing a
form printed from a subprocess.
(erc--find-mode, erc--essential-hook-ordering): Use helper in existing
and new tests, respectively.  (Bug#60936)
2023-06-11 19:55:11 -07:00
F. Jason Park
1c3f6aa98f Measure stamps pixel-wise with erc-fill-wrap
* lisp/erc/erc-fill.el (erc-fill-wrap-mode, erc-fill-wrap-enable):
Change "how" for advice applied to `erc-stamp--insert-date-function'
from `:filter-args' to `:after'.
(erc-fill--wrap-stamp-insert-prefixed-date): Change signature to
conform to `:after'-style advice.  Use `buffer-text-pixel-size' when
desired and available for generating display spec.
(erc-fill-wrap): Remove confusing comment.  Don't apply text props to
newlines because there's no obvious use case for inheriting these.
* lisp/erc/erc.el (erc-send-action, erc-display-msg): Add
`erc-command' property (as "PRIVMSG") to inserted message, sans
newline, so that all inserted messages in an ERC buffer contain this
property.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update data.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
(Bug#60936)
2023-06-11 19:52:00 -07:00
Mattias Engdegård
0b722a74a5 * lisp/erc/erc-fill.el (erc-fill-spaced-commands): Fix typing errors
The type (set integer symbol) matches a list of at most one integer
and one symbol, not multiple distinct symbols.
2023-05-18 09:49:53 +02:00
F. Jason Park
75a412d78b Optionally add spacing between ERC messages
* etc/ERC-NEWS: Mention option `erc-fill-line-spacing'.
* lisp/erc/erc-fill.el (erc-fill-line-spacing,
erc-fill-spaced-commands): Add options to allow for extra spacing
between messages.
(erc-fill--function): Internal var allowing modules to override user
option `erc-fill-function'.
(erc-fill): Add extra line-spacing on certain types of messages.
Prefer `erc-fill--function', when set, over `erc-fill-function'.
(erc-fill--make-module-dependency-msg,
erc-fill--wrap-ensure-dependencies): Rename former to latter and make
more useful.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Refactor.
(erc-fill--wrap-fix): Remove unused function.
(erc-fill-wrap-nudge): Remove reference to nonexistent function in doc
string.
* test/lisp/erc/erc-fill-tests.el: (erc-fill-tests--graphic-dir): New
variable.
(erc-fill-tests--compare): Look in `erc-fill-tests--graphic-dir' for
graphical snapshots ignored by Git.
(erc-fill-line-spacing): New test.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: New
file.  (Bug#60936)
2023-05-13 07:05:22 -07:00
F. Jason Park
2e18ba6302 Simplify erc-button movement commands
* etc/ERC-NEWS: Mention TAB being bound to new command `erc-tab' and
`erc-previous-button' now stopping at the start of buttons.
* lisp/erc/erc-button.el (erc-button-mode, erc-button-enable,
erc-button-disable): Add and remove `erc-button-next' to
`erc--tab-functions' hook, which is tantamount to binding the command
in the read-only area of an ERC buffer.
(erc-button-next-function): Deprecate and remove from client code path
because this module doesn't concern itself with prompt input and thus
no longer needs to conform to the `completion-at-point-functions'
interface.
(erc-button--prev-next-predicate-functions): New variable, a hook to
determine whether to continue searching for a button.  Other modules
should utilize this as needed.
(erc-button--end-of-button-p): Add function to serve as default value
for `erc-button--continue-predicate'.
(erc--button-next): Add generalized button-movement function.
(erc-button-next, erc-button-previous): Make `erc-button-previous'
behave more predictably by having it land at the beginning of buttons.
And remove roundabout appeal to HOF in `erc-button-next'.
(erc-button-previous-of-nick): New command to jump to previous
appearance of nick at point.
* lisp/erc/erc-fill.el (erc-fill-wrap, erc-fill-wrap-enable,
erc-fill-wrap-disable): Add and remove merge-related hookee from
`erc-button--prev-next-predicate-functions'.
(erc-fill--wrap-merged-button-p): New function to detect redundant
speakers.
* lisp/erc/erc.el (erc-complete-functions): Quote TAB in doc string.
(erc-mode-map): Bind `erc-tab' to TAB.
(erc--tab-functions, erc-tab): Add new command and hook to serve as
unified dispatch for TAB-related operations.  It calls `c-a-p' in the
input area and defers to module code in the read-only message area.
* test/lisp/erc/erc-button-tests.el: New file.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--wrap-populate): Run
finalizer for transient keymap timer.
* test/lisp/erc/erc-tests.el
(erc-button--display-error-notice-with-keys): Move to new dedicated
test file for erc-button and fix expected behavior of
`erc-button-previous'.  (Bug#62834)
2023-05-05 17:18:01 -07:00
F. Jason Park
2641dfd4b4 Add erc-timestamp property to invisible messages
* lisp/erc/erc-fill.el (erc-fill--wrap-beginning-of-line): Pretend
nicks with an empty string as a `display' prop are `invisible-p' and
break out of hidden "merged" nicks after moving.  (Bug#60936.)
* lisp/erc/erc-match.el (erc-hide-fools): Add comment.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Always add
`erc-timestamp' and `cursor-sensor-functions' properties but respect
tradition and don't actually stamp any invisible messages.
2023-05-05 17:18:01 -07:00
F. Jason Park
aa56253407 Compare case-folded nicks with erc-fill-wrap-merge
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Downcase
both current and previous speaker when comparing nicks.
* test/lisp/erc/erc-fill-tests.el (erc-fill-wrap--merge): Add
title-case nick to test.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
snapshot.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
snapshot.  (Bug#60936)
2023-04-30 18:28:54 -07:00
F. Jason Park
4b56739547 Add erc-fill style based on visual-line-mode
* lisp/erc/erc-fill.el (erc-fill-function): Add new value
`erc-fill-wrap'.
(erc-fill-static-center): Extend meaning of option to also affect
`erc-wrap-mode'.
(erc-fill--wrap-value, erc-fill--wrap-visual-keys): New variables to
support new local module.
(erc-fill-wrap-visual-keys): New option to control how and where
`visual-line-mode' keys are active.
(erc-fill-wrap-merge): Add option for omitting a speaker's name if
they just now spoke.  Enabled by default.
(erc-fill--wrap-move): New helper function for fill-wrap movement
commands.
(erc-fill--wrap-kill-line, erc-fill--wrap-beginning-of-line,
erc-fill--wrap-end-of-line): New movement commands.
(erc-fill-wrap-cycle-visual-movement): New command to cycle local
copy of `erc-fill-wrap-visual-keys'.
(erc-fill-wrap-mode-map): New keymap based on `visual-line-mode-map'.
(erc-fill--make-module-dependency-msg): Helper for
`erc-fill-wrap-enable'.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable): New
local module.
(erc-fill--wrap-length-function): Internal interface in the form of a
function variable for other modules to control the fill-wrap overhang.
(erc-fill--wrap-last-msg, erc-fill--wrap-max-lull,
erc-fill--wrap-continued-message-p): Add items to support hiding of
redundant speaker names in consecutive messages.
(erc-fill--wrap-stamp-insert-prefixed-date): New function to add
`line-prefix' property to inserted date stamp.
(erc-fill-wrap): New function implementing the
`erc-fill-function' (behavioral) interface.
(erc-fill--wrap-fix): New, possibly temporary function for other
modules to fix misalignment caused by fill-wrap.
(erc-fill-wrap-nudge, erc-fill--wrap-nudge): New command and helper
for growing and shrinking visual fill prefix.
* test/lisp/erc/erc-fill-tests.el: New file.  (Bug#60936.)
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: New file.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: New file.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: New file.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: New file.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: New file.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: New file.
2023-04-08 14:23:51 -07:00
F. Jason Park
0c3a069ae0 Convert erc-fill minor mode into a proper module
* lisp/erc/erc-fill.el (erc-fill-mode, erc-fill-enable,
erc-fill-disable): Use API to create these.
(erc-fill-static): Save restriction instead of caller's match
data.  (Bug#60936.)
2023-04-08 14:23:51 -07:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Amin Bandali
f4bfe7834a
ERC: Add new comaintainer, F. Jason Park
* lisp/erc/erc*.el: Add J.P. as my comaintainer to headers.
2022-01-24 10:59:05 -05:00