From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: jari.aalto@poboxes.com (Jari Aalto+mail.emacs) Newsgroups: gmane.emacs.bugs Subject: [patch] Re: M-x man can't tell I mean the same man page Date: Thu, 26 Jun 2003 22:05:53 +0300 Organization: Elisa Internet customer Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1056655559 13108 80.91.224.249 (26 Jun 2003 19:25:59 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 26 Jun 2003 19:25:59 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 26 21:25:56 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19VcNY-0003P0-00 for ; Thu, 26 Jun 2003 21:25:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19VcIV-0004hO-Mc for gnu-bug-gnu-emacs@m.gmane.org; Thu, 26 Jun 2003 15:20:43 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19VcHw-0004Xx-OB for bug-gnu-emacs@prep.ai.mit.edu; Thu, 26 Jun 2003 15:20:08 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19Vc7F-0001wa-7g for bug-gnu-emacs@prep.ai.mit.edu; Thu, 26 Jun 2003 15:09:06 -0400 Original-Received: from mailbox.ucsd.edu ([132.239.1.56] helo=mailbox4.ucsd.edu) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Vc0S-0000Jk-Rz for bug-gnu-emacs@prep.ai.mit.edu; Thu, 26 Jun 2003 15:02:05 -0400 Original-Received: from smtp32.kolumbus.fi (smtp32.kolumbus.fi [193.229.0.37]) by mailbox4.ucsd.edu (8.12.9/8.12.3) with ESMTP id h5QJ1tim092974 for ; Thu, 26 Jun 2003 12:01:56 -0700 (PDT) Original-Received: from news.kolumbus.fi (news.kolumbus.fi [193.229.0.31]) by smtp32.kolumbus.fi (8.12.9/8.12.4) with ESMTP id h5QJ1qCR026568 for ; Thu, 26 Jun 2003 22:01:52 +0300 (EEST) Original-Received: (from news@localhost) by news.kolumbus.fi (8.11.6+Sun/8.11.6) id h5QJ1pT02194 for gnu-emacs-bug@moderators.isc.org; Thu, 26 Jun 2003 22:01:51 +0300 (EEST) Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 78 Original-NNTP-Posting-Host: a6t5.elisa.omakaista.fi Original-X-Trace: phys-news1.kolumbus.fi 1056654111 25563 81.197.1.6 (26 Jun 2003 19:01:51 GMT) Original-X-Complaints-To: abuse@kolumbus.fi Original-NNTP-Posting-Date: Thu, 26 Jun 2003 19:01:51 +0000 (UTC) User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/20.7 (windows-nt) (i386-*-nt5.0.2195) Cancel-Lock: sha1:Aa0MHpdd8tmjLUm4ilDgnttfDUU= X-Spamscanner: mailbox4.ucsd.edu (v1.2 May 26 2003 01:55:38, -1.7/5.0 2.55) X-MailScanner: PASSED (v1.2.7 71795 h5QJ1tim092974 mailbox4.ucsd.edu) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:5405 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:5405 * Sun 2003-06-15 Dan Jacobson gnu.emacs.bug * > 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 * 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.