unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Vladimir Alexiev" <vladimir@sirma.bg>
To: <emacs-devel@gnu.org>
Subject: [PATCH] woman.el (woman-file-name): custom option `woman-use-file-directly'
Date: Sat, 25 Dec 2010 11:46:29 +0200	[thread overview]
Message-ID: <001d01cba418$9b8fbd10$d2af3730$@bg> (raw)

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

             reply	other threads:[~2010-12-25  9:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-25  9:46 Vladimir Alexiev [this message]
2011-01-09 21:47 ` [PATCH] woman.el (woman-file-name): custom option `woman-use-file-directly' 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

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='001d01cba418$9b8fbd10$d2af3730$@bg' \
    --to=vladimir@sirma.bg \
    --cc=emacs-devel@gnu.org \
    /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).