From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: M-x man when cursor on top of hyphenated reference
Date: Mon, 23 Jun 2003 12:34:08 -0600 [thread overview]
Message-ID: <16119.18464.198053.508842@ihs.com> (raw)
In-Reply-To: <E19TMbx-00082O-Em@fencepost.gnu.org>
Richard Stallman writes:
> > Hovever, the m command, which usually knows what is under the cursor,
> > doesn't know about maildropex when on top of it
>
> Here's a hack for you to try. If it works, I can try to implement it as
> a proper patch to man.el:
>
> If you would like to do that, please do.
This also does a slightly better job with simple references like cat(1),
which currently doesn't include the "(1)" in the return value if point
is between the command name and the parenthesized section number.
2003-06-23 Kevin Rodgers <ihs_4664@yahoo.com>
* man.el (Man-default-man-entry): Handle hypenated references
via a recursive call (flagged by new optional HYPHENATED arg)
or a check by Man-possibly-hyphenated-word.
*** emacs-21.3/lisp/man.el.orig Fri Oct 18 19:21:09 2002
--- emacs-21.3/lisp/man.el Mon Jun 23 11:58:58 2003
***************
*** 499,524 ****
;; ======================================================================
;; default man entry: get word under point
! (defsubst Man-default-man-entry ()
"Make a guess at a default manual entry.
This guess is based on the text surrounding the cursor."
! (let (word)
(save-excursion
! ;; Default man entry title is any word the cursor is on, or if
! ;; cursor not on a word, then nearest preceding word.
! (setq word (current-word))
! (if (string-match "[._]+$" word)
! (setq word (substring word 0 (match-beginning 0))))
;; If looking at something like ioctl(2) or brc(1M), include the
! ;; section number in the returned value. Remove text properties.
! (forward-word 1)
! ;; Use `format' here to clear any text props from `word'.
! (format "%s%s"
! word
! (if (looking-at
! (concat "[ \t]*([ \t]*\\(" Man-section-regexp "\\)[ \t]*)"))
! (format "(%s)" (Man-match-substring 1))
! "")))))
\f
;; ======================================================================
--- 499,534 ----
;; ======================================================================
;; default man entry: get word under point
! (defsubst Man-default-man-entry (&optional hyphenated)
"Make a guess at a default manual entry.
! This guess is based on the text surrounding point."
! (let ((word (current-word))) ; matches \(\sw\|\s_\)+
! ;; Default man entry title is any word the cursor is on, or if
! ;; cursor not on a word, then nearest preceding word.
! (if (string-match "[._]+\\'" word)
! (setq word (substring word 0 (match-beginning 0))))
(save-excursion
! (or hyphenated ; i.e. recursive call
! (if (string-match "-\\'" word)
! ;; word is the prefix of a hyphenated entry:
! (setq word (concat (substring word 0 (match-beginning 0))
! (progn
! (forward-line 1)
! (Man-default-man-entry t))))
! (let ((prefix (Man-possibly-hyphenated-word)))
! (if (string-match "-\\'" prefix)
! ;; word is the suffix of a hyphenated entry:
! (setq word (concat (substring prefix 0 (match-beginning 0))
! word))))))
;; If looking at something like ioctl(2) or brc(1M), include the
! ;; section number in the returned value.
! (if (looking-at (format "%s\\(\\sw\\|\\s_\\)*[ \t]*([ \t]*\\(%s\\)[ \t]*)"
! (if hyphenated
! ""
! "[ \t]*")
! Man-section-regexp))
! (format "%s(%s)" word (match-string 2))
! word))))
\f
;; ======================================================================
--
<a href="mailto:<kevin.rodgers@ihs.com>">Kevin Rodgers</a>
next prev parent reply other threads:[~2003-06-23 18:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.8212.1055996290.21513.bug-gnu-emacs@gnu.org>
2003-06-19 16:29 ` M-x man when cursor on top of hyphenated reference Kevin Rodgers
2003-06-19 21:47 ` Dan Jacobson
[not found] ` <E19TMbx-00082O-Em@fencepost.gnu.org>
2003-06-23 18:34 ` Kevin Rodgers [this message]
2003-06-19 2:32 Dan Jacobson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16119.18464.198053.508842@ihs.com \
--to=ihs_4664@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).