[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[STUMP] sample-stumpwmrc FIX
From: |
Замковий/Олексій |
Subject: |
[STUMP] sample-stumpwmrc FIX |
Date: |
Sun, 13 Feb 2011 23:25:01 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hi, when I tried to use "google" and "imdb" commands from
sample-stumpwmrc.lisp file, I found few
bugs - searching words divided by spaces gave us several tabs in
firefox and some symbols were not shell-escaped (using "!" or "$" in our
query could brake query).
I fixed this bug, my solution uses external
library (url-rewrite) for escaping urls.
diff --git a/sample-stumpwmrc.lisp b/sample-stumpwmrc.lisp
index 15ae3e8..bd1481f 100644
--- a/sample-stumpwmrc.lisp
+++ b/sample-stumpwmrc.lisp
@@ -17,20 +17,21 @@
;; Read some doc
(define-key *root-map* (kbd "d") "exec gv")
;; Browse somewhere
-(define-key *root-map* (kbd "b") "colon1 exec firefox http://www.")
+(define-key *root-map* (kbd "b") "colon exec firefox http://www.")
;; Ssh somewhere
-(define-key *root-map* (kbd "C-s") "colon1 exec xterm -e ssh ")
+(define-key *root-map* (kbd "C-s") "colon exec xterm -e ssh ")
;; Lock screen
(define-key *root-map* (kbd "C-l") "exec xlock")
+(require :url-rewrite)
;; Web jump (works for Google and Imdb)
-(defmacro make-web-jump (name prefix)
- `(defcommand ,name (search) ((:rest ,(concatenate 'string name " search: ")))
+(defmacro make-web-jump (name prefix &optional (escape-func
#'url-rewrite:url-encode))
+ `(defcommand ,name (search) ((:rest ,(concatenate 'string (string name) "
search: ")))
(substitute #\+ #\Space search)
- (run-shell-command (concatenate 'string ,prefix search))))
+ (run-shell-command (format nil ,prefix (funcall ,escape-func search)))))
-(make-web-jump "google" "firefox http://www.google.fr/search?q=")
-(make-web-jump "imdb" "firefox http://www.imdb.com/find?q=")
+(make-web-jump :google "firefox \"http://www.google.fr/search?q=~A\"")
+(make-web-jump :imdb "firefox \"http://www.imdb.com/find?q=~A\"")
;; C-t M-s is a terrble binding, but you get the idea.
(define-key *root-map* (kbd "M-s") "google")
@@ -72,4 +73,4 @@
(define-frame-preference "Emacs"
(1 t t :restore "emacs-editing-dump" :title "...xdvi")
- (0 t t :create "emacs-dump" :class "Emacs"))
\ No newline at end of file
+ (0 t t :create "emacs-dump" :class "Emacs"))
--
1.5.6.5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [STUMP] sample-stumpwmrc FIX,
Замковий/Олексій <=