diff options
| author | David Kastrup | 2007-03-31 15:22:14 +0000 |
|---|---|---|
| committer | David Kastrup | 2007-03-31 15:22:14 +0000 |
| commit | ba7529b671563f7341912ed95ae590a711959dc7 (patch) | |
| tree | 48145d6ff1b4989172b0b076f23f928c769770c2 | |
| parent | 6797d2725fe6900f671bfef8aa380fe81e68416c (diff) | |
| download | emacs-ba7529b671563f7341912ed95ae590a711959dc7.tar.gz emacs-ba7529b671563f7341912ed95ae590a711959dc7.zip | |
* woman.el (woman-Cyg-to-Win): Don't convert cons cells
corresponding to MANPATH_MAP entries.
(woman-man.conf-path, woman-parse-man.conf): Doc fix.
(woman-parse-man.conf): Use more discriminating man.conf name.
(woman-parse-man.conf): Parse MANPATH_MAP entries.
(woman-manpath): Doc fix and type fix.
(woman-cached-data): Check for MANPATH_MAP entries.
(woman-expand-directory-path): Treat MANPATH_MAP entries.
* woman.texi (Topic, Interface Options): Explain changes semantics of
woman-manpath in order to consider MANPATH_MAP entries.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/woman.el | 89 | ||||
| -rw-r--r-- | man/ChangeLog | 5 | ||||
| -rw-r--r-- | man/woman.texi | 15 |
4 files changed, 85 insertions, 35 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 31ff8bb2f68..2d08a6aca79 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2007-03-31 David Kastrup <dak@gnu.org> | ||
| 2 | |||
| 3 | * woman.el (woman-Cyg-to-Win): Don't convert cons cells | ||
| 4 | corresponding to MANPATH_MAP entries. | ||
| 5 | (woman-man.conf-path, woman-parse-man.conf): Doc fix. | ||
| 6 | (woman-parse-man.conf): Use more discriminating man.conf name. | ||
| 7 | (woman-parse-man.conf): Parse MANPATH_MAP entries. | ||
| 8 | (woman-manpath): Doc fix and type fix. | ||
| 9 | (woman-cached-data): Check for MANPATH_MAP entries. | ||
| 10 | (woman-expand-directory-path): Treat MANPATH_MAP entries. | ||
| 11 | |||
| 1 | 2007-03-31 Stuart Herring <herring@lanl.gov> | 12 | 2007-03-31 Stuart Herring <herring@lanl.gov> |
| 2 | 13 | ||
| 3 | * emacs-lisp/sregex.el (sregexq): Doc fix. | 14 | * emacs-lisp/sregex.el (sregexq): Doc fix. |
diff --git a/lisp/woman.el b/lisp/woman.el index ffa0ea692ad..9fa2a764880 100644 --- a/lisp/woman.el +++ b/lisp/woman.el | |||
| @@ -486,24 +486,28 @@ As a special case, if PATHS is nil then replace it by calling | |||
| 486 | 486 | ||
| 487 | (defun woman-Cyg-to-Win (file) | 487 | (defun woman-Cyg-to-Win (file) |
| 488 | "Convert an absolute filename FILE from Cygwin to Windows form." | 488 | "Convert an absolute filename FILE from Cygwin to Windows form." |
| 489 | ;; Code taken from w32-symlinks.el | 489 | ;; MANPATH_MAP conses are not converted since they presumably map |
| 490 | (if (eq (aref file 0) ?/) | 490 | ;; Cygwin to Cygwin form. |
| 491 | ;; Try to use Cygwin mount table via `cygpath.exe'. | 491 | (if (consp file) |
| 492 | (condition-case nil | 492 | file |
| 493 | (with-temp-buffer | 493 | ;; Code taken from w32-symlinks.el |
| 494 | ;; cygpath -m file | 494 | (if (eq (aref file 0) ?/) |
| 495 | (call-process "cygpath" nil t nil "-m" file) | 495 | ;; Try to use Cygwin mount table via `cygpath.exe'. |
| 496 | (buffer-substring 1 (buffer-size))) | 496 | (condition-case nil |
| 497 | (error | 497 | (with-temp-buffer |
| 498 | ;; Assume no `cygpath' program available. | 498 | ;; cygpath -m file |
| 499 | ;; Hack /cygdrive/x/ or /x/ or (obsolete) //x/ to x:/ | 499 | (call-process "cygpath" nil t nil "-m" file) |
| 500 | (when (string-match "\\`\\(/cygdrive\\|/\\)?/./" file) | 500 | (buffer-substring 1 (buffer-size))) |
| 501 | (if (match-string 1) ; /cygdrive/x/ or //x/ -> /x/ | 501 | (error |
| 502 | (setq file (substring file (match-end 1)))) | 502 | ;; Assume no `cygpath' program available. |
| 503 | (aset file 0 (aref file 1)) ; /x/ -> xx/ | 503 | ;; Hack /cygdrive/x/ or /x/ or (obsolete) //x/ to x:/ |
| 504 | (aset file 1 ?:)) ; xx/ -> x:/ | 504 | (when (string-match "\\`\\(/cygdrive\\|/\\)?/./" file) |
| 505 | file)) | 505 | (if (match-string 1) ; /cygdrive/x/ or //x/ -> /x/ |
| 506 | file)) | 506 | (setq file (substring file (match-end 1)))) |
| 507 | (aset file 0 (aref file 1)) ; /x/ -> xx/ | ||
| 508 | (aset file 1 ?:)) ; xx/ -> x:/ | ||
| 509 | file)) | ||
| 510 | file))) | ||
| 507 | 511 | ||
| 508 | 512 | ||
| 509 | ;;; User options: | 513 | ;;; User options: |
| @@ -547,11 +551,12 @@ Change only via `Customization' or the function `add-hook'." | |||
| 547 | (mapcar 'woman-Cyg-to-Win path) | 551 | (mapcar 'woman-Cyg-to-Win path) |
| 548 | path)) | 552 | path)) |
| 549 | "*List of dirs to search and/or files to try for man config file. | 553 | "*List of dirs to search and/or files to try for man config file. |
| 550 | A trailing separator (`/' for UNIX etc.) on directories is optional, | 554 | A trailing separator (`/' for UNIX etc.) on directories is |
| 551 | and the filename is used if a directory specified is the first to | 555 | optional, and the filename is used if a directory specified is |
| 552 | contain the strings \"man\" and \".conf\" (in that order). | 556 | the first to start with \"man\" and has an extension starting |
| 553 | If MANPATH is not set but a config file is found then it is parsed | 557 | with \".conf\". If MANPATH is not set but a config file is found |
| 554 | instead to provide a default value for `woman-manpath'." | 558 | then it is parsed instead to provide a default value for |
| 559 | `woman-manpath'." | ||
| 555 | :type '(repeat string) | 560 | :type '(repeat string) |
| 556 | :group 'woman-interface) | 561 | :group 'woman-interface) |
| 557 | 562 | ||
| @@ -564,7 +569,9 @@ Concatenate data from all lines in the config file of the form | |||
| 564 | or | 569 | or |
| 565 | MANDATORY_MANPATH /usr/man | 570 | MANDATORY_MANPATH /usr/man |
| 566 | or | 571 | or |
| 567 | OPTIONAL_MANPATH /usr/man" | 572 | OPTIONAL_MANPATH /usr/man |
| 573 | or | ||
| 574 | MANPATH_MAP /opt/bin /opt/man" | ||
| 568 | ;; Functionality suggested by Charles Curley. | 575 | ;; Functionality suggested by Charles Curley. |
| 569 | (let ((path woman-man.conf-path) | 576 | (let ((path woman-man.conf-path) |
| 570 | file manpath) | 577 | file manpath) |
| @@ -576,7 +583,7 @@ or | |||
| 576 | (or (not (file-directory-p file)) | 583 | (or (not (file-directory-p file)) |
| 577 | (and | 584 | (and |
| 578 | (setq file | 585 | (setq file |
| 579 | (directory-files file t "man.*\\.conf" t)) | 586 | (directory-files file t "\\`man.*\\.conf[a-z]*\\'" t)) |
| 580 | (file-readable-p (setq file (car file))))) | 587 | (file-readable-p (setq file (car file))))) |
| 581 | ;; Parse the file -- if no MANPATH data ignore it: | 588 | ;; Parse the file -- if no MANPATH data ignore it: |
| 582 | (with-temp-buffer | 589 | (with-temp-buffer |
| @@ -584,8 +591,13 @@ or | |||
| 584 | (while (re-search-forward | 591 | (while (re-search-forward |
| 585 | ;; `\(?: ... \)' is a "shy group" | 592 | ;; `\(?: ... \)' is a "shy group" |
| 586 | "\ | 593 | "\ |
| 587 | ^[ \t]*\\(?:MANDATORY_\\|OPTIONAL_\\)?MANPATH[ \t]+\\(\\S-+\\)" nil t) | 594 | ^[ \t]*\\(?:\\(?:MANDATORY_\\|OPTIONAL_\\)?MANPATH[ \t]+\\(\\S-+\\)\\|\ |
| 588 | (setq manpath (cons (match-string 1) manpath))) | 595 | MANPATH_MAP[ \t]+\\(\\S-+\\)[ \t]+\\(\\S-+\\)\\)" nil t) |
| 596 | (add-to-list 'manpath | ||
| 597 | (if (match-beginning 1) | ||
| 598 | (match-string 1) | ||
| 599 | (cons (match-string 2) | ||
| 600 | (match-string 3))))) | ||
| 589 | manpath)) | 601 | manpath)) |
| 590 | )) | 602 | )) |
| 591 | (setq path (cdr path))) | 603 | (setq path (cdr path))) |
| @@ -600,6 +612,11 @@ subdirectories of the form `man?', or more precisely subdirectories | |||
| 600 | selected by the value of `woman-manpath-man-regexp'. Non-directory | 612 | selected by the value of `woman-manpath-man-regexp'. Non-directory |
| 601 | and unreadable files are ignored. | 613 | and unreadable files are ignored. |
| 602 | 614 | ||
| 615 | Elements can also be a cons cell indicating a mapping from PATH | ||
| 616 | to manual trees: if such an element's car is equal to a path | ||
| 617 | element of the environment variable PATH, the cdr of the cons | ||
| 618 | cell is included in the directory tree search. | ||
| 619 | |||
| 603 | If not set then the environment variable MANPATH is used. If no such | 620 | If not set then the environment variable MANPATH is used. If no such |
| 604 | environment variable is found, the default list is determined by | 621 | environment variable is found, the default list is determined by |
| 605 | consulting the man configuration file if found, which is determined by | 622 | consulting the man configuration file if found, which is determined by |
| @@ -618,7 +635,7 @@ I recommend including drive letters explicitly, e.g. | |||
| 618 | 635 | ||
| 619 | The MANPATH environment variable may be set using DOS semi-colon- | 636 | The MANPATH environment variable may be set using DOS semi-colon- |
| 620 | separated or UN*X/Cygwin colon-separated syntax (but not mixed)." | 637 | separated or UN*X/Cygwin colon-separated syntax (but not mixed)." |
| 621 | :type '(repeat string) | 638 | :type '(repeat (choice string (cons string string))) |
| 622 | :group 'woman-interface) | 639 | :group 'woman-interface) |
| 623 | 640 | ||
| 624 | (defcustom woman-manpath-man-regexp "[Mm][Aa][Nn]" | 641 | (defcustom woman-manpath-man-regexp "[Mm][Aa][Nn]" |
| @@ -1159,7 +1176,14 @@ Set from the cache by `woman-read-directory-cache'.") | |||
| 1159 | Called both to generate and to check the cache!" | 1176 | Called both to generate and to check the cache!" |
| 1160 | ;; Must use substituted paths because values of env vars may change! | 1177 | ;; Must use substituted paths because values of env vars may change! |
| 1161 | (list woman-cache-level | 1178 | (list woman-cache-level |
| 1162 | (mapcar 'substitute-in-file-name woman-manpath) | 1179 | (let (lst path) |
| 1180 | (dolist (dir woman-manpath (nreverse lst)) | ||
| 1181 | (when (consp dir) | ||
| 1182 | (unless path | ||
| 1183 | (setq path | ||
| 1184 | (split-string (getenv "PATH") path-separator t))) | ||
| 1185 | (setq dir (and (member (car dir) path) (cdr dir)))) | ||
| 1186 | (when dir (add-to-list 'lst (substitute-in-file-name dir))))) | ||
| 1163 | (mapcar 'substitute-in-file-name woman-path))) | 1187 | (mapcar 'substitute-in-file-name woman-path))) |
| 1164 | 1188 | ||
| 1165 | (defun woman-read-directory-cache () | 1189 | (defun woman-read-directory-cache () |
| @@ -1320,10 +1344,15 @@ Ignore any paths that are unreadable or not directories." | |||
| 1320 | ;; Allow each path to be a single string or a list of strings: | 1344 | ;; Allow each path to be a single string or a list of strings: |
| 1321 | (if (not (listp woman-manpath)) (setq woman-manpath (list woman-manpath))) | 1345 | (if (not (listp woman-manpath)) (setq woman-manpath (list woman-manpath))) |
| 1322 | (if (not (listp woman-path)) (setq woman-path (list woman-path))) | 1346 | (if (not (listp woman-path)) (setq woman-path (list woman-path))) |
| 1323 | (let (dir head dirs) | 1347 | (let (dir head dirs path) |
| 1324 | (while woman-manpath | 1348 | (while woman-manpath |
| 1325 | (setq dir (car woman-manpath) | 1349 | (setq dir (car woman-manpath) |
| 1326 | woman-manpath (cdr woman-manpath)) | 1350 | woman-manpath (cdr woman-manpath)) |
| 1351 | (when (consp dir) | ||
| 1352 | (unless path | ||
| 1353 | (setq path (split-string (getenv "PATH") path-separator t))) | ||
| 1354 | (setq dir (and (member (car dir) path) | ||
| 1355 | (cdr dir)))) | ||
| 1327 | (if (and dir (woman-file-readable-p dir)) | 1356 | (if (and dir (woman-file-readable-p dir)) |
| 1328 | ;; NB: `parse-colon-path' creates null elements for | 1357 | ;; NB: `parse-colon-path' creates null elements for |
| 1329 | ;; redundant (semi-)colons and trailing `/'s! | 1358 | ;; redundant (semi-)colons and trailing `/'s! |
diff --git a/man/ChangeLog b/man/ChangeLog index ed353d5a647..7431f616638 100644 --- a/man/ChangeLog +++ b/man/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-03-31 David Kastrup <dak@gnu.org> | ||
| 2 | |||
| 3 | * woman.texi (Topic, Interface Options): Explain changes semantics of | ||
| 4 | woman-manpath in order to consider MANPATH_MAP entries. | ||
| 5 | |||
| 1 | 2007-03-31 Eli Zaretskii <eliz@gnu.org> | 6 | 2007-03-31 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * misc.texi (Printing): Postscript -> PostScript. | 8 | * misc.texi (Printing): Postscript -> PostScript. |
diff --git a/man/woman.texi b/man/woman.texi index c7476cf82c0..86c73306892 100644 --- a/man/woman.texi +++ b/man/woman.texi | |||
| @@ -386,9 +386,9 @@ WoMan tries to pick up the information that would be used by the | |||
| 386 | UNIX, then WoMan parses that. Otherwise, if WoMan can find a | 386 | UNIX, then WoMan parses that. Otherwise, if WoMan can find a |
| 387 | configuration file named (by default) @file{man.conf} (or something very | 387 | configuration file named (by default) @file{man.conf} (or something very |
| 388 | similar), which seems to be the standard mechanism under GNU/Linux, then | 388 | similar), which seems to be the standard mechanism under GNU/Linux, then |
| 389 | it parses that. To be precise, ``something very similar'' means having | 389 | it parses that. To be precise, ``something very similar'' means |
| 390 | two name components separated by a dot and respectively containing | 390 | starting with @samp{man} and ending with @samp{.conf} and possibly more |
| 391 | @samp{man} and beginning with @samp{conf}, e.g.@: @file{manual.configuration}. | 391 | lowercase letters, e.g.@: @file{manual.configuration}. |
| 392 | The search path and/or precise full path name for this file are set by | 392 | The search path and/or precise full path name for this file are set by |
| 393 | the value of the customizable user option @code{woman-man.conf-path}. | 393 | the value of the customizable user option @code{woman-man.conf-path}. |
| 394 | If all else fails, WoMan uses a plausible default man search path. | 394 | If all else fails, WoMan uses a plausible default man search path. |
| @@ -407,7 +407,10 @@ elements of @code{woman-path} must be directories that contain man files | |||
| 407 | @emph{directly}. Secondly, the last directory component of each element | 407 | @emph{directly}. Secondly, the last directory component of each element |
| 408 | of @code{woman-path} is treated as a regular (Emacs) match expression | 408 | of @code{woman-path} is treated as a regular (Emacs) match expression |
| 409 | rather than a fixed name, which allows collections of related | 409 | rather than a fixed name, which allows collections of related |
| 410 | directories to be specified succinctly. | 410 | directories to be specified succinctly. Also, elements of |
| 411 | @code{woman-manpath} can be conses, indicating a mapping from | ||
| 412 | @samp{PATH} environment variable components to man directory | ||
| 413 | hierarchies. | ||
| 411 | 414 | ||
| 412 | For topic completion to work, WoMan must build a list of all the manual | 415 | For topic completion to work, WoMan must build a list of all the manual |
| 413 | files that it can access, which can be very slow, especially if a | 416 | files that it can access, which can be very slow, especially if a |
| @@ -943,7 +946,9 @@ A list of strings representing @emph{directory trees} to search for Unix | |||
| 943 | manual files. Each element should be the name of a directory that | 946 | manual files. Each element should be the name of a directory that |
| 944 | contains subdirectories of the form @file{man?}, or more precisely | 947 | contains subdirectories of the form @file{man?}, or more precisely |
| 945 | subdirectories selected by the value of @code{woman-manpath-man-regexp}. | 948 | subdirectories selected by the value of @code{woman-manpath-man-regexp}. |
| 946 | Non-directory and unreadable files are ignored. | 949 | Non-directory and unreadable files are ignored. This can also contain |
| 950 | conses, with the car indicating a @code{PATH} variable component mapped | ||
| 951 | to the directory tree given in the cdr. | ||
| 947 | 952 | ||
| 948 | @cindex @code{MANPATH}, environment variable | 953 | @cindex @code{MANPATH}, environment variable |
| 949 | If not set then the environment variable @code{MANPATH} is used. If no | 954 | If not set then the environment variable @code{MANPATH} is used. If no |