bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21201: 25.0.50; (buffer-modified-p) errors inside cl-letf


From: Artur Malabarba
Subject: bug#21201: 25.0.50; (buffer-modified-p) errors inside cl-letf
Date: Thu, 6 Aug 2015 22:44:52 +0100

2015-08-06 21:07 GMT+01:00 Nicolas Richard <youngfrog@members.fsf.org>:
> Artur Malabarba <bruce.connor.am@gmail.com> writes:
>
>> From emacs -Q, run the following:
>>
>> (cl-letf (((buffer-modified-p)))
>>   (insert "ookok"))
>>
>> You'll get an error from trying to set a nil buffer.
>
> Here is a fix:
> --8<---------------cut here---------------start------------->8---
> modified   lisp/emacs-lisp/cl-lib.el
> @@ -634,8 +634,10 @@ If ALIST is non-nil, the new pairs are prepended to it."
>  ;; Some more Emacs-related place types.
>  (gv-define-simple-setter buffer-file-name set-visited-file-name t)
>  (gv-define-setter buffer-modified-p (flag &optional buf)
> -  `(with-current-buffer ,buf
> -     (set-buffer-modified-p ,flag)))
> +  (if buf
> +      `(with-current-buffer ,buf
> +         (set-buffer-modified-p ,flag))
> +    `(set-buffer-modified-p ,flag)))

Don't know if it's possible, but shouldn't it try to ensure that it's
in the same buffer as before?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]