GNU bug report logs - #16111
(erc-current-logfile buf) behavior differs to with-current-buffer buf

Previous Next

Package: emacs;

Reported by: Ivan Shmakov <ivan <at> siamics.net>

Date: Wed, 11 Dec 2013 13:42:01 UTC

Severity: minor

Tags: fixed

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16111 in the body.
You can then email your comments to 16111 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16111; Package emacs. (Wed, 11 Dec 2013 13:42:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ivan Shmakov <ivan <at> siamics.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 11 Dec 2013 13:42:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ivan Shmakov <ivan <at> siamics.net>
To: submit <at> debbugs.gnu.org
Subject: (erc-current-logfile buf) behavior differs to with-current-buffer buf
Date: Wed, 11 Dec 2013 13:41:18 +0000
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16111; Package emacs. (Sun, 27 Dec 2015 21:02:01 GMT) Full text and rfc822 format available.

Message #8 received at 16111 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Ivan Shmakov <ivan <at> siamics.net>
Cc: 16111 <at> debbugs.gnu.org
Subject: Re: bug#16111: (erc-current-logfile buf) behavior differs to
 with-current-buffer buf
Date: Sun, 27 Dec 2015 22:01:20 +0100
Ivan Shmakov <ivan <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16111; Package emacs. (Sat, 14 Apr 2018 19:20:01 GMT) Full text and rfc822 format available.

Message #11 received at 16111 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Ivan Shmakov <ivan <at> siamics.net>
Cc: 16111 <at> debbugs.gnu.org
Subject: Re: bug#16111: (erc-current-logfile buf) behavior differs to
 with-current-buffer buf
Date: Sat, 14 Apr 2018 21:19:12 +0200
Ivan Shmakov <ivan <at> 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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 14 Apr 2018 19:20:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 16111 <at> debbugs.gnu.org and Ivan Shmakov <ivan <at> siamics.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 14 Apr 2018 19:20:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 13 May 2018 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 36 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.