From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Small enhancement for add-log.el Date: Fri, 08 Oct 2004 10:54:47 +0200 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: References: <200410072307.i97N7s307908@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1097225783 19473 80.91.229.6 (8 Oct 2004 08:56:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 8 Oct 2004 08:56:23 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 08 10:56:07 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CFqXm-0003ds-00 for ; Fri, 08 Oct 2004 10:56:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CFqeY-0004yr-Ai for ged-emacs-devel@m.gmane.org; Fri, 08 Oct 2004 05:03:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CFqdZ-0004yZ-57 for emacs-devel@gnu.org; Fri, 08 Oct 2004 05:02:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CFqdV-0004yG-56 for emacs-devel@gnu.org; Fri, 08 Oct 2004 05:02:03 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CFqdU-0004y6-Fi for emacs-devel@gnu.org; Fri, 08 Oct 2004 05:02:00 -0400 Original-Received: from [212.88.64.25] (helo=mail-relay.sonofon.dk) by monty-python.gnu.org with smtp (Exim 4.34) id 1CFqWQ-00005B-01 for emacs-devel@gnu.org; Fri, 08 Oct 2004 04:54:42 -0400 Original-Received: (qmail 66782 invoked from network); 8 Oct 2004 08:54:40 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 8 Oct 2004 08:54:40 -0000 Original-To: Luc Teirlinck In-Reply-To: <200410072307.i97N7s307908@raven.dms.auburn.edu> (Luc Teirlinck's message of "Thu, 7 Oct 2004 18:07:54 -0500 (CDT)") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:28076 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28076 Luc Teirlinck 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 http://www.cua.dk