GNU bug report logs -
#21201
25.0.50; (buffer-modified-p) errors inside cl-letf
Previous Next
Reported by: bruce.connor.am <at> gmail.com
Date: Thu, 6 Aug 2015 19:48:01 UTC
Severity: minor
Tags: fixed, patch
Merged with 29371
Found in versions 25.0.50, 26.0.50
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Artur Malabarba <bruce.connor.am <at> 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)))
(gv-define-simple-setter buffer-name rename-buffer t)
(gv-define-setter buffer-string (store)
`(insert (prog1 ,store (erase-buffer))))
--8<---------------cut here---------------end--------------->8---
--
Nico
This bug report was last modified 6 years and 271 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.