]> code.delx.au - gnu-emacs/commitdiff
* woman.el (top): Remap `man' command by `woman' in
authorMichael Albinus <michael.albinus@gmx.de>
Wed, 7 Sep 2005 21:23:36 +0000 (21:23 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Wed, 7 Sep 2005 21:23:36 +0000 (21:23 +0000)
`woman-mode-map'.
(Man-getpage-in-background-advice): Remove defadvice; it isn't
necessary any longer with the remapped command.
(Man-bgproc-sentinel-advice): Remove defadvice which counts
formatting time only.

* net/tramp.el (tramp-action-password)
(tramp-multi-action-password): Compile the password prompt from
`method', `user' and `host'.  Sometimes it isn't obvious which
password to enter, for example with remote files offered by
recentf.el, or with multiple steps.  Suggested by Robert Marshall
<robert@chezmarshall.freeserve.co.uk>.

lisp/ChangeLog
lisp/net/tramp.el
lisp/woman.el

index c899dad69a84c32e87fffbc9632f6040188dfd53..3bda07a0d3224d1990ff8128f13c82fcadb07cca 100644 (file)
@@ -1,3 +1,19 @@
+2005-09-07  Michael Albinus  <michael.albinus@gmx.de>
+
+       * woman.el (top): Remap `man' command by `woman' in
+       `woman-mode-map'.
+       (Man-getpage-in-background-advice): Remove defadvice; it isn't
+       necessary any longer with the remapped command.
+       (Man-bgproc-sentinel-advice): Remove defadvice which counts
+       formatting time only.
+
+       * net/tramp.el (tramp-action-password)
+       (tramp-multi-action-password): Compile the password prompt from
+       `method', `user' and `host'.  Sometimes it isn't obvious which
+       password to enter, for example with remote files offered by
+       recentf.el, or with multiple steps.  Suggested by Robert Marshall
+       <robert@chezmarshall.freeserve.co.uk>.
+
 2005-09-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * progmodes/perl-mode.el (perl-font-lock-syntactic-keywords):
index e721f3fb01618282eb87e49784cafbd067ed7937..b8b3fb9068ab351adf3f5b071795458afcb4f463 100644 (file)
@@ -5213,7 +5213,10 @@ Returns nil if none was found, else the command is returned."
 
 (defun tramp-action-password (p multi-method method user host)
   "Query the user for a password."
-  (let ((pw-prompt (match-string 0)))
+  (let ((pw-prompt
+        (format "Password for %s "
+                (tramp-make-tramp-file-name
+                 nil method user host ""))))
     (tramp-message 9 "Sending password")
     (tramp-enter-password p pw-prompt user host)))
 
@@ -5300,8 +5303,12 @@ The terminal type can be configured with `tramp-terminal-type'."
 
 (defun tramp-multi-action-password (p method user host)
   "Query the user for a password."
-  (tramp-message 9 "Sending password")
-  (tramp-enter-password p (match-string 0) user host))
+  (let ((pw-prompt
+        (format "Password for %s "
+                (tramp-make-tramp-file-name
+                 nil method user host ""))))
+    (tramp-message 9 "Sending password")
+    (tramp-enter-password p pw-prompt user host)))
 
 (defun tramp-multi-action-succeed (p method user host)
   "Signal success in finding shell prompt."
index 5ecc4744305dd8ad9caa17c5cfa8157bff52bcfd..cfc6da83e8e6258558f6ed6fe32b9652579d41de 100644 (file)
@@ -1741,7 +1741,10 @@ Leave point at end of new text.  Return length of inserted text."
   (define-key woman-mode-map "w" 'woman)
   (define-key woman-mode-map "\en" 'WoMan-next-manpage)
   (define-key woman-mode-map "\ep" 'WoMan-previous-manpage)
-  (define-key woman-mode-map [M-mouse-2] 'woman-follow-word))
+  (define-key woman-mode-map [M-mouse-2] 'woman-follow-word)
+
+  ;; We don't need to call `man' when we are in `woman-mode'.
+  (define-key woman-mode-map [remap man] 'woman))
 
 (defun woman-follow-word (event)
   "Run WoMan with word under mouse as topic.
@@ -1942,25 +1945,33 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
 (defvar WoMan-Man-start-time nil
   "Used to record formatting time used by the `man' command.")
 
-(defadvice Man-getpage-in-background
-  (around Man-getpage-in-background-advice (topic) activate)
-  "Use WoMan unless invoked outside a WoMan buffer or invoked explicitly.
-Otherwise use Man and record start of formatting time."
-  (if (and (eq major-mode 'woman-mode)
-          (not (eq (caar command-history) 'man)))
-      (WoMan-getpage-in-background topic)
-    ;; Initiates man processing
-    (setq WoMan-Man-start-time (current-time))
-    ad-do-it))
-
-(defadvice Man-bgproc-sentinel
-  (after Man-bgproc-sentinel-advice activate)
-  ;; Terminates man processing
-  "Report formatting time."
-  (let* ((time (current-time))
-        (time (+ (* (- (car time) (car WoMan-Man-start-time)) 65536)
-                 (- (cadr time) (cadr WoMan-Man-start-time)))))
-    (message "Man formatting done in %d seconds" time)))
+;; Both advices are disabled because "a file in Emacs should not put
+;; advice on a function in Emacs" (see Info node "(elisp)Advising
+;; Functions").  Counting the formatting time is useful for
+;; developping, but less applicable for daily use.  The advice for
+;; `Man-getpage-in-background' can be discarded, because the
+;; key-binding in `woman-mode-map' has been remapped to call `woman'
+;; but `man'.  Michael Albinus <michael.albinus@gmx.de>
+
+;; (defadvice Man-getpage-in-background
+;;   (around Man-getpage-in-background-advice (topic) activate)
+;;   "Use WoMan unless invoked outside a WoMan buffer or invoked explicitly.
+;; Otherwise use Man and record start of formatting time."
+;;   (if (and (eq major-mode 'woman-mode)
+;;        (not (eq (caar command-history) 'man)))
+;;       (WoMan-getpage-in-background topic)
+;;     ;; Initiates man processing
+;;     (setq WoMan-Man-start-time (current-time))
+;;     ad-do-it))
+
+;; (defadvice Man-bgproc-sentinel
+;;   (after Man-bgproc-sentinel-advice activate)
+;;   ;; Terminates man processing
+;;   "Report formatting time."
+;;   (let* ((time (current-time))
+;;      (time (+ (* (- (car time) (car WoMan-Man-start-time)) 65536)
+;;               (- (cadr time) (cadr WoMan-Man-start-time)))))
+;;     (message "Man formatting done in %d seconds" time)))
 
 \f
 ;;; Buffer handling: