X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/3f715d17fef56ee78a3df7ebb00d4e8b1aec37de..1fc01b083c6e8be87a06e24afcba9a4dc2b6ca09:/lisp/help.el diff --git a/lisp/help.el b/lisp/help.el index 5ed67566c9..b5c778b1df 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1,7 +1,7 @@ ;;; help.el --- help commands for Emacs ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002, -;; 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: help, internal @@ -221,7 +221,7 @@ i Start the Info documentation reader: read on-line manuals. I METHOD Describe a specific input method, or RET for current. k KEYS Display the full documentation for the key sequence. K KEYS Show the on-line manual's section for the command bound to KEYS. -l Show last 100 characters you typed (lossage). +l Show last 300 input keystrokes (lossage). L LANG-ENV Describes a specific language environment, or RET for current. m Display documentation of current minor modes and current major mode, including their special commands. @@ -254,47 +254,47 @@ C-w Information on absence of warranty for GNU Emacs." (defun function-called-at-point () "Return a function around point or else called by the list containing point. If that doesn't give a function, return nil." - (or (with-syntax-table emacs-lisp-mode-syntax-table - (or (condition-case () - (save-excursion - (or (not (zerop (skip-syntax-backward "_w"))) - (eq (char-syntax (following-char)) ?w) - (eq (char-syntax (following-char)) ?_) - (forward-sexp -1)) - (skip-chars-forward "'") - (let ((obj (read (current-buffer)))) - (and (symbolp obj) (fboundp obj) obj))) - (error nil)) - (condition-case () - (save-excursion - (save-restriction - (narrow-to-region (max (point-min) - (- (point) 1000)) (point-max)) - ;; Move up to surrounding paren, then after the open. - (backward-up-list 1) - (forward-char 1) - ;; If there is space here, this is probably something - ;; other than a real Lisp function call, so ignore it. - (if (looking-at "[ \t]") - (error "Probably not a Lisp function call")) - (let ((obj (read (current-buffer)))) - (and (symbolp obj) (fboundp obj) obj)))) - (error nil)))) - (let* ((str (find-tag-default)) - (sym (if str (intern-soft str)))) - (if (and sym (fboundp sym)) - sym - (save-match-data - (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str)) - (setq sym (intern-soft (match-string 1 str))) - (and (fboundp sym) sym))))))) + (with-syntax-table emacs-lisp-mode-syntax-table + (or (condition-case () + (save-excursion + (or (not (zerop (skip-syntax-backward "_w"))) + (eq (char-syntax (following-char)) ?w) + (eq (char-syntax (following-char)) ?_) + (forward-sexp -1)) + (skip-chars-forward "'") + (let ((obj (read (current-buffer)))) + (and (symbolp obj) (fboundp obj) obj))) + (error nil)) + (condition-case () + (save-excursion + (save-restriction + (narrow-to-region (max (point-min) + (- (point) 1000)) (point-max)) + ;; Move up to surrounding paren, then after the open. + (backward-up-list 1) + (forward-char 1) + ;; If there is space here, this is probably something + ;; other than a real Lisp function call, so ignore it. + (if (looking-at "[ \t]") + (error "Probably not a Lisp function call")) + (let ((obj (read (current-buffer)))) + (and (symbolp obj) (fboundp obj) obj)))) + (error nil)) + (let* ((str (find-tag-default)) + (sym (if str (intern-soft str)))) + (if (and sym (fboundp sym)) + sym + (save-match-data + (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str)) + (setq sym (intern-soft (match-string 1 str))) + (and (fboundp sym) sym)))))))) ;;; `User' help functions (defun view-help-file (file &optional dir) (view-file (expand-file-name file (or dir data-directory))) - (goto-address) + (goto-address-mode 1) (goto-char (point-min))) (defun describe-distribution () @@ -453,7 +453,7 @@ is specified by the variable `message-log-max'." (view-help-file "MORE.STUFF")) (defun view-lossage () - "Display last 100 input keystrokes. + "Display last 300 input keystrokes. To record all your input on a file, use `open-dribble-file'." (interactive) @@ -1207,7 +1207,7 @@ window itself is specified by the variable `help-window'." (defmacro with-help-window (buffer-name &rest body) "Display buffer BUFFER-NAME in a help window evaluating BODY. Select help window if the actual value of the user option -`help-window-select' says so." +`help-window-select' says so. Return last value in BODY." (declare (indent 1) (debug t)) ;; Bind list-of-frames to `frame-list' and list-of-window-tuples to a ;; list of one tuple @@ -1222,23 +1222,22 @@ Select help window if the actual value of the user option list)) 'no-mini t) list))) - ;; We set `help-window' to t in order to trigger `help-mode-finish' - ;; to set `help-window' to the actual help window. + ;; Make `help-window' t to trigger `help-mode-finish' to set + ;; `help-window' to the actual help window. (setq help-window t) ;; Make `help-window-point-marker' point nowhere (the only place ;; where this should be set to a buffer position is within BODY). (set-marker help-window-point-marker nil) - - (with-output-to-temp-buffer ,buffer-name - (progn ,@body)) - - (when (windowp help-window) - ;; Set up help window. - (help-window-setup list-of-frames list-of-window-tuples)) - - ;; Reset `help-window' to nil to avoid confusing future calls of - ;; `help-mode-finish' by "plain" `with-output-to-temp-buffer'. - (setq help-window nil))) + (prog1 + ;; Return value returned by `with-output-to-temp-buffer'. + (with-output-to-temp-buffer ,buffer-name + (progn ,@body)) + (when (windowp help-window) + ;; Set up help window. + (help-window-setup list-of-frames list-of-window-tuples)) + ;; Reset `help-window' to nil to avoid confusing future calls of + ;; `help-mode-finish' with plain `with-output-to-temp-buffer'. + (setq help-window nil)))) (provide 'help)