]> code.delx.au - gnu-emacs/blobdiff - lisp/help-fns.el
(backup-buffer-copy): Fully revert change. Sigh.
[gnu-emacs] / lisp / help-fns.el
index cddfa3611edf4b092d9a8f73502da96ca54877af..d84a861a0191f368642e2639c6bc118244dfc504 100644 (file)
@@ -1,7 +1,7 @@
 ;;; help-fns.el --- Complex help functions
 
 ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001,
-;;   2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+;;   2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: help, internal
@@ -10,7 +10,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 
 (require 'help-mode)
 
-
-;;;###autoload
-(defun help-with-tutorial (&optional arg)
-  "Select the Emacs learn-by-doing tutorial.
-If there is a tutorial version written in the language
-of the selected language environment, that version is used.
-If there's no tutorial in that language, `TUTORIAL' is selected.
-With ARG, you are asked to choose which language."
-  (interactive "P")
-  (let ((lang (if arg
-                  (let ((minibuffer-setup-hook minibuffer-setup-hook))
-                    (add-hook 'minibuffer-setup-hook
-                              'minibuffer-completion-help)
-                    (read-language-name 'tutorial "Language: " "English"))
-               (if (get-language-info current-language-environment 'tutorial)
-                   current-language-environment
-                 "English")))
-       file filename)
-    (setq filename (get-language-info lang 'tutorial))
-    (setq file (expand-file-name (concat "~/" filename)))
-    (delete-other-windows)
-    (if (get-file-buffer file)
-       (switch-to-buffer (get-file-buffer file))
-      (switch-to-buffer (create-file-buffer file))
-      (setq buffer-file-name file)
-      (setq default-directory (expand-file-name "~/"))
-      (setq buffer-auto-save-file-name nil)
-      (insert-file-contents (expand-file-name filename data-directory))
-      (hack-local-variables)
-      (goto-char (point-min))
-      (search-forward "\n<<")
-      (beginning-of-line)
-      ;; Convert the <<...>> line to the proper [...] line,
-      ;; or just delete the <<...>> line if a [...] line follows.
-      (cond ((save-excursion
-              (forward-line 1)
-              (looking-at "\\["))
-            (delete-region (point) (progn (forward-line 1) (point))))
-           ((looking-at "<<Blank lines inserted.*>>")
-            (replace-match "[Middle of page left blank for didactic purposes.   Text continues below]"))
-           (t
-            (looking-at "<<")
-            (replace-match "[")
-            (search-forward ">>")
-            (replace-match "]")))
-      (beginning-of-line)
-      (let ((n (- (window-height (selected-window))
-                 (count-lines (point-min) (point))
-                 6)))
-       (if (< n 8)
-           (progn
-             ;; For a short gap, we don't need the [...] line,
-             ;; so delete it.
-             (delete-region (point) (progn (end-of-line) (point)))
-             (newline n))
-         ;; Some people get confused by the large gap.
-         (newline (/ n 2))
-
-         ;; Skip the [...] line (don't delete it).
-         (forward-line 1)
-         (newline (- n (/ n 2)))))
-      (goto-char (point-min))
-      (setq buffer-undo-list nil)
-      (set-buffer-modified-p nil))))
-
-\f
 ;; Functions
 
 ;;;###autoload
@@ -466,7 +400,7 @@ face (according to `face-differs-from-default-p')."
 
 ;;;###autoload
 (defun variable-at-point (&optional any-symbol)
-  "Return the bound variable symbol found around point.
+  "Return the bound variable symbol found at or before point.
 Return 0 if there is no such symbol.
 If ANY-SYMBOL is non-nil, don't insist the symbol be bound."
   (or (condition-case ()
@@ -619,7 +553,11 @@ it is displayed along with the global value."
                ;; of a symbol.
                (set-syntax-table emacs-lisp-mode-syntax-table)
                (goto-char val-start-pos)
-               (delete-region (point) (progn (end-of-line) (point)))
+               ;; The line below previously read as
+               ;; (delete-region (point) (progn (end-of-line) (point)))
+               ;; which suppressed display of the buffer local value for
+               ;; large values.
+               (when (looking-at "value is") (replace-match ""))
                (save-excursion
                  (insert "\n\nValue:")
                  (set (make-local-variable 'help-button-cache)
@@ -629,7 +567,7 @@ it is displayed along with the global value."
                               'action help-button-cache
                               'follow-link t
                               'help-echo "mouse-2, RET: show value")
-               (insert ".\n\n")))
+               (insert ".\n")))
 
            ;; Mention if it's an alias
             (let* ((alias (condition-case nil
@@ -641,8 +579,11 @@ it is displayed along with the global value."
                             (documentation-property alias 'variable-documentation))))
               (unless (eq alias variable)
                 (princ (format "\nThis variable is an alias for `%s'.\n" alias)))
+             (if (or obsolete safe-var)
+                 (terpri))
+
               (when obsolete
-                (princ "\nThis variable is obsolete")
+                (princ "This variable is obsolete")
                 (if (cdr obsolete) (princ (format " since %s" (cdr obsolete))))
                 (princ ";") (terpri)
                 (princ (if (stringp (car obsolete)) (car obsolete)
@@ -653,9 +594,8 @@ it is displayed along with the global value."
                (princ "if its value\nsatisfies the predicate ")
                (princ (if (byte-code-function-p safe-var)
                           "which is byte-compiled expression.\n"
-                        (format "`%s'.\n" safe-var)))
-               (terpri))
-             (princ "Documentation:\n")
+                        (format "`%s'.\n" safe-var))))
+             (princ "\nDocumentation:\n")
               (princ (or doc "Not documented as a variable.")))
            ;; Make a link to customize if this variable can be customized.
            (if (custom-variable-p variable)