* M-x man when cursor on top of hyphenated reference
@ 2003-06-19 2:32 Dan Jacobson
0 siblings, 0 replies; 4+ messages in thread
From: Dan Jacobson @ 2003-06-19 2:32 UTC (permalink / raw)
Man-follow-manual-reference can find maildropex even though it has a dash:
SEE ALSO
lockmail(1), maildropfilter(5), makedat(1), maildropgdbm(5), mail-
dropex(5), reformail(1), makeuserdb(1), makemime(1), reformime(1),
egrep(1), grep(1), , courier(8), sendmail(8), http://www.qmail.org.
Hovever, the m command, which usually knows what is under the cursor,
doesn't know about maildropex when on top of it
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: M-x man when cursor on top of hyphenated reference
[not found] <mailman.8212.1055996290.21513.bug-gnu-emacs@gnu.org>
@ 2003-06-19 16:29 ` Kevin Rodgers
2003-06-19 21:47 ` Dan Jacobson
[not found] ` <E19TMbx-00082O-Em@fencepost.gnu.org>
0 siblings, 2 replies; 4+ messages in thread
From: Kevin Rodgers @ 2003-06-19 16:29 UTC (permalink / raw)
Dan Jacobson wrote:
> Man-follow-manual-reference can find maildropex even though it has a dash:
> SEE ALSO
> lockmail(1), maildropfilter(5), makedat(1), maildropgdbm(5), mail-
> dropex(5), reformail(1), makeuserdb(1), makemime(1), reformime(1),
> egrep(1), grep(1), , courier(8), sendmail(8), http://www.qmail.org.
>
> 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:
(defadvice Man-default-man-entry (after hyphenated activate)
"Handle hypenated manual references."
(if (string-match (format "-\\((%s)\\)?\\'" Man-section-regexp)
ad-return-value)
(save-excursion
(forward-line 1)
(setq ad-return-value (Man-default-man-entry)))
(let ((prefix (Man-possibly-hyphenated-word)))
(if (string-match "-\\'" prefix)
(setq ad-return-value
(concat (substring prefix 0 (match-beginning 0))
ad-return-value))))))
--
<a href="mailto:<kevin.rodgers@ihs.com>">Kevin Rodgers</a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: M-x man when cursor on top of hyphenated reference
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>
1 sibling, 0 replies; 4+ messages in thread
From: Dan Jacobson @ 2003-06-19 21:47 UTC (permalink / raw)
K> Here's a hack for you to try. If it works, I can try to implement
K> it as a proper patch to man.el
What I do is trust that it will be taken care of by somebody now that
you have noticed it, hold off all my M-x man complaints for about a
year, by which time it might be on my debian apt-zip CD, and then
resume complaining afresh about anything I still encounter.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: M-x man when cursor on top of hyphenated reference
[not found] ` <E19TMbx-00082O-Em@fencepost.gnu.org>
@ 2003-06-23 18:34 ` Kevin Rodgers
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2003-06-23 18:34 UTC (permalink / raw)
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-06-23 18:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
2003-06-19 2:32 Dan Jacobson
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.