From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: master b8062be 3/5: Remove some compat code from eudc-bob.el
Date: Thu, 13 Aug 2020 10:08:26 +0200 [thread overview]
Message-ID: <87mu2zhssl.fsf@gnus.org> (raw)
In-Reply-To: <jwvtux74tql.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 12 Aug 2020 14:15:15 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> This seems like "obviously wrong code" (setting the coding system and
>> then doing `set-buffer'), but I don't use eudc, so ... perhaps it really
>> wants to set the coding system in the original buffer?
>
> Indeed, and the setting of coding-system can be moved before the
> `save-excursion` after which you the byte-compiler will see the
> `save-excursion + set-buffer` and recommend to use `with-current-buffer`
> instead.
But I think that's not really what's intended... here's one of the
functions:
(defun eudc-bob-save-object ()
"Save the object data of the button at point."
(interactive)
(let ((data (eudc-bob-get-overlay-prop 'object-data))
(buffer (generate-new-buffer "*eudc-tmp*")))
(save-excursion
(set-buffer-file-coding-system 'binary)
(set-buffer buffer)
(set-buffer-multibyte nil)
(insert data)
(save-buffer))
(kill-buffer buffer)))
I think the intention here is to change the coding system in this new
temporary buffer (before saving), and not whatever buffer the caller of
the function was...
But I don't even know what eudc is, so. :-)
(And this should probably just be rewritten as a `with-temp-buffer'.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2020-08-13 8:08 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200812175454.4839.92908@vcs0.savannah.gnu.org>
[not found] ` <20200812175456.C5D122172E@vcs0.savannah.gnu.org>
2020-08-12 17:56 ` master b8062be 3/5: Remove some compat code from eudc-bob.el Lars Ingebrigtsen
2020-08-12 18:15 ` Stefan Monnier
2020-08-13 8:08 ` Lars Ingebrigtsen [this message]
2020-08-13 13:14 ` Eli Zaretskii
2020-08-13 13:58 ` Stefan Monnier
2020-08-13 14:14 ` Eli Zaretskii
2020-08-13 14:23 ` Stefan Monnier
2020-08-13 16:43 ` Eli Zaretskii
2020-08-13 17:43 ` Stefan Monnier
2020-08-13 18:25 ` Eli Zaretskii
2020-08-13 19:02 ` Stefan Monnier
2020-08-13 19:06 ` Eli Zaretskii
2020-08-13 19:54 ` Stefan Monnier
2020-08-14 6:05 ` Eli Zaretskii
2020-08-14 9:54 ` Lars Ingebrigtsen
2020-08-14 10:35 ` Eli Zaretskii
2020-08-14 11:03 ` Eli Zaretskii
2020-08-15 9:53 ` Lars Ingebrigtsen
2020-08-15 12:56 ` Stefan Monnier
2020-08-15 15:10 ` Eli Zaretskii
2020-08-16 11:17 ` Lars Ingebrigtsen
2020-08-16 14:41 ` Eli Zaretskii
2020-08-17 8:32 ` Lars Ingebrigtsen
2020-08-17 13:15 ` Stefan Monnier
2020-08-18 14:56 ` Lars Ingebrigtsen
2020-08-18 15:08 ` Eli Zaretskii
2020-08-18 17:02 ` Stefan Monnier
2020-08-19 10:20 ` Lars Ingebrigtsen
2020-08-17 14:17 ` Eli Zaretskii
2020-08-13 13:33 ` Stefan Monnier
2020-08-15 21:19 ` Stefan Monnier
2020-08-15 21:27 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mu2zhssl.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).