aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love1999-01-15 17:29:03 +0000
committerDave Love1999-01-15 17:29:03 +0000
commitb2c85790c5c99ffa7d9deb310db35843bf1ffa99 (patch)
tree36d7242821a6a7c4e2680ee48ef3feab81257f93
parentfc02509028b4d37124f636f798247e02f76f12eb (diff)
downloademacs-b2c85790c5c99ffa7d9deb310db35843bf1ffa99.tar.gz
emacs-b2c85790c5c99ffa7d9deb310db35843bf1ffa99.zip
(help-make-xrefs): Avoid infloop in keymap substitutions
and change regexp for command names. (help-xref-go-back, function-called-at-point, symbol-file) (where-is): Doc fixes. (help-xref-go-back): Remove interactive spec. (describe-function-1): Fix message for alias. Buttomize alias name.
-rw-r--r--lisp/help.el44
1 files changed, 28 insertions, 16 deletions
diff --git a/lisp/help.el b/lisp/help.el
index 7ce9239c601..d18da1ecd25 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -511,11 +511,9 @@ C-p Display information about the GNU project.
511C-w Display information on absence of warranty for GNU Emacs." 511C-w Display information on absence of warranty for GNU Emacs."
512 help-map) 512 help-map)
513 513
514;; Return a function whose name is around point.
515;; If that gives no function, return a function which is called by the
516;; list containing point.
517;; If that doesn't give a function, return nil.
518(defun function-called-at-point () 514(defun function-called-at-point ()
515 "Return a function around point or else called by the list containing point.
516If that doesn't give a function, return nil."
519 (let ((stab (syntax-table))) 517 (let ((stab (syntax-table)))
520 (set-syntax-table emacs-lisp-mode-syntax-table) 518 (set-syntax-table emacs-lisp-mode-syntax-table)
521 (unwind-protect 519 (unwind-protect
@@ -552,7 +550,7 @@ That file records the part of `load-history' for preloaded files,
552which is cleared out before dumping to make Emacs smaller.") 550which is cleared out before dumping to make Emacs smaller.")
553 551
554(defun symbol-file (function) 552(defun symbol-file (function)
555 "Return the input source from which SYM was loaded. 553 "Return the input source from which FUNCTION was loaded.
556The value is normally a string that was passed to `load': 554The value is normally a string that was passed to `load':
557either an absolute file name, or a library name 555either an absolute file name, or a library name
558\(with no directory name and no `.el' or `.elc' at the end). 556\(with no directory name and no `.el' or `.elc' at the end).
@@ -635,6 +633,11 @@ It can also be nil, if the definition is not associated with any file."
635 (setq need-close t) 633 (setq need-close t)
636 (princ "(")) 634 (princ "("))
637 (princ string) 635 (princ string)
636 (with-current-buffer "*Help*"
637 (save-excursion
638 (save-match-data
639 (if (re-search-backward "alias for `\\([^`']+\\)'" nil t)
640 (help-xref-button 1 #'describe-function def)))))
638 (or file-name 641 (or file-name
639 (setq file-name (symbol-file function))) 642 (setq file-name (symbol-file function)))
640 (if file-name 643 (if file-name
@@ -683,8 +686,9 @@ It can also be nil, if the definition is not associated with any file."
683 (help-setup-xref (list #'describe-function function) (interactive-p))) 686 (help-setup-xref (list #'describe-function function) (interactive-p)))
684 (princ "not documented"))))) 687 (princ "not documented")))))
685 688
686;; We return 0 if we can't find a variable to return.
687(defun variable-at-point () 689(defun variable-at-point ()
690 "Return the bound variable symbol found around point.
691Return 0 if there is no such symbol."
688 (condition-case () 692 (condition-case ()
689 (let ((stab (syntax-table))) 693 (let ((stab (syntax-table)))
690 (unwind-protect 694 (unwind-protect
@@ -814,7 +818,7 @@ to display (default, the current buffer)."
814 (interactive-p)))) 818 (interactive-p))))
815 819
816(defun where-is (definition &optional insert) 820(defun where-is (definition &optional insert)
817 "Print message listing key sequences that invoke specified command. 821 "Print message listing key sequences that invoke the command DEFINITION.
818Argument is a command definition, usually a symbol with a function definition. 822Argument is a command definition, usually a symbol with a function definition.
819If INSERT (the prefix arg) is non-nil, insert the message in the buffer." 823If INSERT (the prefix arg) is non-nil, insert the message in the buffer."
820 (interactive 824 (interactive
@@ -848,7 +852,11 @@ Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el'
848to the specified name LIBRARY. 852to the specified name LIBRARY.
849 853
850If the optional third arg PATH is specified, that list of directories 854If the optional third arg PATH is specified, that list of directories
851is used instead of `load-path'." 855is used instead of `load-path'.
856
857When called from a program, the file name is normaly returned as a
858string. When run interactively, the argument INTERACTIVE-CALL is t,
859and the file name is displayed in the echo area."
852 (interactive (list (read-string "Locate library: ") 860 (interactive (list (read-string "Locate library: ")
853 nil nil 861 nil nil
854 t)) 862 t))
@@ -999,8 +1007,10 @@ that."
999 (help-xref-button 1 #'info (match-string 1)))) 1007 (help-xref-button 1 #'info (match-string 1))))
1000 ;; An obvious case of a key substitution: 1008 ;; An obvious case of a key substitution:
1001 (save-excursion 1009 (save-excursion
1002 (while (re-search-forward 1010 (while (re-search-forward
1003 "\\<M-x\\s-+\\(\\sw\\(\\sw\\|\\s_\\)+\\)" nil t) 1011 ;; Assume command name is only word characters
1012 ;; and dashes to get things like `use M-x foo.'.
1013 "\\<M-x\\s-+\\(\\sw\\(\\sw\\|-\\)+\\)" nil t)
1004 (let ((sym (intern-soft (match-string 1)))) 1014 (let ((sym (intern-soft (match-string 1))))
1005 (if (fboundp sym) 1015 (if (fboundp sym)
1006 (help-xref-button 1 #'describe-function sym))))) 1016 (help-xref-button 1 #'describe-function sym)))))
@@ -1016,17 +1026,19 @@ that."
1016 (while 1026 (while
1017 ;; Ignore single blank lines in table, but not 1027 ;; Ignore single blank lines in table, but not
1018 ;; double ones, which should terminate it. 1028 ;; double ones, which should terminate it.
1019 (and (looking-at "^\n?[^\n]") 1029 (and (looking-at "^\n?[^\n\t ]")
1020 (progn 1030 (progn
1021 (if (and (> (move-to-column col) 0) 1031 (if (and (> (move-to-column col) 0)
1022 (looking-at "\\(\\sw\\|\\s_\\)+$")) 1032 (looking-at "\\(\\sw\\|-\\)+$"))
1023 ;; 1033 ;;
1024 (let ((sym (intern-soft (match-string 0)))) 1034 (let ((sym (intern-soft (match-string 0))))
1025 (if (fboundp sym) 1035 (if (fboundp sym)
1026 (help-xref-button 1036 (help-xref-button
1027 0 #'describe-function sym)))) 1037 0 #'describe-function sym))))
1028 t) 1038 t)
1029 (zerop (forward-line)) 1039 (progn
1040 (end-of-line)
1041 (zerop (forward-line)))
1030 (move-to-column 0))))))) 1042 (move-to-column 0)))))))
1031 (set-syntax-table stab)) 1043 (set-syntax-table stab))
1032 ;; Make a back-reference in this buffer if appropriate. 1044 ;; Make a back-reference in this buffer if appropriate.
@@ -1102,8 +1114,7 @@ help buffer."
1102 (help-follow pos)))) 1114 (help-follow pos))))
1103 1115
1104(defun help-xref-go-back (buffer) 1116(defun help-xref-go-back (buffer)
1105 "Go back to the previous help buffer text using info on `help-xref-stack'." 1117 "From BUFFER, go back to previous help buffer text using `help-xref-stack'."
1106 (interactive)
1107 (let (item position method args) 1118 (let (item position method args)
1108 (with-current-buffer buffer 1119 (with-current-buffer buffer
1109 (when help-xref-stack 1120 (when help-xref-stack
@@ -1117,6 +1128,7 @@ help buffer."
1117 (goto-char position))) 1128 (goto-char position)))
1118 1129
1119(defun help-go-back () 1130(defun help-go-back ()
1131 "Invoke the [back] button (if any) in the Help mode buffer."
1120 (interactive) 1132 (interactive)
1121 (help-follow (1- (point-max)))) 1133 (help-follow (1- (point-max))))
1122 1134
@@ -1224,7 +1236,7 @@ more information."
1224(defun resize-temp-buffer-window () 1236(defun resize-temp-buffer-window ()
1225 "Resize the current window to fit its contents. 1237 "Resize the current window to fit its contents.
1226Will not make it higher than `temp-buffer-max-height' nor smaller than 1238Will not make it higher than `temp-buffer-max-height' nor smaller than
1227`window-min-height'. Do nothing if it is the only window on its frame, if it 1239`window-min-height'. Do nothing if it is the only window on its frame, if it
1228is not as wide as the frame or if some of the window's contents are scrolled 1240is not as wide as the frame or if some of the window's contents are scrolled
1229out of view." 1241out of view."
1230 (unless (or (one-window-p 'nomini) 1242 (unless (or (one-window-p 'nomini)