Emacs erlang mode patch(Woman)
Vladimir Sekissov
svg@REDACTED
Sun Dec 9 20:12:05 CET 2001
Good day,
below is a patch for Emacs erlang mode to work with woman which is
default man browser in emacs 21.*
Regards,
Vladimir Sekissov
------------------------------- cut here ----------------------------------
diff -Naur erlang.el.old erlang.el
--- erlang.el.old Fri Sep 15 15:54:37 2000
+++ erlang.el Sun Dec 9 23:37:44 2001
@@ -440,6 +440,9 @@
'(("^\\([^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\)[:) \t]" . (1 2)))
"*Patterns for matching Erlang errors.")
+(defvar erlang-man-woman (require 'woman nil t)
+ "*Use internal woman package")
+
(defvar erlang-man-inhibit (eq system-type 'windows-nt)
"Inhibit the creation of the Erlang Manual Pages menu.
@@ -2520,9 +2523,10 @@
mod)
input))))
;; Emacs 18 doesn't provide `man'...
- (condition-case nil
- (require 'man)
- (error nil))
+ (if (not (require 'woman nil t))
+ (condition-case nil
+ (require 'man)
+ (error nil)))
(let ((modname nil)
(funcname nil))
(cond ((null name)
@@ -2546,13 +2550,22 @@
(erlang-man-patch-notify)
(setq erlang-man-function-name funcname))
(condition-case nil
- (erlang-man-module modname)
+ (progn
+ (erlang-man-module modname)
+ (if erlang-man-woman
+ (progn
+ (if erlang-man-function-name
+ (progn
+ (erlang-man-find-function (WoMan-find-buffer)
+ erlang-man-function-name)
+ (setq erlang-man-function-name nil))))))
(error (setq erlang-man-function-name nil))))
(t
(erlang-man-module modname)
(if funcname
(erlang-man-find-function
- (or (get-buffer "*Manual Entry*") ; Emacs 18
+ (or (if erlang-man-woman (WoMan-find-buffer))
+ (get-buffer "*Manual Entry*") ; Emacs 18
(current-buffer)) ; XEmacs
funcname))))))
@@ -2573,7 +2586,8 @@
;; running under Emacs 19.
(error (error (concat "This commands needs the package `advice', "
"please upgrade your Emacs."))))
- (require 'man)
+ (if (not (require 'woman nil t))
+ (require 'man))
(defadvice Man-notify-when-ready
(after erlang-Man-notify-when-ready activate)
"Sets point at the documentation of the function name in
@@ -2599,16 +2613,16 @@
(set-window-point win (point)))
(message "Could not find function `%s'" func)))))))
-
(defun erlang-man-display (file)
"Display FILE as a `man' file.
This is de default manual page display function.
The variables `erlang-man-display-function' contains the function
to be used."
;; Emacs 18 doesn't `provide' man.
- (condition-case nil
- (require 'man)
- (error nil))
+ (if (not (require 'woman nil t))
+ (condition-case nil
+ (require 'man)
+ (error nil)))
(if file
(let ((process-environment (copy-sequence process-environment)))
(if (string-match "\\(.*\\)/man[^/]*/\\([^/]+\\)\\.[^.]$" file)
@@ -2619,7 +2633,10 @@
;; Emacs 18
(setq process-environment (cons (concat "MANPATH=" dir)
process-environment)))
- (cond ((not (and (not erlang-xemacs-p)
+ (cond (erlang-man-woman
+ (funcall (symbol-function 'WoMan-getpage-in-background)
+ page))
+ ((not (and (not erlang-xemacs-p)
(= erlang-emacs-major-version 19)
(< erlang-emacs-minor-version 29)))
(manual-entry page))
@@ -2630,7 +2647,6 @@
(funcall (symbol-function 'Man-getpage-in-background)
page))))
(error "Can't find man page for %s\n" file)))))
-
(defun erlang-man-describe-error ()
"Describe why the manual pages weren't found."
More information about the erlang-questions
mailing list