]> code.delx.au - gnu-emacs/blobdiff - lisp/help.el
(mail-extr-safe-move-sexp): Make sure this doesn't
[gnu-emacs] / lisp / help.el
index f17484fe9f48718dd60598753c301027fafdf0e0..97887b1c81c453191210229878efa353027156db 100644 (file)
@@ -18,8 +18,9 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; Commentary:
 
 (define-key help-map "q" 'help-quit)
 
 (defvar help-font-lock-keywords
-  (let ((name-char "[-+a-zA-Z0-9_*]") (sym-char "[-+a-zA-Z0-9_:*]"))
-    (list
-     ;;
-     ;; The symbol itself.
-     (list (concat "\\`\\(" name-char "+\\)\\(:\\)?")
-          '(1 (if (match-beginning 2)
-                  font-lock-function-name-face
-                font-lock-variable-name-face)
-              nil t))
-     ;;
-     ;; Words inside `' which tend to be symbol names.
-     (list (concat "`\\(" sym-char sym-char "+\\)'")
-          1 'font-lock-reference-face t)
-     ;;
-     ;; CLisp `:' keywords as references.
-     (list (concat "\\<:" sym-char "+\\>") 0 'font-lock-reference-face t)))
+  (eval-when-compile
+    (let ((name-char "[-+a-zA-Z0-9_*]") (sym-char "[-+a-zA-Z0-9_:*]"))
+      (list
+       ;;
+       ;; The symbol itself.
+       (list (concat "\\`\\(" name-char "+\\)\\(\\(:\\)\\|\\('\\)\\)")
+            '(1 (if (match-beginning 3)
+                    font-lock-function-name-face
+                  font-lock-variable-name-face)))
+       ;;
+       ;; Words inside `' which tend to be symbol names.
+       (list (concat "`\\(" sym-char sym-char "+\\)'")
+            1 'font-lock-reference-face t)
+       ;;
+       ;; CLisp `:' keywords as references.
+       (list (concat "\\<:" sym-char "+\\>") 0 'font-lock-reference-face t))))
   "Default expressions to highlight in Help mode.")
 
 (defun help-mode ()
@@ -314,6 +315,7 @@ describes the minor mode."
   (interactive)
   (with-output-to-temp-buffer "*Help*"
     (let ((minor-modes minor-mode-alist)
+         (first t)
          (locals (buffer-local-variables)))
       (while minor-modes
        (let* ((minor-mode (car (car minor-modes)))
@@ -333,10 +335,17 @@ describes the minor mode."
                                      0 (match-beginning 0)))))
                (while (and indicator (symbolp indicator))
                  (setq indicator (symbol-value indicator)))
-               (princ (format "%s minor mode (indicator%s):\n"
-                              pretty-minor-mode indicator))
+               (if first
+                   (princ "The minor modes are described first,
+followed by the major mode, which is described on the last page.\n\f\n"))
+               (setq first nil)
+               (princ (format "%s minor mode (%s):\n"
+                              pretty-minor-mode
+                              (if indicator
+                                  (format "indicator%s" indicator)
+                                "no indicator")))
                (princ (documentation minor-mode))
-               (princ "\n\n"))))
+               (princ "\n\f\n"))))
        (setq minor-modes (cdr minor-modes))))
     (princ mode-name)
     (princ " mode:\n")
@@ -657,12 +666,15 @@ Argument is a command definition, usually a symbol with a function definition."
       (message "%s is not on any key" definition)))
   nil)
 
-(defun locate-library (library &optional nosuffix)
-  "Show the full path name of Emacs library LIBRARY.
+(defun locate-library (library &optional nosuffix path)
+  "Show the precise file name of Emacs library LIBRARY.
 This command searches the directories in `load-path' like `M-x load-library'
 to find the file that `M-x load-library RET LIBRARY RET' would load.
 Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el'
-to the specified name LIBRARY (a la calling `load' instead of `load-library')."
+to the specified name LIBRARY.
+
+If the optional third arg PATH is specified, that list of directories
+is used instead of `load-path'."
   (interactive "sLocate library: ")
   (catch 'answer
     (mapcar
@@ -675,8 +687,22 @@ to the specified name LIBRARY (a la calling `load' instead of `load-library')."
                   (progn
                     (message "Library is file %s" try)
                     (throw 'answer try)))))
-        (if nosuffix '("") '(".elc" ".el" ""))))
-     load-path)
+        (if nosuffix
+            '("")
+          (let ((basic '(".elc" ".el" ""))
+                (compressed '(".Z" ".gz" "")))
+            ;; If autocompression mode is on,
+            ;; consider all combinations of library suffixes
+            ;; and compression suffixes.
+            (if (rassq 'jka-compr-handler file-name-handler-alist)
+                (apply 'nconc
+                       (mapcar '(lambda (compelt)
+                                  (mapcar '(lambda (baselt)
+                                             (concat baselt compelt))
+                                          basic))
+                               compressed))
+              basic)))))
+     (or path load-path))
     (message "No library %s in search path" library)
     nil))