bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] Re: M-x man can't tell I mean the same man page


From: Jari Aalto+mail.emacs
Subject: [patch] Re: M-x man can't tell I mean the same man page
Date: Thu, 26 Jun 2003 22:05:53 +0300
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/20.7 (windows-nt) (i386-*-nt5.0.2195)

* Sun 2003-06-15 Dan Jacobson <jidanni@jidanni.org> gnu.emacs.bug
* 
<http://search.dejanews.com/msgid.xp?MID=%3Cmailman.7909.1055636597.21513.bug-gnu-emacs@gnu.org%3E&format=threaded>
> Look at all the buffers I have today
> % *Man FORMAIL *   16922
> % *Man formail *   16922
> % *Man 1 formail*  16922
> % *Man formail*    16922
> Well, at least M-x man could first strip blanks so if I input
> "formail " it will not go and create a new buffer.

Here is partial fix for this syndrome. If someone could comment:

- Is it allowed to downcase the "FORMAIL" lowercase as well? 
- Howabout removing section number if it's only "1"?

If those are allowed, they should be integrated as well.
Jari


2003-06-26 Thu  Jari Aalto  <jari.aalto@poboxes.com>

        * man.el (Man-translate-cleanup): New.
        (Man-translate-references): Call `Man-translate-cleanup' to clean
        leading, trailing and middle spaces.




Index: man.el
===================================================================
RCS file: 
/cygdrive/h/data/version-control/cvsroot/emacs/gnu-emacs/lisp213/man.el,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -IId: -b -w -c -r1.1.1.1 -r1.2
cvs diff: conflicting specifications of output style
*** man.el      26 Jun 2003 18:06:12 -0000      1.1.1.1
--- man.el      26 Jun 2003 19:02:11 -0000      1.2
***************
*** 460,465 ****
--- 460,477 ----
          (setq flist (cdr flist))))
      command))
  
+ 
+ (defun Man-translate-cleanup (string)
+   "Strip leading, trailing and middle spaces."
+   (when (stringp string)
+     ;;  Strip leading and trailing
+     (if (string-match "^[ \t\f\r\n]*\\(.+[^ \t\f\r\n]\\)" string)
+         (setq string (match-string 1 string)))
+     ;; middle spaces
+     (setq string (replace-regexp-in-string "[\t\r\n]" " " string))
+     (setq string (replace-regexp-in-string "  +" " " string))
+     string))
+ 
  (defun Man-translate-references (ref)
    "Translates REF from \"chmod(2V)\" to \"2v chmod\" style.
  Leave it as is if already in that style.  Possibly downcase and
***************
*** 468,473 ****
--- 480,486 ----
    (let ((name "")
          (section "")
          (slist Man-section-translations-alist))
+     (setq ref (Man-translate-cleanup ref))
      (cond
       ;; "chmod(2V)" case ?
       ((string-match (concat "^" Man-reference-regexp "$") ref)
***************
*** 528,533 ****
--- 541,547 ----
  ;;;###autoload
  (defalias 'manual-entry 'man)
  
+ 
  ;;;###autoload
  (defun man (man-args)
    "Get a Un*x manual page and put it in a buffer.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]