Subject: 28.0.90; duplicate checks in erc--switch-to-buffer

From: Guy Gastineau <[email-masked]>
Date: Fri, 28 Jan 2022 19:10:00 -0500

erc--switch-to-buffer has the following code at the end:

             ...
             (when buf
      (erc--buffer-p buf (lambda () t) proc)
      (with-current-buffer buf
(and (derived-mode-p 'erc-mode)
     (or (null proc)
 (eq proc erc-server-process)))))
             ...

but erc--buffer-p is already doing the checks with buf as current
buffer:

(defun erc--buffer-p (buf predicate proc)
  (with-current-buffer buf
    (and (derived-mode-p 'erc-mode)
(or (not proc)
    (eq proc erc-server-process))
(funcall predicate)
buf)))

The entire sexp starting with `with-current-buffer ...` can be removed
without changing the semantics of erc--switch-to-buffer.

In GNU Emacs 28.0.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30,
cairo version 1.17.4)
 of 2021-12-14 built on medusa
Repository revision: f88c1d222f17d3483bf6f387dc41be4366a047ab
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-sound=alsa --with-modules --without-libotf --without-m17n-flt
 --without-gconf --without-gsettings --with-native-compilation
 --with-x-toolkit=gtk3 --without-xaw3d --with-sound=no --without-gpm
 --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection'
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG JSON LCMS2
LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  shell-dirtrack-mode: t
  global-ligature-mode: t
  ligature-mode: t
  paredit-mode: t
  rainbow-delimiters-mode: t
  global-company-mode: t
  company-mode: t
  counsel-projectile-mode: t
  counsel-mode: t
  projectile-mode: t
  save-place-mode: t
  electric-pair-mode: t
  recentf-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/guy/.emacs.d/elpa/transient-20211129.1146/transient hides
/usr/share/emacs/28.0.90/lisp/transient

Features:
(shadow sort mail-extr emacsbug sendmail ivy-erc debug backtrace
cl-print two-column misearch multi-isearch apropos erc-list erc-menu
erc-join erc-ring erc-networks erc-pcomplete erc-track erc-match
erc-button erc-fill erc-stamp erc-netsplit erc-goodies erc erc-backend
erc-loaddefs eieio-opt speedbar ezimage dframe shortdoc tabify gnutls
network-stream nsm rcirc magit-patch mule-util vc-mtn vc-hg vc-bzr
vc-src vc-sccs vc-svn vc-cvs vc-rcs vc bug-reference magit-extras
magit-bookmark magit-submodule magit-obsolete magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func magit-diff smerge-mode diff git-commit log-edit message rmc
rfc822 mml mml-sec epa derived epg rfc6068 epg-config mm-decode
mm-bodies mm-encode mailabbrev gmm-utils mailheader pcvs-util add-log
magit-core magit-autorevert autorevert filenotify magit-margin
magit-transient magit-process with-editor server magit-mode transient
magit-git magit-section magit-utils crm mhtml-mode css-mode smie eww
url-queue shr kinsoku svg xml puny mm-url gnus nnheader gnus-util rmail
rmail-loaddefs mail-utils js cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs sgml-mode facemenu dom ffap
purescript-indentation purescript-mode purescript-font-lock
purescript-string purescript-sort-imports purescript-align-imports
haskell-doc inf-haskell haskell-decl-scan imenu haskell
haskell-completions haskell-load haskell-commands highlight-uses-mode
haskell-modules haskell-sandbox haskell-navigate-imports haskell-repl
haskell-svg haskell-collapse hideshow haskell-debug
haskell-interactive-mode haskell-presentation-mode haskell-compile
haskell-hoogle haskell-process haskell-session vc-git diff-mode
vc-dispatcher haskell-mode haskell-cabal haskell-utils haskell-font-lock
haskell-indentation haskell-string haskell-sort-imports haskell-lexeme
haskell-align-imports haskell-complete-module haskell-ghc-support
noutline outline flymake-proc flymake dabbrev haskell-customize flycheck
dash vterm bookmark pp tramp tramp-loaddefs trampver tramp-integration
files-x tramp-compat parse-time iso8601 time-date ls-lisp format-spec
face-remap term shell pcomplete ehelp find-func vterm-module term/xterm
xterm auto-complete popup ligature disp-table paredit rainbow-delimiters
page-break-lines display-line-numbers linum whitespace time
company-oddmuse company-keywords company-etags etags fileloop generator
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb company pcase init exercism interactive
counsel-projectile-ext counsel-projectile counsel xdg advice xref
project dired dired-loaddefs swiper ivy delsel ivy-faces ivy-overlay
colir color comp comp-cstr warnings projectile lisp-mnt mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr grep compile
text-property-search comint ansi-color ibuf-ext ibuffer ibuffer-loaddefs
thingatpt saveplace elec-pair dashboard dashboard-widgets recentf
tree-widget wid-edit all-the-icons all-the-icons-faces data-material
data-weathericons data-octicons data-fileicons data-faicons
data-alltheicons modus-vivendi-theme modus-operandi-theme modus-themes
cl-extra use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core finder-inf geiser-impl help-fns radix-tree help-mode
geiser-custom geiser-base ring proof-site proof-autoloads edmacro kmacro
rx info package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc
paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting font-render-setting cairo move-toolbar gtk x-toolkit x
multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 1092982 183001)
 (symbols 48 44207 0)
 (strings 32 236718 12429)
 (string-bytes 1 7415412)
 (vectors 16 95829)
 (vector-slots 8 2143178 190013)
 (floats 8 798 606)
 (intervals 56 55744 5618)
 (buffers 992 35))