+2006-02-17 Juri Linkov <juri@jurta.org>
+
+ * info.el (Info-find-file): Check for symbols `apropos', `history',
+ `toc' in the input filename, and return these symbols as is.
+ (Info-find-node-2): Set Info-current-file to symbols `apropos',
+ `history', `toc' instead of strings.
+ (Info-set-mode-line): For non-string Info-current-file use the
+ symbol's name inside **.
+ (Info-isearch-push-state): Add quote before Info-current-file and
+ Info-current-node.
+ (Info-isearch-pop-state): Use `equal' instead of `string='.
+ (Info-extract-pointer, Info-following-node-name): Use
+ `match-string-no-properties' instead of `match-string'.
+ (Info-up): Check `old-file' for `stringp'.
+ (Info-history): Use `equal' instead of `string-equal'.
+ Check `file' for `stringp'.
+ (Info-history): Use symbol `history' instead of string as first arg
+ of `Info-find-node'.
+ (Info-toc): Check `Info-current-file' for `stringp'. Use symbol
+ `toc' instead of string.
+ (Info-extract-menu-node-name): Use `buffer-substring-no-properties'
+ instead of `buffer-substring', and `match-string-no-properties'
+ instead of `match-string'.
+ (Info-index-nodes): Check for symbols `apropos', `history', `toc'
+ instead of strings.
+ (info-apropos): Use `Info-find-node' instead of `Info-goto-node'.
+ Use symbol `apropos' instead of string.
+ (Info-copy-current-node-name): Check `Info-current-file' for
+ `stringp' and construct a command with `Info-find-node' from it.
+ (Info-fontify-node): Use `match-string-no-properties' instead of
+ `match-string' and check file names for `stringp'.
+ (Info-desktop-buffer-misc-data): Check for symbols `apropos',
+ `history', `toc' instead of strings.
+
2006-02-17 Chong Yidong <cyd@stupidchicken.com>
* files.el: Rearrange functions and variables in the file local
(cond
((string= (downcase filename) "dir")
(setq found t))
- ((string= filename "apropos")
- (setq found 'apropos))
- ((string= filename "history")
- (setq found 'history))
- ((string= filename "toc")
- (setq found 'toc))
(t
(let ((dirs (if (string-match "^\\./" filename)
;; If specified name starts with `./'
(if noerror
(setq filename nil)
(error "Info file %s does not exist" filename)))
- filename)))
+ filename)
+ (and (member filename '(apropos history toc)) filename)))
(defun Info-find-node (filename nodename &optional no-going-back)
"Go to an Info node specified as separate FILENAME and NODENAME.
(setq Info-current-file
(cond
((eq filename t) "dir")
- ((eq filename 'apropos) "apropos")
- ((eq filename 'history) "history")
- ((eq filename 'toc) "toc")
(t filename)))
))
;; Use string-equal, not equal, to ignore text props.
(if (stringp Info-current-file)
(replace-regexp-in-string
"%" "%%" (file-name-nondirectory Info-current-file))
- "")
+ (format "*%S*" Info-current-file))
") "
(if Info-current-node
(propertize (replace-regexp-in-string
(defun Info-isearch-push-state ()
`(lambda (cmd)
- (Info-isearch-pop-state cmd ,Info-current-file ,Info-current-node)))
+ (Info-isearch-pop-state cmd ',Info-current-file ',Info-current-node)))
(defun Info-isearch-pop-state (cmd file node)
- (or (and (string= Info-current-file file)
- (string= Info-current-node node))
+ (or (and (equal Info-current-file file)
+ (equal Info-current-node node))
(progn (Info-find-node file node) (sit-for 0))))
(defun Info-isearch-start ()
(forward-line 1)
(cond ((re-search-backward
(concat name ":" (Info-following-node-name-re)) bound t)
- (match-string 1))
+ (match-string-no-properties 1))
((not (eq errorname t))
(error "Node has no %s"
(capitalize (or errorname name)))))))))
;;; For compatibility; other files have used this name.
(defun Info-following-node-name ()
(and (looking-at (Info-following-node-name-re))
- (match-string 1)))
+ (match-string-no-properties 1)))
(defun Info-next ()
"Go to the next node of this node."
(Info-goto-node node)
(setq p (point))
(goto-char (point-min))
- (if (and (search-forward "\n* Menu:" nil t)
+ (if (and (stringp old-file)
+ (search-forward "\n* Menu:" nil t)
(re-search-forward
(if (string-equal old-node "Top")
(concat "\n\\*[^:]+: +(" (file-name-nondirectory old-file) ")")
(while hl
(let ((file (nth 0 (car hl)))
(node (nth 1 (car hl))))
- (if (and (string-equal file curr-file)
- (string-equal node curr-node))
+ (if (and (equal file curr-file)
+ (equal node curr-node))
(setq p (point)))
- (insert "* " node ": ("
- (propertize (or (file-name-directory file) "") 'invisible t)
- (file-name-nondirectory file)
- ")" node ".\n"))
+ (if (stringp file)
+ (insert "* " node ": ("
+ (propertize (or (file-name-directory file) "") 'invisible t)
+ (file-name-nondirectory file)
+ ")" node ".\n")))
(setq hl (cdr hl))))))
- (Info-find-node "history" "Top")
+ (Info-find-node 'history "Top")
(goto-char (or p (point-min)))))
(defun Info-toc ()
"Go to a node with table of contents of the current Info file.
Table of contents is created from the tree structure of menus."
(interactive)
- (let ((curr-file (substring-no-properties Info-current-file))
- (curr-node (substring-no-properties Info-current-node))
- p)
- (with-current-buffer (get-buffer-create " *info-toc*")
- (let ((inhibit-read-only t)
- (node-list (Info-build-toc curr-file)))
- (erase-buffer)
- (goto-char (point-min))
- (insert "\n\^_\nFile: toc, Node: Top, Up: (dir)\n\n")
- (insert "Table of Contents\n*****************\n\n")
- (insert "*Note Top: (" curr-file ")Top.\n")
- (Info-insert-toc
- (nth 2 (assoc "Top" node-list)) ; get Top nodes
- node-list 0 curr-file))
- (if (not (bobp))
- (let ((Info-hide-note-references 'hide)
- (Info-fontify-visited-nodes nil))
- (Info-mode)
- (setq Info-current-file "toc" Info-current-node "Top")
- (goto-char (point-min))
- (narrow-to-region (or (re-search-forward "\n[\^_\f]\n" nil t)
- (point-min))
- (point-max))
- (Info-fontify-node)
- (widen)))
- (goto-char (point-min))
- (if (setq p (search-forward (concat "*Note " curr-node ":") nil t))
- (setq p (- p (length curr-node) 2))))
- (Info-find-node "toc" "Top")
- (goto-char (or p (point-min)))))
+ (if (stringp Info-current-file)
+ (let ((curr-file (substring-no-properties Info-current-file))
+ (curr-node (substring-no-properties Info-current-node))
+ p)
+ (with-current-buffer (get-buffer-create " *info-toc*")
+ (let ((inhibit-read-only t)
+ (node-list (Info-build-toc curr-file)))
+ (erase-buffer)
+ (goto-char (point-min))
+ (insert "\n\^_\nFile: toc, Node: Top, Up: (dir)\n\n")
+ (insert "Table of Contents\n*****************\n\n")
+ (insert "*Note Top: (" curr-file ")Top.\n")
+ (Info-insert-toc
+ (nth 2 (assoc "Top" node-list)) ; get Top nodes
+ node-list 0 curr-file))
+ (if (not (bobp))
+ (let ((Info-hide-note-references 'hide)
+ (Info-fontify-visited-nodes nil))
+ (Info-mode)
+ (setq Info-current-file 'toc Info-current-node "Top")
+ (goto-char (point-min))
+ (narrow-to-region (or (re-search-forward "\n[\^_\f]\n" nil t)
+ (point-min))
+ (point-max))
+ (Info-fontify-node)
+ (widen)))
+ (goto-char (point-min))
+ (if (setq p (search-forward (concat "*Note " curr-node ":") nil t))
+ (setq p (- p (length curr-node) 2))))
+ (Info-find-node 'toc "Top")
+ (goto-char (or p (point-min))))))
(defun Info-insert-toc (nodes node-list level curr-file)
"Insert table of contents with references to nodes."
(setq Info-point-loc
(if (match-beginning 5)
(string-to-number (match-string 5))
- (buffer-substring (match-beginning 0) (1- (match-beginning 1)))))
+ (buffer-substring-no-properties
+ (match-beginning 0) (1- (match-beginning 1)))))
;;; Uncomment next line to use names of cross-references in non-index nodes:
;;; (setq Info-point-loc
;;; (buffer-substring (match-beginning 0) (1- (match-beginning 1))))
)
(replace-regexp-in-string
"[ \n]+" " "
- (or (match-string 2)
+ (or (match-string-no-properties 2)
;; If the node name is the menu entry name (using `entry::').
- (buffer-substring (match-beginning 0) (1- (match-beginning 1)))))))
+ (buffer-substring-no-properties
+ (match-beginning 0) (1- (match-beginning 1)))))))
;; No one calls this.
;;(defun Info-menu-item-sequence (list)
(or file (setq file Info-current-file))
(or (assoc file Info-index-nodes)
;; Skip virtual Info files
- (and (member file '("dir" "history" "toc" "apropos"))
+ (and (member file '("dir" apropos history toc))
(setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
(not (stringp file))
(if Info-file-supports-index-cookies
(message "%s" (if (eq (car-safe err) 'error)
(nth 1 err) err))
(sit-for 1 t)))))
- (Info-goto-node (concat "(" current-file ")" current-node))
+ (Info-find-node current-file current-node)
(setq Info-history ohist
Info-history-list ohist-list)
(message "Searching indices...done")
(if (nth 3 entry)
(concat " (line " (nth 3 entry) ")")
"")))))
- (Info-find-node "apropos" "Index")
+ (Info-find-node 'apropos "Index")
(setq Info-complete-cache nil)))))
(defun Info-undefined ()
(interactive "P")
(unless Info-current-node
(error "No current Info node"))
- (let ((node (concat "(" (file-name-nondirectory Info-current-file) ")"
- Info-current-node)))
+ (let ((node (if (stringp Info-current-file)
+ (concat "(" (file-name-nondirectory Info-current-file) ")"
+ Info-current-node))))
(if (zerop (prefix-numeric-value arg))
(setq node (concat "(info \"" node "\")")))
+ (unless (stringp Info-current-file)
+ (setq node (format "(Info-find-node '%S '%S)"
+ Info-current-file Info-current-node)))
(kill-new node)
(message "%s" node)))
"^[ \t]+" ""
(replace-regexp-in-string
"[ \t\n]+" " "
- (or (match-string 5)
+ (or (match-string-no-properties 5)
(and (not (equal (match-string 4) ""))
- (match-string 4))
- (match-string 2)))))
+ (match-string-no-properties 4))
+ (match-string-no-properties 2)))))
(external-link-p
(string-match "(\\([^)]+\\))\\([^)]*\\)" node))
(file (if external-link-p
(file-name-nondirectory
- (match-string 1 node))
+ (match-string-no-properties 1 node))
Info-current-file))
(hl Info-history-list)
res)
(if external-link-p
(setq node (if (equal (match-string 2 node) "")
"Top"
- (match-string 2 node))))
+ (match-string-no-properties 2 node))))
(while hl
(if (and (string-equal node (nth 1 (car hl)))
- (string-equal
- file (if external-link-p
- (file-name-nondirectory
- (caar hl))
- (caar hl))))
+ (equal file
+ (if (and external-link-p
+ (stringp (caar hl)))
+ (file-name-nondirectory
+ (caar hl))
+ (caar hl))))
(setq res (car hl) hl nil)
(setq hl (cdr hl))))
res))) 'info-xref-visited 'info-xref))
(if (and Info-fontify-visited-nodes
(save-match-data
(let* ((node (if (equal (match-string 3) "")
- (match-string 1)
- (match-string 3)))
+ (match-string-no-properties 1)
+ (match-string-no-properties 3)))
(external-link-p
(string-match "(\\([^)]+\\))\\([^)]*\\)" node))
(file (if external-link-p
(file-name-nondirectory
- (match-string 1 node))
+ (match-string-no-properties 1 node))
Info-current-file))
(hl Info-history-list)
res)
(if external-link-p
(setq node (if (equal (match-string 2 node) "")
"Top"
- (match-string 2 node))))
+ (match-string-no-properties 2 node))))
(while hl
(if (and (string-equal node (nth 1 (car hl)))
- (string-equal
- file (if external-link-p
- (file-name-nondirectory (caar hl))
- (caar hl))))
+ (equal file
+ (if (and external-link-p
+ (stringp (caar hl)))
+ (file-name-nondirectory
+ (caar hl))
+ (caar hl))))
(setq res (car hl) hl nil)
(setq hl (cdr hl))))
res))) 'info-xref-visited 'info-xref)))
(defun Info-desktop-buffer-misc-data (desktop-dirname)
"Auxiliary information to be saved in desktop file."
- (if (not (member Info-current-file '("apropos" "history" "toc")))
- (list Info-current-file Info-current-node)))
+ (unless (member Info-current-file '(apropos history toc nil))
+ (list Info-current-file Info-current-node)))
(defun Info-restore-desktop-buffer (desktop-buffer-file-name
desktop-buffer-name