comparison lisp/simple.el @ 105372:bd2966850aac

Use `called-interactively-p' instead of `interactive-p'.
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 02 Oct 2009 03:48:36 +0000
parents b24c3613ac28
children 724dd25f06a9
comparison
equal deleted inserted replaced
105371:0769a73f1d18 105372:bd2966850aac
3024 3024
3025 This command is similar to `copy-region-as-kill', except that it gives 3025 This command is similar to `copy-region-as-kill', except that it gives
3026 visual feedback indicating the extent of the region being copied." 3026 visual feedback indicating the extent of the region being copied."
3027 (interactive "r") 3027 (interactive "r")
3028 (copy-region-as-kill beg end) 3028 (copy-region-as-kill beg end)
3029 ;; This use of interactive-p is correct 3029 ;; This use of called-interactively-p is correct
3030 ;; because the code it controls just gives the user visual feedback. 3030 ;; because the code it controls just gives the user visual feedback.
3031 (if (interactive-p) 3031 (if (called-interactively-p 'interactive)
3032 (let ((other-end (if (= (point) beg) end beg)) 3032 (let ((other-end (if (= (point) beg) end beg))
3033 (opoint (point)) 3033 (opoint (point))
3034 ;; Inhibit quitting so we can make a quit here 3034 ;; Inhibit quitting so we can make a quit here
3035 ;; look like a C-g typed as a command. 3035 ;; look like a C-g typed as a command.
3036 (inhibit-quit t)) 3036 (inhibit-quit t))
3990 ;; When adding a newline, don't expand an abbrev. 3990 ;; When adding a newline, don't expand an abbrev.
3991 (let ((abbrev-mode nil)) 3991 (let ((abbrev-mode nil))
3992 (end-of-line) 3992 (end-of-line)
3993 (insert (if use-hard-newlines hard-newline "\n"))) 3993 (insert (if use-hard-newlines hard-newline "\n")))
3994 (line-move arg nil nil try-vscroll)) 3994 (line-move arg nil nil try-vscroll))
3995 (if (interactive-p) 3995 (if (called-interactively-p 'interactive)
3996 (condition-case nil 3996 (condition-case nil
3997 (line-move arg nil nil try-vscroll) 3997 (line-move arg nil nil try-vscroll)
3998 ((beginning-of-buffer end-of-buffer) (ding))) 3998 ((beginning-of-buffer end-of-buffer) (ding)))
3999 (line-move arg nil nil try-vscroll))) 3999 (line-move arg nil nil try-vscroll)))
4000 nil) 4000 nil)
4020 If you are thinking of using this in a Lisp program, consider using 4020 If you are thinking of using this in a Lisp program, consider using
4021 `forward-line' with a negative argument instead. It is usually easier 4021 `forward-line' with a negative argument instead. It is usually easier
4022 to use and more reliable (no dependence on goal column, etc.)." 4022 to use and more reliable (no dependence on goal column, etc.)."
4023 (interactive "^p\np") 4023 (interactive "^p\np")
4024 (or arg (setq arg 1)) 4024 (or arg (setq arg 1))
4025 (if (interactive-p) 4025 (if (called-interactively-p 'interactive)
4026 (condition-case nil 4026 (condition-case nil
4027 (line-move (- arg) nil nil try-vscroll) 4027 (line-move (- arg) nil nil try-vscroll)
4028 ((beginning-of-buffer end-of-buffer) (ding))) 4028 ((beginning-of-buffer end-of-buffer) (ding)))
4029 (line-move (- arg) nil nil try-vscroll)) 4029 (line-move (- arg) nil nil try-vscroll))
4030 nil) 4030 nil)
6427 (keyboard-translate ?\C-? ?\C-d)) 6427 (keyboard-translate ?\C-? ?\C-d))
6428 (keyboard-translate ?\C-h ?\C-h) 6428 (keyboard-translate ?\C-h ?\C-h)
6429 (keyboard-translate ?\C-? ?\C-?)))) 6429 (keyboard-translate ?\C-? ?\C-?))))
6430 6430
6431 (run-hooks 'normal-erase-is-backspace-hook) 6431 (run-hooks 'normal-erase-is-backspace-hook)
6432 (if (interactive-p) 6432 (if (called-interactively-p 'interactive)
6433 (message "Delete key deletes %s" 6433 (message "Delete key deletes %s"
6434 (if (terminal-parameter nil 'normal-erase-is-backspace) 6434 (if (terminal-parameter nil 'normal-erase-is-backspace)
6435 "forward" "backward"))))) 6435 "forward" "backward")))))
6436 6436
6437 (defvar vis-mode-saved-buffer-invisibility-spec nil 6437 (defvar vis-mode-saved-buffer-invisibility-spec nil