[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master b8062be 3/5: Remove some compat code from eudc-bob.el
From: |
Lars Ingebrigtsen |
Subject: |
Re: master b8062be 3/5: Remove some compat code from eudc-bob.el |
Date: |
Thu, 13 Aug 2020 10:08:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
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
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Lars Ingebrigtsen, 2020/08/12
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Stefan Monnier, 2020/08/12
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el,
Lars Ingebrigtsen <=
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Eli Zaretskii, 2020/08/13
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Stefan Monnier, 2020/08/13
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Eli Zaretskii, 2020/08/13
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Stefan Monnier, 2020/08/13
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Eli Zaretskii, 2020/08/13
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Stefan Monnier, 2020/08/13
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Eli Zaretskii, 2020/08/13
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Stefan Monnier, 2020/08/13
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Eli Zaretskii, 2020/08/13
- Re: master b8062be 3/5: Remove some compat code from eudc-bob.el, Stefan Monnier, 2020/08/13