* bug#16111: (erc-current-logfile buf) behavior differs to with-current-buffer buf
@ 2013-12-11 13:41 Ivan Shmakov
2015-12-27 21:01 ` Lars Ingebrigtsen
2018-04-14 19:19 ` Lars Ingebrigtsen
0 siblings, 2 replies; 3+ messages in thread
From: Ivan Shmakov @ 2013-12-11 13:41 UTC (permalink / raw)
To: 16111
Package: emacs
Severity: minor
My guess is that the results of (erc-current-logfile buffer) and
(with-current-buffer buffer (erc-current-logfile)) were intended
to be the same. However, as the function references the session
buffer-local variables (erc-session-server, erc-session-port,
and, indirectly, erc-server-current-nick and erc-server-process)
/without/ switching to the buffer given, the results are
somewhat undefined.
(defun erc-current-logfile (&optional buffer)
"Return the logfile to use for BUFFER.
If BUFFER is nil, the value of `current-buffer' is used.
This is determined by `erc-generate-log-file-name-function'.
The result is converted to lowercase, as IRC is case-insensitive"
(unless buffer (setq buffer (current-buffer)))
(let ((target (or (buffer-name buffer) (erc-default-target)))
(nick (erc-current-nick))
(server erc-session-server)
(port erc-session-port))
…))
(There, it may make sense to enclose the most part of the code
within a with-current-buffer form.)
This may show no symptoms as long as erc-save-buffer-in-logs is
called in either of the buffers belonging to the same session,
but I’m in doubt that erc-log-save-all-buffers (which may run as
part of kill-emacs-hook) will behave sensible in general.
--
FSF associate member #7257
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#16111: (erc-current-logfile buf) behavior differs to with-current-buffer buf
2013-12-11 13:41 bug#16111: (erc-current-logfile buf) behavior differs to with-current-buffer buf Ivan Shmakov
@ 2015-12-27 21:01 ` Lars Ingebrigtsen
2018-04-14 19:19 ` Lars Ingebrigtsen
1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-27 21:01 UTC (permalink / raw)
To: Ivan Shmakov; +Cc: 16111
Ivan Shmakov <ivan@siamics.net> writes:
> Package: emacs
> Severity: minor
>
> My guess is that the results of (erc-current-logfile buffer) and
> (with-current-buffer buffer (erc-current-logfile)) were intended
> to be the same. However, as the function references the session
> buffer-local variables (erc-session-server, erc-session-port,
> and, indirectly, erc-server-current-nick and erc-server-process)
> /without/ switching to the buffer given, the results are
> somewhat undefined.
>
> (defun erc-current-logfile (&optional buffer)
> "Return the logfile to use for BUFFER.
> If BUFFER is nil, the value of `current-buffer' is used.
> This is determined by `erc-generate-log-file-name-function'.
> The result is converted to lowercase, as IRC is case-insensitive"
> (unless buffer (setq buffer (current-buffer)))
> (let ((target (or (buffer-name buffer) (erc-default-target)))
> (nick (erc-current-nick))
> (server erc-session-server)
> (port erc-session-port))
> …))
>
> (There, it may make sense to enclose the most part of the code
> within a with-current-buffer form.)
Do you have a patch for this?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#16111: (erc-current-logfile buf) behavior differs to with-current-buffer buf
2013-12-11 13:41 bug#16111: (erc-current-logfile buf) behavior differs to with-current-buffer buf Ivan Shmakov
2015-12-27 21:01 ` Lars Ingebrigtsen
@ 2018-04-14 19:19 ` Lars Ingebrigtsen
1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-14 19:19 UTC (permalink / raw)
To: Ivan Shmakov; +Cc: 16111
Ivan Shmakov <ivan@siamics.net> writes:
> (There, it may make sense to enclose the most part of the code
> within a with-current-buffer form.)
I've now done this in Emacs 27.1.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-14 19:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-11 13:41 bug#16111: (erc-current-logfile buf) behavior differs to with-current-buffer buf Ivan Shmakov
2015-12-27 21:01 ` Lars Ingebrigtsen
2018-04-14 19:19 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.