unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* disable-command twice adds blank lines
@ 2005-04-21 18:48 Dan Jacobson
  2005-04-23 16:15 ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Jacobson @ 2005-04-21 18:48 UTC (permalink / raw)


Do e.g., (disable-command 'not-modified).
Now watching the bottom of your .emacs as you do it several more
times.

Notice that it doesn't check that the command is already disabled, and
proceeds to modify .emacs again, but at least it is courteous and just
inserts a blank line each extra time.

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

* Re: disable-command twice adds blank lines
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2005-04-23 16:15 UTC (permalink / raw)
  Cc: bug-gnu-emacs

This did not fail for me in the current version.

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

* Re: disable-command twice adds blank lines
  2005-04-23 16:15 ` Richard Stallman
@ 2005-04-26  9:13   ` Lute Kamstra
  0 siblings, 0 replies; 3+ messages in thread
From: Lute Kamstra @ 2005-04-26  9:13 UTC (permalink / raw)
  Cc: bug-gnu-emacs, Dan Jacobson

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)

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

end of thread, other threads:[~2005-04-26  9:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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