X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/23c261f58fceed14e04b3ba928007fde9567d8e2..0c382083b6b550c26fad8ac7f59b1ba09663e728:/lisp/woman.el diff --git a/lisp/woman.el b/lisp/woman.el index 63c61016b5..96cfea72d4 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -7,7 +7,7 @@ ;; Maintainer: FSF ;; Keywords: help, unix ;; Adapted-By: Eli Zaretskii -;; Version: see `woman-version' +;; Version: 0.551 ;; URL: http://centaur.maths.qmul.ac.uk/Emacs/WoMan/ ;; This file is part of GNU Emacs. @@ -810,7 +810,7 @@ without interactive confirmation, if it exists as a topic." (defvar woman-file-regexp nil "Regexp used to select (possibly compressed) man source files, e.g. -\"\\.\\([0-9lmnt]\\w*\\)\\(\\.\\(g?z\\|bz2\\)\\)?\\'\". +\"\\.\\([0-9lmnt]\\w*\\)\\(\\.\\(g?z\\|bz2\\|xz\\)\\)?\\'\". Built automatically from the customizable user options `woman-uncompressed-file-regexp' and `woman-file-compression-regexp'.") @@ -846,16 +846,17 @@ MUST NOT end with any kind of string terminator such as $ or \\'." :group 'woman-interface) (defcustom woman-file-compression-regexp - "\\.\\(g?z\\|bz2\\)\\'" + "\\.\\(g?z\\|bz2\\|xz\\)\\'" "Do not change this unless you are sure you know what you are doing! Regexp used to match compressed man file extensions for which decompressors are available and handled by auto-compression mode, -e.g. \"\\\\.\\\\(g?z\\\\|bz2\\\\)\\\\'\" for `gzip' or `bzip2'. +e.g. \"\\\\.\\\\(g?z\\\\|bz2\\\\|xz\\\\)\\\\'\" for `gzip', `bzip2', or `xz'. Should begin with \\. and end with \\' and MUST NOT be optional." ;; Should be compatible with car of ;; `jka-compr-file-name-handler-entry', but that is unduly ;; complicated, includes an inappropriate extension (.tgz) and is ;; not loaded by default! + :version "24.1" ; added xz :type 'regexp :set 'set-woman-file-regexp :group 'woman-interface) @@ -1897,6 +1898,7 @@ Argument EVENT is the invoking mouse event." (setq woman-emulation value) (woman-reformat-last-file)) +(defvar bookmark-make-record-function) (put 'woman-mode 'mode-class 'special) (defun woman-mode () @@ -1934,6 +1936,9 @@ See `Man-mode' for additional details." ;; `make-local-variable' in case imenu not yet loaded! woman-imenu-generic-expression) (set (make-local-variable 'imenu-space-replacement) " ") + ;; Bookmark support. + (set (make-local-variable 'bookmark-make-record-function) + 'woman-bookmark-make-record) ;; For reformat ... ;; necessary when reformatting a file in its old buffer: (setq imenu--last-menubar-index-alist nil) @@ -2439,7 +2444,7 @@ Preserves location of `point'." (while (and (<= (setq N (1+ N)) 0) (cond ((memq (preceding-char) '(?\ ?\t)) - (delete-backward-char 1) t) + (delete-char -1) t) ((memq (following-char) '(?\ ?\t)) (delete-char 1) t) (t nil)))) @@ -3117,7 +3122,7 @@ If optional arg CONCAT is non-nil then join arguments." (if unquote (delete-char 1) (forward-char)) (re-search-forward "\"\\|$")) (if (eq (preceding-char) ?\") - (if unquote (delete-backward-char 1)) + (if unquote (delete-char -1)) (WoMan-warn "Unpaired \" in .%s arguments." request))) ;; (re-search-forward "[^\\\n] \\|$") ; inconsistent (skip-syntax-forward "^ ")) @@ -4345,7 +4350,7 @@ The variable `tab-stop-list' is a list whose elements are either left tab stop columns or pairs (COLUMN . TYPE) where TYPE is R or C." ;; Based on tab-to-tab-stop in indent.el. ;; R & C tabs probably not quite right! - (delete-backward-char 1) + (delete-char -1) (let ((tabs tab-stop-list)) (while (and tabs (>= (current-column) (woman-get-tab-stop (car tabs)))) @@ -4399,7 +4404,7 @@ Needs doing properly!" (delete-char 1) (insert woman-unpadded-space-char) (goto-char (match-end 0)) - (delete-backward-char 1) + (delete-char -1) (insert-before-markers woman-unpadded-space-char) (subst-char-in-region (match-beginning 0) (match-end 0) @@ -4519,6 +4524,37 @@ logging the message." (recenter 0)))))))) nil) ; for woman-file-readable-p etc. +;;; Bookmark Woman support. +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) +(declare-function bookmark-prop-get "bookmark" (bookmark prop)) +(declare-function bookmark-default-handler "bookmark" (bmk)) +(declare-function bookmark-get-bookmark-record "bookmark" (bmk)) + +;; FIXME: woman.el and man.el should be better integrated so, for +;; example, bookmarks of one can be used with the other. + +(defun woman-bookmark-make-record () + "Make a bookmark entry for a Woman buffer." + `(,(Man-default-bookmark-title) + ,@(bookmark-make-record-default 'no-file) + (location . ,(concat "woman " woman-last-file-name)) + ;; Use the same form as man's bookmarks, as much as possible. + (man-args . ,woman-last-file-name) + (handler . woman-bookmark-jump))) + +;;;###autoload +(defun woman-bookmark-jump (bookmark) + "Default bookmark handler for Woman buffers." + (let* ((file (bookmark-prop-get bookmark 'man-args)) + ;; FIXME: we need woman-find-file-noselect, since + ;; save-window-excursion can't protect us from the case where + ;; woman-find-file creates a new frame. + (buf (save-window-excursion + (woman-find-file file) (current-buffer)))) + (bookmark-default-handler + `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark))))) + (provide 'woman) ;; arch-tag: eea35e90-552f-4712-a94b-d9ffd3db7651