[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ;;; anything.el --- open anything
From: |
Benjamin Andresen |
Subject: |
Re: ;;; anything.el --- open anything |
Date: |
Sun, 22 Jul 2007 22:57:33 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Hey guys,
first of all: What a wonderful piece of software. I really had a blast using it
and it even made me start writing emacs lisp. (With the help of #emacs)
I'm just going to post my (small) patches to anything (config mainly)
I'm more interested in your feedback than in the inclusion,
because the gnus one needs a small hack to work when gnus isn't running.
And it's obviously tinkered to my liking. (Opera ;-))
The hack for gnus:
(setq gnus-topic-alist nil), otherwise anything will complain that the variable
is void.
,----[ diff -u anything-config.el.1 anything-config.el ]
| --- anything-config.el.1 2007-07-22 13:26:10.000000000 +0200
| +++ anything-config.el 2007-07-22 22:27:23.000000000 +0200
| @@ -58,14 +58,16 @@
|
| (defvar anything-source-file-name-history
| '((name . "File Name History")
| - (candidates . file-name-history)
| + (candidates . (lambda ()
| + (ba-remove-duplicates-resolve-home file-name-history)))
| (type . file)))
|
| ;;;; Recentf files
|
| (defvar anything-source-recentf
| '((name . "Recentf")
| - (candidates . recentf-list)
| + (candidates . (lambda ()
| + (ba-remove-duplicates-resolve-home recentf-list)))
| (type . file)))
|
| ;;;; Files in current dir
| @@ -126,7 +128,8 @@
| "locate" "-i" "-r"
| anything-pattern)))
| (type . file)
| - (requires-pattern . 3))
| + (requires-pattern . 3)
| + (delayed))
| "Source for retrieving files matching the current input pattern
| with locate.")
|
| @@ -212,6 +215,91 @@
|
(anything-external-commands-list-1))
| file))))))
|
| +;;; Benny own thingies.
| +
| +(defvar anything-source-gnus
| + '((name . "Gnus")
| + (candidates . (lambda ()
| + (remove-duplicates
| + (apply 'append
| + (mapcar 'cdr
| + gnus-topic-alist))
| + :test #'equal)))
| + (action . (lambda (x)
| + (gnus-group-read-group nil nil x)))))
| +
| +(defvar anything-source-opera
| + '((name . "Opera History")
| + (candidates . (lambda ()
| + (ba-remove-duplicates-resolve-home
| + (mapcar 'car
| + (ba-opera-history)))))
| +
| + (action . (lambda (x)
| + (shell-command (concat "opera -newpage \""
| + (cdr (assoc x (ba-opera-history)))
"\" &"))
| + (delete-other-windows)))
| + (delayed)))
| +
| +(setq anything-sources (list anything-source-buffers
| + anything-source-recentf
| + anything-source-file-name-history
| + anything-source-gnus
| + anything-source-files-in-current-dir
| + anything-source-opera
| + anything-source-complex-command-history
| + anything-source-locate))
| +
| +(setq anything-type-actions (list anything-actions-buffer
| + anything-actions-file))
| +
| +(defun ba-remove-duplicates-resolve-home (x)
| + (remove-duplicates
| + (mapcar
| + (lambda (y)
| + (replace-regexp-in-string (concat "\\(?:" (getenv "HOME")
"\\|<home\\)") "~" y))
| + x)
| + :test #'equal))
| +
| +(defun ba-opera-history ()
| + (let (urls)
| + (with-temp-buffer
| + (insert-file-contents-literally "~/.opera/global.dat")
| + (goto-char (point-min))
| + (while (not (eobp))
| + (let* ((title (buffer-substring
| + (line-beginning-position)
| + (line-end-position))))
| + (forward-line 1)
| + (let* ((url (buffer-substring
| + (line-beginning-position)
| + (line-end-position))))
| + (push (cons title url) urls)))
| + (forward-line 3)))
| + urls))
| +
| +(setq anything-map
| + (let ((map (copy-keymap minibuffer-local-map)))
| + (define-key map (kbd "\C-n") 'anything-next-line)
| + (define-key map (kbd "\C-p") 'anything-previous-line)
| + (define-key map (kbd "<prior>") 'anything-previous-page)
| + (define-key map (kbd "<next>") 'anything-next-page)
| + (define-key map (kbd "\C-b") 'anything-previous-source)
| + (define-key map (kbd "\C-f") 'anything-next-source)
| + (define-key map (kbd "<RET>") 'anything-exit-minibuffer)
| + (define-key map (kbd "C-1") 'anything-select-with-digit-shortcut)
| + (define-key map (kbd "C-2") 'anything-select-with-digit-shortcut)
| + (define-key map (kbd "C-3") 'anything-select-with-digit-shortcut)
| + (define-key map (kbd "C-4") 'anything-select-with-digit-shortcut)
| + (define-key map (kbd "C-5") 'anything-select-with-digit-shortcut)
| + (define-key map (kbd "C-6") 'anything-select-with-digit-shortcut)
| + (define-key map (kbd "C-7") 'anything-select-with-digit-shortcut)
| + (define-key map (kbd "C-8") 'anything-select-with-digit-shortcut)
| + (define-key map (kbd "C-9") 'anything-select-with-digit-shortcut)
| + (define-key map (kbd "<tab>") 'anything-select-action)
| + map))
| +
| +
| ;;; Provide anything-config
|
| (provide 'anything-config)
`----
and this little 'fix/change' so that locale also looks uniform.
Maybe there is a better way? change the remove-duplicate
function to filter asynchronous processes?
,----[ diff -u anything.el.1 anything.el ]
| --- anything.el.1 2007-07-22 19:45:30.000000000 +0200
| +++ anything.el 2007-07-22 22:37:42.000000000 +0200
| @@ -906,11 +906,11 @@
| (setq file (propertize file 'face 'file-name-shadow)))
|
| ;; replace path of HOME directory in paths with the string
| - ;; <home>
| + ;; ~
| (let ((home (replace-regexp-in-string "\\\\" "/" ; stupid
Windows...
| (getenv "HOME"))))
| (if (string-match home file)
| - (cons (replace-match "<home>" nil nil file) file)
| + (cons (replace-match "~" nil nil file) file)
| file)))
| files)))
|
`----
br,
benny
- Re: ;;; anything.el --- open anything, (continued)
- Message not available
- Re: ;;; anything.el --- open anything, address@hidden, 2007/07/21
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/07/21
- Message not available
- Re: ;;; anything.el --- open anything, address@hidden, 2007/07/21
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/07/21
- Message not available
- Re: ;;; anything.el --- open anything, address@hidden, 2007/07/22
- Re: ;;; anything.el --- open anything, Vagn Johansen, 2007/07/22
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/07/22
- Message not available
- Re: ;;; anything.el --- open anything, Vagn Johansen, 2007/07/22
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/07/23
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/07/23
- Message not available
- Re: ;;; anything.el --- open anything,
Benjamin Andresen <=
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/07/23
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/07/23
- Re: ;;; anything.el --- open anything, address@hidden, 2007/07/23
- Re: ;;; anything.el --- open anything, address@hidden, 2007/07/23
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/07/23
- Message not available
- Re: ;;; anything.el --- open anything, address@hidden, 2007/07/23
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/07/23
- Message not available
- Re: ;;; anything.el --- open anything, billclem, 2007/07/24
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/07/24
- Message not available
- Re: ;;; anything.el --- open anything, address@hidden, 2007/07/24