unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lute Kamstra <Lute.Kamstra.news@xs4all.nl>
Cc: bug-gnu-emacs@gnu.org, Dan Jacobson <jidanni@jidanni.org>
Subject: Re: disable-command twice adds blank lines
Date: Tue, 26 Apr 2005 11:13:24 +0200	[thread overview]
Message-ID: <87zmvlnbnv.fsf@xs4all.nl> (raw)
In-Reply-To: <E1DPNIJ-0007Pt-Bh@fencepost.gnu.org> (Richard Stallman's message of "Sat, 23 Apr 2005 12:15:47 -0400")

Richard Stallman <rms@gnu.org> writes:

> This did not fail for me in the current version.

I did for me.  Here is how you can reproduce it:

  Start Emacs and visit your .emacs.
  Make sure the end of the buffer is visible.
  Do: M-: (disable-command 'not-modified) RET
    This inserts "\n(put 'not-modified 'disabled t)\n" at (point-max).
  Do another: M-: (disable-command 'not-modified) RET
    This inserts "\n" before the "(put 'not-modified 'disabled t)" at
    the end of the buffer.

The problem is that disable-command first deletes _one_ existing line
with "(put 'not-modified " in it and then inserts _two_ new lines.
The net result is inserting one newline.  What about the patch below
to fix this?  It has the side effect of inserting a new "(put
'not-modified " sexp at the location it deleted an old one, which is
good IMO.

Lute.


Index: lisp/novice.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/novice.el,v
retrieving revision 1.38
diff -c -r1.38 novice.el
*** lisp/novice.el	6 Mar 2005 18:29:10 -0000	1.38
--- lisp/novice.el	26 Apr 2005 09:03:03 -0000
***************
*** 1,6 ****
  ;;; novice.el --- handling of disabled commands ("novice mode") for Emacs
  
! ;; Copyright (C) 1985, 1986, 1987, 1994, 2002, 2004
  ;;   Free Software Foundation, Inc.
  
  ;; Maintainer: FSF
--- 1,6 ----
  ;;; novice.el --- handling of disabled commands ("novice mode") for Emacs
  
! ;; Copyright (C) 1985, 1986, 1987, 1994, 2002, 2004, 2005
  ;;   Free Software Foundation, Inc.
  
  ;; Maintainer: FSF
***************
*** 182,190 ****
        (if (search-forward (concat "(put '" (symbol-name command) " ") nil t)
  	  (delete-region
  	   (progn (beginning-of-line) (point))
! 	   (progn (forward-line 1) (point))))
!       (goto-char (point-max))
!       (insert "\n(put '" (symbol-name command) " 'disabled t)\n")
        (save-buffer))))
  
  (provide 'novice)
--- 182,191 ----
        (if (search-forward (concat "(put '" (symbol-name command) " ") nil t)
  	  (delete-region
  	   (progn (beginning-of-line) (point))
! 	   (progn (forward-line 1) (point)))
! 	(goto-char (point-max))
! 	(insert ?\n))
!       (insert "(put '" (symbol-name command) " 'disabled t)\n")
        (save-buffer))))
  
  (provide 'novice)

      reply	other threads:[~2005-04-26  9:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-21 18:48 disable-command twice adds blank lines Dan Jacobson
2005-04-23 16:15 ` Richard Stallman
2005-04-26  9:13   ` Lute Kamstra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zmvlnbnv.fsf@xs4all.nl \
    --to=lute.kamstra.news@xs4all.nl \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).