* Re: CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer [not found] <jed4sci6kb.fsf@sykes.suse.de> @ 2008-01-08 20:03 ` Alan Mackenzie 2008-01-08 20:14 ` Lennart Borgman (gmail) 2008-01-08 20:17 ` martin rudalics 2008-01-09 9:02 ` Alan Mackenzie 1 sibling, 2 replies; 10+ messages in thread From: Alan Mackenzie @ 2008-01-08 20:03 UTC (permalink / raw) To: Andreas Schwab; +Cc: bug-cc-mode, emacs-devel Hi, Andreas! On Tue, Jan 08, 2008 at 06:13:40PM +0100, Andreas Schwab wrote: > c-{beginning,end}-of-defun try to modify the buffer and thus trigger > ask-user-about-supersession-threat. To reproduce load a C file and > touch the underlying file. Then type C-M-e repeatedly. After some > tries you will be asked whether you want to edit the buffer. Ouch! Yes, I can reproduce this. At a guess, it's happening because of CC Mode's extensive use of text properties. I don't (yet) see why it only happens after a several C-M-e's rather than the first. Applying text properties counts as modifying the buffer (I think this is a Bad Thing), and the primitive function which applies the text properties seems to be checking for the file having been modified. Or something like that. As I say, that's just a guess. I'll take a closer look at it sometime. I suspect it is one of these irritating little bugs whose solution demands extensive redesign - here, perhaps, by using overlays/extents instead of text properties. I've added emacs-devel to the CC: Thanks for the report! > Andreas. -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer 2008-01-08 20:03 ` CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer Alan Mackenzie @ 2008-01-08 20:14 ` Lennart Borgman (gmail) 2008-01-08 20:17 ` martin rudalics 1 sibling, 0 replies; 10+ messages in thread From: Lennart Borgman (gmail) @ 2008-01-08 20:14 UTC (permalink / raw) To: bug-cc-mode; +Cc: Andreas Schwab, emacs-devel Alan Mackenzie wrote: > Hi, Andreas! > > On Tue, Jan 08, 2008 at 06:13:40PM +0100, Andreas Schwab wrote: >> c-{beginning,end}-of-defun try to modify the buffer and thus trigger >> ask-user-about-supersession-threat. To reproduce load a C file and >> touch the underlying file. Then type C-M-e repeatedly. After some >> tries you will be asked whether you want to edit the buffer. > > Ouch! > > Yes, I can reproduce this. At a guess, it's happening because of CC > Mode's extensive use of text properties. I don't (yet) see why it only > happens after a several C-M-e's rather than the first. Applying text > properties counts as modifying the buffer (I think this is a Bad Thing), > and the primitive function which applies the text properties seems to be > checking for the file having been modified. Or something like that. Are you talking about the text properties that font lock applies? I believe those does not mark the buffer as modified. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer 2008-01-08 20:03 ` CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer Alan Mackenzie 2008-01-08 20:14 ` Lennart Borgman (gmail) @ 2008-01-08 20:17 ` martin rudalics 2008-01-08 20:22 ` Lennart Borgman (gmail) 2008-01-08 22:47 ` Alan Mackenzie 1 sibling, 2 replies; 10+ messages in thread From: martin rudalics @ 2008-01-08 20:17 UTC (permalink / raw) To: bug-cc-mode; +Cc: Alan Mackenzie, emacs-devel > As I say, that's just a guess. I'll take a closer look at it sometime. > I suspect it is one of these irritating little bugs whose solution > demands extensive redesign - here, perhaps, by using overlays/extents > instead of text properties. Do you bind `buffer-file-name' to nil when applying text properties? ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer 2008-01-08 20:17 ` martin rudalics @ 2008-01-08 20:22 ` Lennart Borgman (gmail) 2008-01-08 21:38 ` martin rudalics 2008-01-08 22:47 ` Alan Mackenzie 1 sibling, 1 reply; 10+ messages in thread From: Lennart Borgman (gmail) @ 2008-01-08 20:22 UTC (permalink / raw) To: martin rudalics; +Cc: bug-cc-mode, Alan Mackenzie, emacs-devel martin rudalics wrote: >> As I say, that's just a guess. I'll take a closer look at it sometime. >> I suspect it is one of these irritating little bugs whose solution >> demands extensive redesign - here, perhaps, by using overlays/extents >> instead of text properties. > > Do you bind `buffer-file-name' to nil when applying text properties? There is a macro in font-lock.el called save-buffer-state that font lock uses when it changes the text properties. Unfortunately that macro is not available for anyone else to use since it is in an eval-when-compile. Maybe that macro should be made available outside of font-lock.el -- for changing text properties? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer 2008-01-08 20:22 ` Lennart Borgman (gmail) @ 2008-01-08 21:38 ` martin rudalics 2008-01-08 21:58 ` Lennart Borgman (gmail) 0 siblings, 1 reply; 10+ messages in thread From: martin rudalics @ 2008-01-08 21:38 UTC (permalink / raw) To: Lennart Borgman (gmail); +Cc: bug-cc-mode, Alan Mackenzie, emacs-devel > There is a macro in font-lock.el called save-buffer-state that font lock > uses when it changes the text properties. Unfortunately that macro is > not available for anyone else to use since it is in an > eval-when-compile. Maybe that macro should be made available outside of > font-lock.el -- for changing text properties? Apparently people don't want it, see: http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-08/msg00068.html ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer 2008-01-08 21:38 ` martin rudalics @ 2008-01-08 21:58 ` Lennart Borgman (gmail) 2008-01-08 22:39 ` martin rudalics 0 siblings, 1 reply; 10+ messages in thread From: Lennart Borgman (gmail) @ 2008-01-08 21:58 UTC (permalink / raw) To: martin rudalics; +Cc: bug-cc-mode, Alan Mackenzie, emacs-devel martin rudalics wrote: >> There is a macro in font-lock.el called save-buffer-state that font >> lock uses when it changes the text properties. Unfortunately that >> macro is not available for anyone else to use since it is in an >> eval-when-compile. Maybe that macro should be made available outside >> of font-lock.el -- for changing text properties? > > Apparently people don't want it, see: > > http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-08/msg00068.html You mean because no one has responded to your request? I believe I too have made the same request before, but with no response. If used properly I see no disadvantages with the save-buffer-state macro -- but otherwise it is of course dangerous. However I do not know the actual reason that it is not made available. Could someone please explain? ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer 2008-01-08 21:58 ` Lennart Borgman (gmail) @ 2008-01-08 22:39 ` martin rudalics 0 siblings, 0 replies; 10+ messages in thread From: martin rudalics @ 2008-01-08 22:39 UTC (permalink / raw) To: Lennart Borgman (gmail); +Cc: bug-cc-mode, Alan Mackenzie, emacs-devel > You mean because no one has responded to your request? Because I forgot to add this to `ada-set-syntax-table-properties' then, despite asking for it ... `antlr-mode' and `cperl-mode' knew better. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer 2008-01-08 20:17 ` martin rudalics 2008-01-08 20:22 ` Lennart Borgman (gmail) @ 2008-01-08 22:47 ` Alan Mackenzie 1 sibling, 0 replies; 10+ messages in thread From: Alan Mackenzie @ 2008-01-08 22:47 UTC (permalink / raw) To: martin rudalics; +Cc: bug-cc-mode, Andreas Schwab, emacs-devel Hi, Martin! On Tue, Jan 08, 2008 at 09:17:43PM +0100, martin rudalics wrote: > > As I say, that's just a guess. I'll take a closer look at it sometime. > > I suspect it is one of these irritating little bugs whose solution > > demands extensive redesign - here, perhaps, by using overlays/extents > > instead of text properties. > Do you bind `buffer-file-name' to nil when applying text properties? No! :-) Thank you muchly for the tip! I use a macro called c-save-buffer-state, which was modelled on font-lock's original save-buffer-state some years ago. At some stage, presumably s-b-s got modified but c-s-b-s didn't. Time to fix it! I can't understand why save-buffer-state has never become a standard Emacs macro. If you're doing _anything_ with text properties, you can't do without it. (OK, Eli, there's one or two exceptions, I know! ;-) -- Alan Mackenzie (Nuremberg, Germany). ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer [not found] <jed4sci6kb.fsf@sykes.suse.de> 2008-01-08 20:03 ` CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer Alan Mackenzie @ 2008-01-09 9:02 ` Alan Mackenzie 2008-01-09 9:16 ` martin rudalics 1 sibling, 1 reply; 10+ messages in thread From: Alan Mackenzie @ 2008-01-09 9:02 UTC (permalink / raw) To: Andreas Schwab; +Cc: bug-cc-mode, emacs-devel Hi, Andreas! On Tue, Jan 08, 2008 at 06:13:40PM +0100, Andreas Schwab wrote: > c-{beginning,end}-of-defun try to modify the buffer and thus trigger > ask-user-about-supersession-threat. To reproduce load a C file and > touch the underlying file. Then type C-M-e repeatedly. After some > tries you will be asked whether you want to edit the buffer. Would you try the following patch, please. Because it modifies a macro, you'll need to byte-compile all the cc-*.el files before it will take effect. *** cc-defs.el~ 2007-08-17 22:42:52.000000000 +0000 --- cc-defs.el 2008-01-09 08:57:19.414464408 +0000 *************** *** 425,430 **** --- 425,431 ---- (inhibit-read-only t) (inhibit-point-motion-hooks t) before-change-functions after-change-functions deactivate-mark + buffer-file-name ; Prevent primitives checking for file modification ,@varlist) (unwind-protect (progn ,@body) Let me know whether it works or not. Thanks again for the report. > Andreas. -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer 2008-01-09 9:02 ` Alan Mackenzie @ 2008-01-09 9:16 ` martin rudalics 0 siblings, 0 replies; 10+ messages in thread From: martin rudalics @ 2008-01-09 9:16 UTC (permalink / raw) To: Alan Mackenzie; +Cc: bug-cc-mode, Andreas Schwab, emacs-devel Please bind buffer-file-truename too. > *** cc-defs.el~ 2007-08-17 22:42:52.000000000 +0000 > --- cc-defs.el 2008-01-09 08:57:19.414464408 +0000 > *************** > *** 425,430 **** > --- 425,431 ---- > (inhibit-read-only t) (inhibit-point-motion-hooks t) > before-change-functions after-change-functions > deactivate-mark > + buffer-file-name buffer-file-truename ; Prevent primitives checking for file modification > ,@varlist) > (unwind-protect > (progn ,@body) ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-01-09 9:16 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <jed4sci6kb.fsf@sykes.suse.de> 2008-01-08 20:03 ` CC mode 5.31.4: c-{beginning, end}-of-defun try to modify buffer Alan Mackenzie 2008-01-08 20:14 ` Lennart Borgman (gmail) 2008-01-08 20:17 ` martin rudalics 2008-01-08 20:22 ` Lennart Borgman (gmail) 2008-01-08 21:38 ` martin rudalics 2008-01-08 21:58 ` Lennart Borgman (gmail) 2008-01-08 22:39 ` martin rudalics 2008-01-08 22:47 ` Alan Mackenzie 2008-01-09 9:02 ` Alan Mackenzie 2008-01-09 9:16 ` martin rudalics
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.