Mercurial > emacs
comparison lisp/info.el @ 21704:e2283c4df334
(Info-fontify-node): For menu items, use info-xref font.
Use info-node font for the node's own name,
and do not make it mouse-sensitive.
(Info-find-node): Update Info-history after switching buffer.
(info): If no arg, and *info* buffer exists, just go to it and don't alter it.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 22 Apr 1998 03:19:43 +0000 |
parents | 1174b1d6cbf6 |
children | d17bf0e8a170 |
comparison
equal
deleted
inserted
replaced
21703:aea35bf72489 | 21704:e2283c4df334 |
---|---|
284 The search path for Info files is in the variable `Info-directory-list'. | 284 The search path for Info files is in the variable `Info-directory-list'. |
285 The top-level Info directory is made by combining all the files named `dir' | 285 The top-level Info directory is made by combining all the files named `dir' |
286 in all the directories in that path." | 286 in all the directories in that path." |
287 (interactive (if current-prefix-arg | 287 (interactive (if current-prefix-arg |
288 (list (read-file-name "Info file name: " nil nil t)))) | 288 (list (read-file-name "Info file name: " nil nil t)))) |
289 (pop-to-buffer "*info*") | |
290 (if file | 289 (if file |
291 (Info-goto-node (concat "(" file ")")) | 290 (progn (pop-to-buffer "*info*") |
292 (Info-directory))) | 291 (Info-goto-node (concat "(" file ")"))) |
292 (if (get-buffer "*info*") | |
293 (pop-to-buffer "*info*") | |
294 (Info-directory)))) | |
293 | 295 |
294 ;;;###autoload | 296 ;;;###autoload |
295 (defun info-standalone () | 297 (defun info-standalone () |
296 "Run Emacs as a standalone Info reader. | 298 "Run Emacs as a standalone Info reader. |
297 Usage: emacs -f info-standalone [filename] | 299 Usage: emacs -f info-standalone [filename] |
351 (setq suffix-list (cdr suffix-list)))) | 353 (setq suffix-list (cdr suffix-list)))) |
352 (setq dirs (cdr dirs))))) | 354 (setq dirs (cdr dirs))))) |
353 (if found | 355 (if found |
354 (setq filename found) | 356 (setq filename found) |
355 (error "Info file %s does not exist" filename)))) | 357 (error "Info file %s does not exist" filename)))) |
358 ;; Go into info buffer. | |
359 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) | |
360 (buffer-disable-undo (current-buffer)) | |
361 (or (eq major-mode 'Info-mode) | |
362 (Info-mode)) | |
356 ;; Record the node we are leaving. | 363 ;; Record the node we are leaving. |
357 (if (and Info-current-file (not no-going-back)) | 364 (if (and Info-current-file (not no-going-back)) |
358 (setq Info-history | 365 (setq Info-history |
359 (cons (list Info-current-file Info-current-node (point)) | 366 (cons (list Info-current-file Info-current-node (point)) |
360 Info-history))) | 367 Info-history))) |
361 ;; Go into info buffer. | |
362 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) | |
363 (buffer-disable-undo (current-buffer)) | |
364 (or (eq major-mode 'Info-mode) | |
365 (Info-mode)) | |
366 (widen) | 368 (widen) |
367 (setq Info-current-node nil) | 369 (setq Info-current-node nil) |
368 (unwind-protect | 370 (unwind-protect |
369 (progn | 371 (progn |
370 ;; Switch files if necessary | 372 ;; Switch files if necessary |
1995 | 1997 |
1996 (defun Info-fontify-node () | 1998 (defun Info-fontify-node () |
1997 (save-excursion | 1999 (save-excursion |
1998 (let ((buffer-read-only nil)) | 2000 (let ((buffer-read-only nil)) |
1999 (goto-char (point-min)) | 2001 (goto-char (point-min)) |
2000 (if (looking-at "^File: [^,: \t]+,?[ \t]+") | 2002 (when (looking-at "^File: [^,: \t]+,?[ \t]+") |
2001 (progn | 2003 (goto-char (match-end 0)) |
2002 (goto-char (match-end 0)) | 2004 (while |
2003 (while | 2005 (looking-at "[ \t]*\\([^:, \t\n]+\\):[ \t]+\\([^:,\t\n]+\\),?") |
2004 (looking-at "[ \t]*[^:, \t\n]+:[ \t]+\\([^:,\t\n]+\\),?") | 2006 (goto-char (match-end 0)) |
2005 (goto-char (match-end 0)) | 2007 (if (save-excursion |
2006 (put-text-property (match-beginning 1) (match-end 1) | 2008 (goto-char (match-beginning 1)) |
2007 'face 'info-xref) | 2009 (save-match-data (looking-at "Node:"))) |
2008 (put-text-property (match-beginning 1) (match-end 1) | 2010 (put-text-property (match-beginning 2) (match-end 2) |
2009 'mouse-face 'highlight)))) | 2011 'face 'info-node) |
2012 (put-text-property (match-beginning 2) (match-end 2) | |
2013 'face 'info-xref) | |
2014 (put-text-property (match-beginning 2) (match-end 2) | |
2015 'mouse-face 'highlight)))) | |
2010 (goto-char (point-min)) | 2016 (goto-char (point-min)) |
2011 (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\)$" | 2017 (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\)$" |
2012 nil t) | 2018 nil t) |
2013 (put-text-property (match-beginning 1) (match-end 1) | 2019 (put-text-property (match-beginning 1) (match-end 1) |
2014 'face | 2020 'face |
2038 (if (memq n '(5 9)) ; visual aids to help with 1-9 keys | 2044 (if (memq n '(5 9)) ; visual aids to help with 1-9 keys |
2039 (put-text-property (match-beginning 0) | 2045 (put-text-property (match-beginning 0) |
2040 (1+ (match-beginning 0)) | 2046 (1+ (match-beginning 0)) |
2041 'face 'info-menu-5)) | 2047 'face 'info-menu-5)) |
2042 (put-text-property (match-beginning 1) (match-end 1) | 2048 (put-text-property (match-beginning 1) (match-end 1) |
2043 'face 'info-node) | 2049 'face 'info-xref) |
2044 (put-text-property (match-beginning 1) (match-end 1) | 2050 (put-text-property (match-beginning 1) (match-end 1) |
2045 'mouse-face 'highlight)))) | 2051 'mouse-face 'highlight)))) |
2046 (set-buffer-modified-p nil)))) | 2052 (set-buffer-modified-p nil)))) |
2047 | 2053 |
2048 | 2054 |