Location: lg@xxxxxxxxxxxxxx http://arch.xwem.org/2005/
Revision: xwem--main--2.2--patch-42
Archive: lg@xxxxxxxxxxxxxx
Creator: Zajcev Evgeny <lg@xxxxxxxx>
Date: Thu Nov 24 01:29:57 MSK 2005
Standard-date: 2005-11-23 22:29:57 GMT
Modified-files: dockapp/xwem-mpd.el dockapp/xwem-time.el
lisp/xwem-interactive.el lisp/xwem-keyboard.el
lisp/xwem-misc.el
New-patches: lg@xxxxxxxxxxxxxx/xwem--main--2.2--patch-42
steve@xxxxxxxxxxxxxx/xwem--steve--2.2--patch-15
Summary: Merge from steve, `disable-command' support added
Keywords: novice, fixes
* dockapp/xwem-mpd.el (mpd-lyric-filename): Whitespace in filenames is
just plain evil! If you are already have bunch of lyric files with
whitespaces you could use Z-Shell's zmv command to easily migrate to
new scheme, just do:
zsh$ cd <xwem-mpd-lyrics-dir>
zsh$ autoload zmv
zsh$ zmv '(*) -- (*) -- (*).txt' '$1--$2--$3.txt'
* dockapp/xwem-mpd.el (mpd-lyric-show): A little nicer display of lyric
files. Make the buffer read-only and enter `view-mode'
* dockapp/xwem-mpd.el (mpd-process-sentinel): itimer fix.
* lisp/xwem-interactive.el (define-xwem-command): [addon] Mark xwem
commands with `xwem-command' symbol property.
* lisp/xwem-interactive.el (xwem-command-p): [new] Return non-nil if
given command is xwem command defined with `define-xwem-command'.
* lisp/xwem-keyboard.el (xwem-kbd-dispatch-binding): [EXPERIMENTAL] Use
`command-execute' instead of `call-interactively' to make
`disabled-command-hook' working .. if you discovered problems with
`command-execute' let us know as soon as possible!
* lisp/xwem-misc.el (disabled-command-hook): [new] Advice added
* added files
{arch}/xwem/xwem--main/xwem--main--2.2/lg@xxxxxxxxxxxxxx/patch-log/patch-42
{arch}/xwem/xwem--steve/xwem--steve--2.2/steve@xxxxxxxxxxxxxx/patch-log/patch-15
* modified files
--- orig/dockapp/xwem-mpd.el
+++ mod/dockapp/xwem-mpd.el
@@ -265,10 +265,12 @@
(run-hooks 'mpd-after-variables-update-hook)))
(defun mpd-process-sentinel (proc &optional evstr)
- (delete-process proc)
- (delete-itimer mpd-itimer)
- (setq mpd-itimer nil
- mpd-process nil))
+ (let ((timer (get-itimer mpd-itimer)))
+ (delete-process proc)
+ (when (itimerp timer)
+ (delete-itimer timer))
+ (setq mpd-itimer nil
+ mpd-process nil)))
(defun mpd-update-variables ()
"Requests status information."
@@ -283,7 +285,7 @@
"Return lyric filename for now playing song."
(when **mpd-var-file*
(expand-file-name
- (concat (replace-in-string **mpd-var-file* "\/" " -- ") ".txt")
+ (concat (replace-in-string **mpd-var-file* "\/" "--") ".txt")
xwem-mpd-lyrics-dir)))
(defun mpd-lyric-check ()
@@ -311,8 +313,20 @@
"Show lyrics for now playing song."
(xwem-interactive)
(if (mpd-lyric-check)
- (let ((b (find-file-noselect (mpd-lyric-filename))))
- (xwem-special-popup-frame b))
+ (let ((temp-buffer-show-function 'xwem-special-popup-frame)
+ (header (format "\"%s\" (by: %s)"
+ **mpd-var-Title*
+ **mpd-var-Artist*))
+ (title (format "Lyrics: %s" **mpd-var-Title*)))
+ (with-output-to-temp-buffer title
+ (set-buffer standard-output)
+ (insert header "\n"
+ (make-string (length header) ?=)
+ "\n\n")
+ (insert-file-contents (mpd-lyric-filename))
+ (toggle-read-only 1)
+ (view-mode nil #'(lambda (&rest not-used-buffer)
+ (delete-frame (selected-frame))))))
(when (and **mpd-var-Artist* **mpd-var-Title*)
(let ((lyric-frame (new-frame)))
(select-frame lyric-frame)
@@ -324,9 +338,10 @@
;;;; Dockapp section
(defvar xwem-mpd-osd nil)
-(define-xwem-command xwem-mpd ()
+;;;###autoload
+(defun xwem-mpd ()
"Start xwem dockapp to interact with MusicPD."
- (xwem-interactive )
+ (interactive)
;; Start client connection
(mpd-start-connection)
--- orig/dockapp/xwem-time.el
+++ mod/dockapp/xwem-time.el
@@ -32,9 +32,8 @@
;; `display-time' like application, which starts in system tray and
;; shows current time, load average and mail status.
;;
-;; To start using it, add:
+;; To start using it add:
;;
-;; (autoload 'xwem-time "xwem-time" "Start `display-time' like app in
system tray.")
;; (add-hook 'xwem-after-init-hook 'xwem-time)
;;
;; to your xwemrc.
--- orig/lisp/xwem-interactive.el
+++ mod/lisp/xwem-interactive.el
@@ -96,14 +96,16 @@
(defmacro define-xwem-command (funsym args docstring inter &rest body)
"Same as `xwem-defun', but make FUNSYM to be interactive command.
INTER is actually a for of `xwem-interactive'."
- `(defun ,funsym ,args
- ,docstring
- ,(macroexpand inter)
- ;; Maybe run command without GCing at all
- (let ((gc-cons-threshold (if xwem-commands-inhibit-gc
- xwem-commands-gc-cons-threshold
- gc-cons-threshold)))
- ,@body)))
+ `(progn
+ (put (quote ,funsym) 'xwem-command t)
+ (defun ,funsym ,args
+ ,docstring
+ ,(macroexpand inter)
+ ;; Maybe run command without GCing at all
+ (let ((gc-cons-threshold (if xwem-commands-inhibit-gc
+ xwem-commands-gc-cons-threshold
+ gc-cons-threshold)))
+ ,@body))))
(put 'define-xwem-command 'lisp-indent-function 'defun)
(defmacro xwem-under-minibuffer (&rest forms)
@@ -121,6 +123,10 @@
(xwem-minib-cl xwem-minibuffer) nil t))))
+(defun xwem-command-p (cmd)
+ "Return non-nil if CMD is xwem command, defined with `define-xwem-command'."
+ (get cmd 'xwem-command))
+
(defun xwem-interactive-p ()
"Return non-nil when xwem in interactive mode."
xwem-interactively)
--- orig/lisp/xwem-keyboard.el
+++ mod/lisp/xwem-keyboard.el
@@ -1251,9 +1251,11 @@
;; Execute LKM command
(setq xwem-this-command lkm)
(run-hooks 'xwem-pre-command-hook)
- (call-interactively xwem-this-command)
+; (call-interactively xwem-this-command)
+ (command-execute xwem-this-command)
(setq xwem-last-command xwem-this-command)
- (run-hooks 'xwem-post-command-hook))
+ (run-hooks 'xwem-post-command-hook)
+ (setq xwem-this-command nil))
((null lkm)
;; Just echo key
--- orig/lisp/xwem-misc.el
+++ mod/lisp/xwem-misc.el
@@ -1776,8 +1776,22 @@
(XUngrabServer dpy)
(XFlush dpy)
(XFreeGC dpy gc))))
-
+
(provide 'xwem-misc)
+;;; On-load actions
+(defadvice disabled-command-hook (around xwem-command activate)
+ (if (or (xwem-command-p xwem-this-command)
+ (xwem-command-p this-command))
+ (let ((tframe (xwem-special-popup-frame (get-buffer-create "*Help*"))))
+ (xwem-kbd-stop-command-keys-echoing)
+ (xwem-under-minibuffer
+ (let ((this-command (if (xwem-command-p xwem-this-command)
+ xwem-this-command
+ this-command)))
+ ad-do-it)
+ (delete-frame tframe)))
+ ad-do-it))
+
;;; xwem-misc.el ends here
|