unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] woman.el (woman-file-name): custom option `woman-use-file-directly'
@ 2010-12-25  9:46 Vladimir Alexiev
  2011-01-09 21:47 ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Vladimir Alexiev @ 2010-12-25  9:46 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]

Hi everyone and Merry Christmas!

Sometimes a system may have several versions of man pages. E.g. my cygwin installation has these for "ls":
- c:/cygwin/usr/man/man1/ls.1 -- ls (fileutils) 4.1 (April 2001)
- c:/cygwin/usr/share/man/man1/ls.1.gz -- GNU coreutils 8.5 (June 2010)
In this case woman.el asks you to select one.
This is distracting if you are in the middle of something and want to quickly refer to man, and don't care about the particular version.

I attach a small patch for woman.el that fixes this.
Tested on: GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600) of 2010-11-10 on SHAN-PC

It's less than 20 lines (I've signed a GPL waiver before, but that was like 10 years ago).

Cheers! V


[-- Attachment #2: woman.patch --]
[-- Type: application/octet-stream, Size: 1135 bytes --]

2010-12-23  Vladimir Alexiev  <vladimir@sirma.bg>

	* woman.el (woman-file-name): custom option `woman-use-first-file'
	to use the first file found, if multiple files match the man topic.

--- c:/emacs/lisp/woman.el	2010-11-10 08:39:48.000000000 +0200
+++ woman.el	2010-12-25 11:41:56.796875000 +0200
@@ -809,4 +809,11 @@
   :group 'woman-interface)
 
+(defcustom woman-use-file-directly nil
+  "If multiple files match the man topic, use the first or last file directly."
+  :type '(choice (const :tag "No" nil)
+		 (const :tag "First" 'first)
+                 (const :tag "Last" 'last))
+  :group 'woman-interface)
+
 (defvar woman-file-regexp nil
   "Regexp used to select (possibly compressed) man source files, e.g.
@@ -1320,4 +1327,6 @@
        ((null files) nil)		; no file found for topic.
        ((null (cdr files)) (car (car files))) ; only 1 file for topic.
+       ((eq 'first woman-use-file-directly) (car (car files))) ; use the first file
+       ((eq 'last woman-use-file-directly) (car (car (last files)))) ; use the last file
        (t
 	;; Multiple files for topic, so must select 1.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-15  8:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-25  9:46 [PATCH] woman.el (woman-file-name): custom option `woman-use-file-directly' Vladimir Alexiev
2011-01-09 21:47 ` Chong Yidong
2011-01-10  2:12   ` Stefan Monnier
2011-01-10  8:24   ` Vladimir Alexiev
2011-02-15  8:27     ` [PATCH] woman.el (woman-file-name): custom option `woman-file-name-option' Vladimir Alexiev

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).