emacs-devel
[Top][All Lists]
Advanced

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

Re: Small enhancement for add-log.el


From: Kim F. Storm
Subject: Re: Small enhancement for add-log.el
Date: Fri, 08 Oct 2004 10:54:47 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

Luc Teirlinck <address@hidden> writes:

> Kim Storm wrote:
>
>    When I look through ChangeLog files, I often type `q' to quit --
>    but instead a q is inserted into the buffer.
>
>    What about the following change [I know it's a hack] which kills the
>    buffer if you type `q' in an unmodified ChangeLog buffer.
>
> I do not have this tendency myself and I believe that this is just a
> personal idiosyncrasy.  I believe the probability of doing that would
> be a lot bigger when editing etc/NEWS, because there everything looks
> exactly like if you had done `C-h n'.  Even for etc/NEWS, I would not
> recommend your solution.


I originally tried to use first-change-hook to disable the 'q' command,
but it turns out that if you have font-lock in a buffer, first-change-hook
is useless, as the fontification adds text properties, and that is
seen as a modification of the buffer (even when the buffer modification
flag is restored).

I then tried to use buffer-modified-tick, but that has the same problem.

Is there some way to implement a first-user-change-hook ?

>
> I have other idiosyncrasies myself.  In a buffer visiting a file, I
> often type `^', expecting to visit the file's directory in Dired
> (because I think of `^' as going up in the directory tree).  I just
> erase the `^' and do `C-x d'.  I am not going to suggest to rebind `^'
> in file visiting buffers, to fit that habit of mine.

Still, it should be possible to have a sort of "pseudo-view-minor-mode"
which works like view mode until you make some "real change" to a file.

>
>    It should be pretty safe, as the buffer is modified after C-x 4 a
>    and similar commands.
>
> But it is no longer modified after you save your changes without being
> completely through editing.  (I often do that.)  

I don't like that either -- but (buffer-modified-p) was the only
method I could find since first-change-hook doesn't work.

But maybe I could use an after-save-hook to inhibit the feature once
a modified buffer has been saved once.

-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

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