emacs-devel
[Top][All Lists]
Advanced

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

Re: disable-command


From: Eli Zaretskii
Subject: Re: disable-command
Date: Sun, 27 Jan 2002 16:19:29 +0200 (IST)

On Sun, 27 Jan 2002, Karl Eichwalder wrote:

> I'm talking about *Help* raised by a disable-command setting:
> 
> M-x disable-command RET save-buffer RET
> C-x C-s
> 
> And when the quiz starts try to scroll with C-M-v.

Ah, that's because Emacs doesn't want to see any keys but the few ones it 
prints in the *Help* buffer.  Richard, is there any reason why we 
shouldn't allow scrolling commands at that spot?

> Another bug occurs when starting a fresh Emacs:
> 
>     emacs -q --no-site-file
>     M-x disable-command RET save-buffer RET
>     => disable-command: Wrong type argument: stringp, nil

Does the patch below fix this?

2002-01-27  Eli Zaretskii  <address@hidden>

        * novice.el (disable-command): If user-init-file is nil, default
        to ~/.emacs.

*** lisp/novice.e~0     Sun Jul 15 18:36:14 2001
--- lisp/novice.el      Sun Jan 27 16:02:16 2002
***************
*** 138,154 ****
    (if (not (commandp command))
        (error "Invalid command name `%s'" command))
    (put command 'disabled t)
!   (save-excursion
!    (set-buffer (find-file-noselect
!               (substitute-in-file-name user-init-file)))
!    (goto-char (point-min))
!    (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)
  
--- 138,162 ----
    (if (not (commandp command))
        (error "Invalid command name `%s'" command))
    (put command 'disabled t)
!   (let ((init-file user-init-file))
!     (when (or (not (stringp init-file))
!             (not (file-exists-p init-file)))
!       (setq init-file (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs"))
!       (if (and (not (file-exists-p init-file))
!              (eq system-type 'windows-nt)
!              (file-exists-p "~/_emacs"))
!         (setq init-file "~/_emacs")))
!     (save-excursion
!       (set-buffer (find-file-noselect
!                  (substitute-in-file-name init-file)))
!       (goto-char (point-min))
!       (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)
  




reply via email to

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