home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.lucid-emacs.help
- Path: sparky!uunet!fornax!bremner
- From: bremner@cs.sfu.ca (David Bremner)
- Subject: patch for info-dg.el
- Message-ID: <1992Jul27.224215.17785@cs.sfu.ca>
- Summary: works for me.
- Keywords: quick and dirty
- Reply-To: bremner@cs.sfu.ca (David Bremner)
- Organization: CSS, Simon Fraser University, Burnaby, B.C., Canada
- Date: Mon, 27 Jul 1992 22:42:15 GMT
- Lines: 226
-
-
- What follows is my quick and dirty mashing together of Dave Gillespie's
- enhanced info mode, and the font and mouse stuff from lemacs 19.2.
-
- Some day when I have time I'll go through and clean it up so that
- it works under both lucid and other gnu emacses.
-
- In the mean time, here it is.
-
- It is, in all senses of the word a derivative work, and I assert no
- additional copyright on MY twelve keystrokes :-)
-
- Cheers,
-
- David.
-
- P.S. I may take a few weeks to respond to bug reports.
- P.P.S. info-dg.el is available from
-
- info-dg (1.05) 92-03-08
- Dave Gillespie, <daveg@synaptics.com>
- archive.cis.ohio-state.edu:/pub/gnu/emacs/elisp-archive/modes/info.el.Z
- Info reader with many enhancements; replaces standard info.el.
-
- ---------------------------cut here-----------------------------------
- *** info-dg.orig Mon Jul 27 15:22:52 1992
- --- info-dg.el Fri Jul 24 11:06:08 1992
- ***************
- *** 529,535 ****
- (setq thisfilepos (read (current-buffer)))
- ;; read in version 19 stops at the end of number.
- ;; Advance to the next line.
- ! ;; (forward-line 1)
- (if (> thisfilepos nodepos)
- (throw 'foo t))
- (setq lastfilename thisfilename)
- --- 529,535 ----
- (setq thisfilepos (read (current-buffer)))
- ;; read in version 19 stops at the end of number.
- ;; Advance to the next line.
- ! (forward-line 1)
- (if (> thisfilepos nodepos)
- (throw 'foo t))
- (setq lastfilename thisfilename)
- ***************
- *** 1906,1910 ****
- --- 1906,2082 ----
- (message "Tags may have changed. Use Info-tagify if necessary")))
-
- (run-hooks 'Info-load-hook)
- +
- + ;;; fontification and mousability for info
- + ;;; Copied from the Lucid Emacs 19.2 distribution
- + ;;; July 15, 1992
- +
- + ;; Turn off Dave Gillespie's mouse support
- + (setq Info-mouse-support nil)
- +
- + ;; Fontify the nodes
- + (setq Info-select-hook 'Info-fontify-node)
- +
- + ;; Bind the mouse buttons
- + (define-key Info-mode-map 'button2 'Info-follow-indicated-node)
- + (define-key Info-mode-map 'button3 'Info-select-node-menu)
- +
- + (defvar Info-fontify t)
- +
- + (defvar Info-footnote-tag "Note"
- + "If we are loading this file on top of something that does not define
- + Info-footnote-tag, set to the default")
- +
- + ;; This should really quote Info-footnote-tag in case someone sets it to a
- + ;; regexp
- +
- + (defvar Info-xref-regexp (concat "\\*"
- + (regexp-quote Info-footnote-tag)
- + "[ \n\t]*\\([^:]*\\):"))
- +
- + (or (find-face 'info-node) (make-face 'info-node))
- + (or (find-face 'info-xref) (make-face 'info-xref))
- +
- + (if purify-flag ; being preloaded
- + nil
- + (or (face-differs-from-default-p 'info-node (selected-screen))
- + (copy-face 'bold-italic 'info-node (selected-screen)))
- + (or (face-differs-from-default-p 'info-xref (selected-screen))
- + (copy-face 'bold 'info-xref (selected-screen))))
- +
- +
- + (defun Info-fontify-node ()
- + (if Info-fontify
- + (save-excursion
- + (map-extents (function (lambda (x y) (delete-extent x)))
- + (current-buffer) (point-min) (point-max) nil)
- + (let ((case-fold-search t)
- + extent)
- + (goto-char (point-min))
- + (if (looking-at "^File: [^,: \t]+,?[ \t]+")
- + (progn
- + (goto-char (match-end 0))
- + (while
- + (looking-at "[ \t]*[^:, \t\n]+:[ \t]+\\([^:,\t\n]+\\),?")
- + (goto-char (match-end 0))
- + (setq extent (make-extent (match-beginning 1) (match-end 1)))
- + (set-extent-face extent 'info-xref)
- + (set-extent-attribute extent 'highlight))))
- + (goto-char (point-min))
- + (while (re-search-forward Info-xref-regexp nil t)
- + (if (= (char-after (1- (match-beginning 0))) ?\") ; hack
- + nil
- + (setq extent (make-extent (match-beginning 0) (match-end 1)))
- + (set-extent-face extent 'info-xref)
- + (set-extent-attribute extent 'highlight)))
- + (goto-char (point-min))
- + (if (search-forward "\n* menu:" nil t)
- + (while (re-search-forward "^\\* \\([^:\t\n]*\\):" nil t)
- + (setq extent (make-extent (match-beginning 0) (match-end 1)))
- + (set-extent-face extent 'info-node)
- + (set-extent-attribute extent 'highlight)))))))
- +
- + (defun Info-indicated-node (event)
- + (save-window-excursion
- + (save-excursion
- + (mouse-set-point event)
- + (let* ((buffer (window-buffer (event-window event)))
- + (p (event-point event))
- + (extent (and p (extent-at p buffer 'highlight)))
- + (text (and extent
- + (save-excursion
- + (set-buffer buffer)
- + (buffer-substring
- + (extent-start-position extent)
- + (extent-end-position extent)))))
- + (case-fold-search t)
- + i)
- + (cond ((null extent)
- + nil)
- + ((string-match (concat "\\`" Info-xref-regexp "?\\'") text)
- + ;; it's a cross-reference
- + (setq text (substring text (match-beginning 1) (match-end 1)))
- + (while (setq i (string-match "[ \n\t]+" text i))
- + (setq text (concat (substring text 0 i) " "
- + (substring text (match-end 0))))
- + (setq i (1+ i)))
- + (list 'Info-follow-reference text))
- + ((and (save-excursion (goto-char (extent-start-position extent))
- + (= ?\n (preceding-char)))
- + (string-match "\\`\\* \\([^:\t\n]+\\):?\\'" text))
- + ;; it's a menu entry
- + (setq text (substring text (match-beginning 1) (match-end 1)))
- + (list 'Info-menu text))
- + (t
- + ;; otherwise, it must be a node-name in the first line
- + (list 'Info-goto-node text)))))))
- +
- +
- + (defun Info-follow-indicated-node (event)
- + "Follow the crossreference or menu item at the click-location."
- + (interactive "e")
- + (mouse-set-point event)
- + (eval (or (Info-indicated-node event)
- + (error "click on a cross-reference to follow"))))
- +
- +
- + (defun Info-select-node-menu (event)
- + "Pops up a menu of applicable Info commands."
- + (interactive "e")
- + (select-window (event-window event))
- + (let ((case-fold-search t)
- + up-p prev-p next-p menu
- + i text xrefs subnodes in)
- + (save-excursion
- + (goto-char (point-min))
- + (if (looking-at ".*\\bNext:") (setq next-p t))
- + (if (looking-at ".*\\bPrev:") (setq prev-p t))
- + (if (looking-at ".*Up:") (setq up-p t))
- + (setq menu (nconc (list "" "Info Commands:" "----")
- + (if (setq in (Info-indicated-node event))
- + (list (vector (car (cdr in)) in t)))
- + (list
- + ["Goto Info Top-level" Info-directory t]
- + (vector "Next Node" 'Info-next next-p)
- + (vector "Previous Node" 'Info-prev prev-p)
- + (vector "Parent Node (Up)" 'Info-up up-p)
- + ["Goto Node..." Info-goto-node t]
- + ["Goto Last Visited Node" Info-last t])))
- + (while (re-search-forward Info-xref-regexp nil t)
- + (setq text (buffer-substring (match-beginning 1) (match-end 1)))
- + (while (setq i (string-match "[ \n\t]+" text i))
- + (setq text (concat (substring text 0 i) " "
- + (substring text (match-end 0))))
- + (setq i (1+ i)))
- + (setq xrefs (cons text xrefs)))
- + (setq xrefs (nreverse xrefs))
- + (if (> (length xrefs) 21) (setcdr (nthcdr 20 xrefs) '(more)))
- + (goto-char (point-min))
- + (if (search-forward "\n* menu:" nil t)
- + (while (re-search-forward "^\\* \\([^:\t\n]*\\):" nil t)
- + (setq text (buffer-substring (match-beginning 1) (match-end 1)))
- + (setq subnodes (cons text subnodes))))
- + (setq subnodes (nreverse subnodes))
- + (if (> (length subnodes) 21) (setcdr (nthcdr 20 subnodes) '(more)))
- + )
- + (if xrefs
- + (nconc menu (list "----" "Cross-References:" "----")
- + (mapcar (function (lambda (xref)
- + (if (eq xref 'more)
- + "...more..."
- + (vector xref
- + (list 'Info-follow-reference xref)
- + t))))
- + xrefs)))
- + (if subnodes
- + (nconc menu (list "----" "Sub-Nodes:" "----")
- + (mapcar (function (lambda (node)
- + (if (eq node 'more)
- + "...more..."
- + (vector node (list 'Info-menu node)
- + t))))
- + subnodes)))
- + (popup-menu menu)))
- +
-
- ;;; End.
- --
- bremner@cs.sfu.ca ubc-cs!fornax!bremner
-