*** woman.el.~1.18.~ Thu Feb 26 10:07:23 2004 --- woman.el Thu Feb 26 10:07:16 2004 *************** *** 525,530 **** --- 525,534 ---- :type 'hook :group 'woman) + (defcustom woman-update-cache-automatically t + "*If nil then only update cache on demand. Default is t." + :type 'boolean + :group 'woman) ;; Interface options *************** *** 547,552 **** --- 551,562 ---- :type '(repeat string) :group 'woman-interface) + (defcustom woman-sgml-to-roff-converter "/usr/lib/sgml/sgml2roff" + "*If man pages are formatted in SGML (SUN does this nowadays), we need to + convert them to nroff format." + :type 'string + :group 'woman-interface) + (defun woman-parse-man.conf () "Parse if possible configuration file for man command. Used only if MANPATH is not set or contains null components. *************** *** 1159,1165 **** (and woman-cache-filename (load woman-cache-filename t nil t) ; file exists ! (equal woman-cached-data (woman-cached-data)))) ; cache valid (defun woman-write-directory-cache () "Save the directory and topic cache. --- 1169,1176 ---- (and woman-cache-filename (load woman-cache-filename t nil t) ; file exists ! (or (not woman-update-cache-automatically) ! (equal woman-cached-data (woman-cached-data))))) ; cache valid (defun woman-write-directory-cache () "Save the directory and topic cache. *************** *** 1187,1192 **** --- 1198,1217 ---- (kill-buffer standard-output) )))) + + ;;;###autoload + (defun woman-recreate-cache () + "(Re)creates cache from `woman-manpath' and `woman-path', which see." + (interactive) + (message "Building list of manual directory expansions...") + (setq woman-expanded-directory-path + (woman-expand-directory-path woman-manpath woman-path)) + (message "Building completion list of all manual topics...") + (setq woman-topic-all-completions + (woman-topic-all-completions woman-expanded-directory-path)) + (woman-write-directory-cache)) + + (defvar woman-topic-history nil "Topic read history.") (defvar woman-file-history nil "File-name read history.") *************** *** 1197,1214 **** user option `woman-topic-at-point'. Return nil if no file can be found. Optional argument RE-CACHE, if non-nil, forces the cache to be re-read." ;; Handle the caching of the directory and topic lists: ! (if (and (not re-cache) ! (or ! (and woman-expanded-directory-path woman-topic-all-completions) ! (woman-read-directory-cache))) ! () ! (message "Building list of manual directory expansions...") ! (setq woman-expanded-directory-path ! (woman-expand-directory-path woman-manpath woman-path)) ! (message "Building completion list of all manual topics...") ! (setq woman-topic-all-completions ! (woman-topic-all-completions woman-expanded-directory-path)) ! (woman-write-directory-cache)) ;; There is a problem in that I want to offer case-insensitive ;; completions, but to return only a case-sensitive match. This ;; does not seem to work properly by default, so I re-do the --- 1222,1232 ---- user option `woman-topic-at-point'. Return nil if no file can be found. Optional argument RE-CACHE, if non-nil, forces the cache to be re-read." ;; Handle the caching of the directory and topic lists: ! (if (not (and (not re-cache) ! (or ! (and woman-expanded-directory-path woman-topic-all-completions) ! (woman-read-directory-cache)))) ! (woman-recreate-cache)) ;; There is a problem in that I want to offer case-insensitive ;; completions, but to return only a case-sensitive match. This ;; does not seem to work properly by default, so I re-do the *************** *** 1251,1259 **** ;; Unread the command event (TAB = ?\t = 9) that runs the command ;; `minibuffer-complete' in order to automatically complete the ;; minibuffer contents as far as possible. ! (setq unread-command-events '(9)) ; and delete any type-ahead! ! (completing-read "Manual file: " files nil 1 ! (try-completion "" files) 'woman-file-history))) ))) (defun woman-select (predicate list) --- 1269,1278 ---- ;; Unread the command event (TAB = ?\t = 9) that runs the command ;; `minibuffer-complete' in order to automatically complete the ;; minibuffer contents as far as possible. ! (completing-read (concat "Manual file (" (caar files) "): ") files nil 1 ! nil ! 'woman-file-history (caar files) ! ))) ))) (defun woman-select (predicate list) *************** *** 1520,1526 **** (let ((WoMan-current-file buffer-file-name)) ; used for message logging (rename-buffer (woman-make-bufname (file-name-nondirectory buffer-file-name))) ! (woman-process-buffer) (goto-char (point-min))))) ;; There is currently no `tar-mode-hook' so use ... --- 1539,1545 ---- (let ((WoMan-current-file buffer-file-name)) ; used for message logging (rename-buffer (woman-make-bufname (file-name-nondirectory buffer-file-name))) ! (woman-process-buffer WoMan-current-file) (goto-char (point-min))))) ;; There is currently no `tar-mode-hook' so use ... *************** *** 1612,1630 **** (setq default-directory (file-name-directory filename)) (set (make-local-variable 'backup-inhibited) t) (set-visited-file-name "") ! (woman-process-buffer))) ! (defun woman-process-buffer () "The second half of `woman-really-find-file'!" ! (interactive) ;; Check (crudely) that this really is likely to be in UN*X ;; man-page source format, assuming we are at point-min: (goto-char (point-min)) (if (re-search-forward "^[.']" 1000 t) (woman-decode-buffer) ! (message ! "File appears to be pre-formatted -- using source file may be better.") ! (woman-man-buffer)) (woman-mode)) (defun woman-man-buffer () --- 1631,1665 ---- (setq default-directory (file-name-directory filename)) (set (make-local-variable 'backup-inhibited) t) (set-visited-file-name "") ! (woman-process-buffer WoMan-current-file))) ! (defun woman-process-buffer (filename) "The second half of `woman-really-find-file'!" ! (interactive "f") ;; Check (crudely) that this really is likely to be in UN*X ;; man-page source format, assuming we are at point-min: (goto-char (point-min)) (if (re-search-forward "^[.']" 1000 t) (woman-decode-buffer) ! ;; maybe we have a man page formatted in SGML (SUN does this nowadays) ! (goto-char (point-min)) ! (if (re-search-forward "^