From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.bugs Subject: Suggestion to integrating emacs man pages with imenu. Date: Tue, 14 Oct 2003 15:11:18 -0700 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1066171863 13723 80.91.224.253 (14 Oct 2003 22:51:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 14 Oct 2003 22:51:03 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 15 00:51:01 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A9Y0L-0006Oe-00 for ; Wed, 15 Oct 2003 00:51:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1A9Xzb-0005PF-65 for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Oct 2003 18:50:15 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1A9XoA-0002Db-CI for bug-gnu-emacs@gnu.org; Tue, 14 Oct 2003 18:38:26 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1A9XhE-0003JJ-6w for bug-gnu-emacs@gnu.org; Tue, 14 Oct 2003 18:31:47 -0400 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1A9XdP-0007Qd-ST for bug-gnu-emacs@gnu.org; Tue, 14 Oct 2003 18:27:19 -0400 Original-Received: from [158.114.112.189] (helo=resva-xbh03.info.trw.com) by mx20.gnu.org with esmtp (Exim 4.24) id 1A9XO0-0004bF-A0 for bug-gnu-emacs@gnu.org; Tue, 14 Oct 2003 18:11:24 -0400 Original-Received: from resva-xbh03.info.trw.com ([158.114.112.189]) by resva-xbh03.info.trw.com with Microsoft SMTPSVC(5.0.2195.5329); Tue, 14 Oct 2003 18:11:20 -0400 Original-Received: from resva-xbh01.info.trw.com ([158.114.112.164]) by resva-xbh03.info.trw.com (SAVSMTP 3.0.0.44) with SMTP id M2003101418112023063 for ; Tue, 14 Oct 2003 18:11:20 -0400 Original-Received: from mclca-xbh01.info.trw.com ([158.114.80.92]) by resva-xbh01.info.trw.com with Microsoft SMTPSVC(5.0.2195.5329); Tue, 14 Oct 2003 18:11:20 -0400 Original-Received: from mclca-xmb01.info.trw.com ([158.114.80.93]) by mclca-xbh01.info.trw.com with Microsoft SMTPSVC(5.0.2195.5329); Tue, 14 Oct 2003 15:11:18 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 Content-Class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Suggestion to integrating emacs man pages with imenu. thread-index: AcOSoBexTSK5u3xfRdeefhadNKIe5Q== Original-To: X-OriginalArrivalTime: 14 Oct 2003 22:11:18.0893 (UTC) FILETIME=[17D789D0:01C392A0] X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:5977 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:5977 I like to use imenu to jump around the man page so I have a small man-page-hook that adds the needed call-backs for imenu.el to work. Also not sure if I'm handling buffer-read-only correctly. It could be incorporated directly into man.el at the appropriate place. I think just after the call to run-hooks. (defun Man-prev-index-position () "Search for the previous procedure or function. Return nil if not found. For use with imenu.el." (save-match-data (cond ((re-search-backward Man-heading-regexp -1 t)) (t nil)))) (defun Man-section-name () "Return the section name. Assumes that point is at the beginning of the section as found by `Man-heading-regexp'." (let ((begin (point))) (end-of-line 1) (downcase=20 (if (fboundp 'buffer-substring-no-properties) (buffer-substring-no-properties begin (point)) (buffer-substring begin (point)))))) (defun Man-mode-hook() (save-excursion (widen) (setq buffer-read-only nil) (goto-char (point-min)) ;;bold the section headings. ;; My man program doesn't seem to overstrike the section heads ;; so they don't come out build when man page is done. ;; This will force them to be bold. (while (re-search-forward Man-heading-regexp (point-max) t) (progn (put-text-property (point) (progn=20 (beginning-of-line 1) (point)) 'face Man-overstrike-face) (beginning-of-line 2))) (setq buffer-read-only t)) ;; Arrange for imenu to work by indexing the section heads. (set (make-local-variable 'imenu-prev-index-position-function) 'Man-prev-index-position) (set (make-local-variable 'imenu-extract-index-name-function) 'Man-section-name) ) =20 (add-hook 'Man-mode-hook 'Man-mode-hook) -John Basrai Software Engineer John.Basrai@ngc.com =20