unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16804: 24.3.50; [PATCH] fix with-silent-modifications
@ 2014-02-19  0:34 Leo Liu
  2014-02-19  4:39 ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: Leo Liu @ 2014-02-19  0:34 UTC (permalink / raw)
  To: 16804

I was confused by why an eldoc-documentation-function always gets a nil
buffer-file-name in a js file in js2-mode. It turns out js2 wraps its
parsing routine in with-silent-modifications, thus all timers triggered
while parsing gets the nil value for buffer-file-name.

Any comments on the following fix? Thanks.


=== modified file 'lisp/subr.el'
--- lisp/subr.el	2014-02-12 19:40:35 +0000
+++ lisp/subr.el	2014-02-19 00:18:31 +0000
@@ -3172,21 +3172,24 @@
 Typically used around modifications of text-properties which do
 not really affect the buffer's content."
   (declare (debug t) (indent 0))
-  (let ((modified (make-symbol "modified")))
+  (let ((modified (make-symbol "modified"))
+	(mtime (make-symbol "mtime")))
     `(let* ((,modified (buffer-modified-p))
             (buffer-undo-list t)
             (inhibit-read-only t)
             (inhibit-modification-hooks t)
             deactivate-mark
-            ;; Avoid setting and removing file locks and checking
-            ;; buffer's uptodate-ness w.r.t the underlying file.
-            buffer-file-name
-            buffer-file-truename)
+            ;; Avoid checking buffer's uptodate-ness w.r.t the
+            ;; underlying file.
+            (,mtime (visited-file-modtime))
+	    ;; Avoid setting and removing file locks
+            (create-lockfiles nil))
        (unwind-protect
-           (progn
-             ,@body)
+           (progn ,@body)
          (unless ,modified
-           (restore-buffer-modified-p nil))))))
+           (restore-buffer-modified-p nil))
+	 (when (consp ,mtime)
+	   (set-visited-file-modtime ,mtime))))))
 
 (defmacro with-output-to-string (&rest body)
   "Execute BODY, return the text it sent to `standard-output', as a string."






^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-02-24  3:10 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-19  0:34 bug#16804: 24.3.50; [PATCH] fix with-silent-modifications Leo Liu
2014-02-19  4:39 ` Stefan Monnier
2014-02-19  6:10   ` Leo Liu
2014-02-19 14:28     ` Stefan Monnier
2014-02-19 15:35       ` Leo Liu
2014-02-19 18:30         ` Stefan Monnier
2014-02-20  0:33           ` Leo Liu
2014-02-20  4:57             ` Stefan Monnier
2014-02-20  5:57               ` Leo Liu
2014-02-20 14:01                 ` Stefan Monnier
2014-02-20 14:38                   ` Leo Liu
2014-02-20 17:14                     ` Stefan Monnier
2014-02-21  0:29                       ` Leo Liu
2016-02-24  3:10                         ` Lars Ingebrigtsen

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).