summaryrefslogtreecommitdiff
path: root/lisp/info.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/info.el')
-rw-r--r--lisp/info.el122
1 files changed, 44 insertions, 78 deletions
diff --git a/lisp/info.el b/lisp/info.el
index 94b0ef6ce75..8e8c3371f42 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -136,6 +136,12 @@ The Lisp code is executed when the node is selected.")
:version "22.1"
:group 'info)
+(defface info-emphasis
+ '((t (:inherit italic)))
+ "Face for emphasized text (enclosed with underscores)."
+ :version "27.1"
+ :group 'info)
+
(defcustom Info-fontify-visited-nodes t
"Non-nil to fontify references to visited nodes in `info-xref-visited' face."
:version "22.1"
@@ -343,7 +349,9 @@ This only has an effect if `Info-hide-note-references' is non-nil."
This applies to Info search for regular expressions.
You might want to use something like \"[ \\t\\r\\n]+\" instead.
In the Customization buffer, that is `[' followed by a space,
-a tab, a carriage return (control-M), a newline, and `]+'."
+a tab, a carriage return (control-M), a newline, and `]+'. Don't
+add any capturing groups into this value; that can change the
+numbering of existing capture groups in unexpected ways."
:type 'regexp
:group 'info)
@@ -380,12 +388,6 @@ with wrapping around the current Info node."
:type 'hook
:group 'info)
-(defvar Info-edit-mode-hook nil
- "Hook run when `Info-edit-mode' is activated.")
-
-(make-obsolete-variable 'Info-edit-mode-hook
- "editing Info nodes by hand is not recommended." "24.4")
-
(defvar-local Info-current-file nil
"Info file that Info is now looking at, or nil.
This is the name that was specified in Info, not the actual file name.
@@ -642,21 +644,23 @@ Do the right thing if the file has been compressed or zipped."
(insert-file-contents-literally fullname visit)
(let ((inhibit-read-only t)
(coding-system-for-write 'no-conversion)
- (inhibit-null-byte-detection t) ; Index nodes include null bytes
+ (inhibit-nul-byte-detection t) ; Index nodes include null bytes
(default-directory (or (file-name-directory fullname)
default-directory)))
(or (consp decoder)
(setq decoder (list decoder)))
(apply #'call-process-region (point-min) (point-max)
(car decoder) t t nil (cdr decoder))))
- (let ((inhibit-null-byte-detection t)) ; Index nodes include null bytes
+ (let ((inhibit-nul-byte-detection t)) ; Index nodes include null bytes
(insert-file-contents fullname visit)))
;; Clear the caches of modified Info files.
(let* ((attribs-old (cdr (assoc fullname Info-file-attributes)))
- (modtime-old (and attribs-old (nth 5 attribs-old)))
+ (modtime-old (and attribs-old
+ (file-attribute-modification-time attribs-old)))
(attribs-new (and (stringp fullname) (file-attributes fullname)))
- (modtime-new (and attribs-new (nth 5 attribs-new))))
+ (modtime-new (and attribs-new
+ (file-attribute-modification-time attribs-new))))
(when (and modtime-old modtime-new
(time-less-p modtime-old modtime-new))
(setq Info-index-nodes (remove (assoc (or Info-current-file filename)
@@ -877,10 +881,13 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
(forward-line 1) ; does the line after delimiter match REGEXP?
(re-search-backward regexp beg t))))
-(defun Info-find-file (filename &optional noerror)
+(defun Info-find-file (filename &optional noerror no-pop-to-dir)
"Return expanded FILENAME, or t if FILENAME is \"dir\".
Optional second argument NOERROR, if t, means if file is not found
-just return nil (no error)."
+just return nil (no error).
+
+If NO-POP-TO-DIR, don't try to pop to the info buffer if we can't
+find a node."
;; Convert filename to lower case if not found as specified.
;; Expand it.
(cond
@@ -939,7 +946,8 @@ just return nil (no error)."
(if noerror
(setq filename nil)
;; If there is no previous Info file, go to the directory.
- (unless Info-current-file
+ (when (and (not no-pop-to-dir)
+ (not Info-current-file))
(Info-directory))
(user-error "Info file %s does not exist" filename)))
filename))))
@@ -1371,7 +1379,7 @@ is non-nil)."
;; Index nodes include null bytes. DIR
;; files should not have indices, but who
;; knows...
- (let ((inhibit-null-byte-detection t))
+ (let ((inhibit-nul-byte-detection t))
(insert-file-contents file)
(setq Info-dir-file-name file)
(push (current-buffer) buffers)
@@ -1525,7 +1533,7 @@ is non-nil)."
(save-restriction
(narrow-to-region start (point))
(goto-char (point-min))
- (while (re-search-forward "^* \\([^:\n]+:\\(:\\|[^.\n]+\\).\\)" nil 'move)
+ (while (re-search-forward "^\\* \\([^:\n]+:[^.\n]+.\\)" nil 'move)
;; Fold case straight away; `member-ignore-case' here wasteful.
(let ((x (downcase (match-string 1))))
(if (member x seen)
@@ -1596,7 +1604,7 @@ is non-nil)."
"Unescape double quotes and backslashes in VALUE."
(let ((start 0)
(unquote value))
- (while (string-match "[^\\\"]*\\(\\\\\\)[\\\\\"]" unquote start)
+ (while (string-match "[^\\\"]*\\(\\\\\\)[\\\"]" unquote start)
(setq unquote (replace-match "" t t unquote 1))
(setq start (- (match-end 0) 1)))
unquote))
@@ -1613,7 +1621,7 @@ escaped (\\\",\\\\)."
(let ((start 0)
(parameter-alist))
(while (string-match
- "\\s *\\([^=]+\\)=\\(?:\\([^\\s \"]+\\)\\|\\(?:\"\\(\\(?:[^\\\"]\\|\\\\[\\\\\"]\\)*\\)\"\\)\\)"
+ "\\s *\\([^=]+\\)=\\(?:\\([^\\s \"]+\\)\\|\\(?:\"\\(\\(?:[^\\\"]\\|\\\\[\\\"]\\)*\\)\"\\)\\)"
parameter-string start)
(setq start (match-end 0))
(push (cons (match-string 1 parameter-string)
@@ -1877,7 +1885,7 @@ See `completing-read' for a description of arguments and usage."
(lambda (string pred action)
(complete-with-action
action
- (Info-build-node-completions (Info-find-file file1))
+ (Info-build-node-completions (Info-find-file file1 nil t))
string pred))
nodename predicate code))))
;; Otherwise use Info-read-node-completion-table.
@@ -2022,7 +2030,7 @@ If DIRECTION is `backward', search in the reverse direction."
Info-isearch-initial-node
bound
(and found (> found opoint-min) (< found opoint-max)))
- (signal 'user-search-failed (list regexp "(end of node)")))
+ (signal 'user-search-failed (list regexp "end of node")))
;; If no subfiles, give error now.
(unless (or found Info-current-subfile)
@@ -2728,7 +2736,7 @@ Because of ambiguities, this should be concatenated with something like
(user-error "No menu in this node"))
(cond
((eq (car-safe action) 'boundaries) nil)
- ((eq action 'metadata) `(metadata (category . info-menu)))
+ ((eq action 'metadata) '(metadata (category . info-menu)))
((eq action 'lambda)
(re-search-forward
(concat "\n\\* +" (regexp-quote string) ":") nil t))
@@ -3934,8 +3942,8 @@ If FORK is a string, it is the name to use for the new buffer."
If FORK is non-nil, it is passed to `Info-goto-node'."
(let (node)
(cond
- ((setq node (Info-get-token (point) "[hf]t?tps?://"
- "\\([hf]t?tps?://[^ \t\n\"`‘({<>})’']+\\)"))
+ ((setq node (Info-get-token (point) "\\(?:f\\(?:ile\\|tp\\)\\|https?\\)://"
+ "\\(\\(?:f\\(?:ile\\|tp\\)\\|https?\\)://[^ \t\n\"`‘({<>})’']+\\)"))
(browse-url node)
(setq node t))
((setq node (Info-get-token (point) "\\*note[ \n\t]+"
@@ -4378,59 +4386,6 @@ Advanced commands:
(copy-marker (marker-position m)))
(make-marker))))))
-(define-obsolete-variable-alias 'Info-edit-map 'Info-edit-mode-map "24.1")
-(defvar Info-edit-mode-map (let ((map (make-sparse-keymap)))
- (set-keymap-parent map text-mode-map)
- (define-key map "\C-c\C-c" 'Info-cease-edit)
- map)
- "Local keymap used within `e' command of Info.")
-
-(make-obsolete-variable 'Info-edit-mode-map
- "editing Info nodes by hand is not recommended."
- "24.4")
-
-;; Info-edit mode is suitable only for specially formatted data.
-(put 'Info-edit-mode 'mode-class 'special)
-
-(define-derived-mode Info-edit-mode text-mode "Info Edit"
- "Major mode for editing the contents of an Info node.
-Like text mode with the addition of `Info-cease-edit'
-which returns to Info mode for browsing."
- (setq buffer-read-only nil)
- (force-mode-line-update)
- (buffer-enable-undo (current-buffer)))
-
-(make-obsolete 'Info-edit-mode
- "editing Info nodes by hand is not recommended." "24.4")
-
-(defun Info-edit ()
- "Edit the contents of this Info node."
- (interactive)
- (Info-edit-mode)
- (message "%s" (substitute-command-keys
- "Editing: Type \\<Info-edit-mode-map>\\[Info-cease-edit] to return to info")))
-
-(put 'Info-edit 'disabled "Editing Info nodes by hand is not recommended.
-This feature will be removed in future.")
-
-(make-obsolete 'Info-edit
- "editing Info nodes by hand is not recommended." "24.4")
-
-(defun Info-cease-edit ()
- "Finish editing Info node; switch back to Info proper."
- (interactive)
- ;; Do this first, so nothing has changed if user C-g's at query.
- (and (buffer-modified-p)
- (y-or-n-p "Save the file? ")
- (save-buffer))
- (Info-mode)
- (force-mode-line-update)
- (and (marker-position Info-tag-table-marker)
- (buffer-modified-p)
- (message "Tags may have changed. Use Info-tagify if necessary")))
-
-(make-obsolete 'Info-cease-edit
- "editing Info nodes by hand is not recommended." "24.4")
(defvar Info-file-list-for-emacs
'("ediff" "eudc" "forms" "gnus" "info" ("Info" . "info") ("mh" . "mh-e")
@@ -4741,6 +4696,17 @@ first line or header line, and for breadcrumb links.")
(put-text-property (match-beginning 1) (match-end 1)
'invisible t)))))))
+ ;; Fontify emphasis: _..._
+ (goto-char (point-min))
+ (when (and font-lock-mode not-fontified-p)
+ (while (re-search-forward "_\\(\\sw+\\)_" nil t)
+ (add-text-properties (match-beginning 0) (1+ (match-beginning 0))
+ '(invisible t front-sticky nil rear-nonsticky t))
+ (add-text-properties (1- (match-end 0)) (match-end 0)
+ '(invisible t front-sticky nil rear-nonsticky t))
+ (put-text-property (match-beginning 1) (match-end 1)
+ 'font-lock-face 'info-emphasis)))
+
;; Fontify titles
(goto-char (point-min))
(when (and font-lock-mode not-fontified-p)
@@ -4763,7 +4729,7 @@ first line or header line, and for breadcrumb links.")
;; This is a serious problem for trying to handle multiple
;; frame types at once. We want this text to be invisible
;; on frames that can display the font above.
- (when (memq (framep (selected-frame)) '(x pc w32 ns))
+ (when (display-multi-font-p)
(add-text-properties (1- (match-beginning 2)) (match-end 2)
'(invisible t front-sticky nil rear-nonsticky t))))))
@@ -5199,7 +5165,7 @@ The INDENT level is ignored."
TEXT is the text of the button we clicked on, a + or - item.
TOKEN is data related to this node (NAME . FILE).
INDENT is the current indentation depth."
- (cond ((string-match "+" text) ;we have to expand this file
+ (cond ((string-match "\\+" text) ;we have to expand this file
(speedbar-change-expand-button-char ?-)
(if (speedbar-with-writable
(save-excursion