osdir.com
mailing list archive

Subject: Re: ;;; anything.el --- open anything - msg#00129

List: emacs.sources

Date: Prev Next Index Thread: Prev Next Index
From: "spamfilteraccount@xxxxxxxxx" <spamfilteraccount@xxxxxxxxx>
Subject: ;;; anything.el --- open anything
Date: Fri, 22 Jun 2007 04:38:35 -0700

> This package provides a single command (M-x anything) and as I type
> the results are shown in a structured format. No need to tell emacs
> first I want to switch to a buffer, open a file or a manual page. See
> the commentary in the header.

Cool! I love it!!

I like menu using `read-char' rather than TAB and digit shortcut.
So I hacked up it.

(defvar anything-select-in-minibuffer-keys "asdfjkl;")

;; It is based on anything-select-action, so it needs refactoring.
(defun anything-select-action-in-minibuffer ()
"Select an action for the currently selected candidate in minibuffer."
(interactive)
(if anything-saved-sources
(error "Already showing the action list"))

(setq anything-saved-selection (anything-get-selection))
(unless anything-saved-selection
(error "Nothing is selected."))

(let ((actions (anything-get-action)))
(message "%s" (apply #'concat
(loop for action in actions
for i from 0 collecting
(format "[%c]%s\n"
(elt anything-select-in-minibuffer-keys
i)
(car action)))))
(let* ((key (read-char))
(idx (rindex anything-select-in-minibuffer-keys key)))
(or idx (error "bad selection"))
(setq anything-saved-action (cdr (elt actions idx)))
(anything-exit-minibuffer))))

(defvar anything-saved-action nil
"Saved value of the currently selected action by key.")
;; Redefined
(defun anything-execute-selection-action ()
"If a candidate was selected then perform the associated
action."
(let* ((selection (if anything-saved-selection
;; the action list is shown
anything-saved-selection
(anything-get-selection)))
(action (or anything-saved-action
(if anything-saved-sources
;; the action list is shown
(anything-get-selection)
(anything-get-action)))))

(if (anything-list-but-not-lambda-p action)
;; select the default action
(setq action (cdar action)))

(if (and selection action)
(funcall action selection))))

(define-key anything-map "\C-k" 'anything-select-action-in-minibuffer)

--
rubikitch
http://www.rubyist.net/~rubikitch/


Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

install-elisp.el --- Simple Emacs Lisp installer using curl

Automate Emacs Lisp installation. (1) download Emacs Lisp (2) save to your repository (3) byte compile (4) load (5) show Emacs Lisp M-x install-elisp M-x install-elisp-from-emacswiki For example, if you want to upgrade anything.el, you have only to issue: M-x install-elisp-from-emacswiki anything.el ;;; install-elisp.el --- Simple Emacs Lisp installer using curl ;; $Id: install-elisp.el,v 1.2 2007/07/24 10:44:31 rubikitch Exp $ ;; Copyright (C) 2007 rubikitch ;; Author: rubikitch <rubikitch@xxxxxxxxxxxxx> ;; Keywords: lisp, convenience, maint ;; URL: http://www.emacswiki.org/cgi-bin/wiki/download/install-elisp.el ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This file is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Commentary: ;; Automate Emacs Lisp installation. ;; (1) download Emacs Lisp ;; (2) save to your repository ;; (3) byte compile ;; (4) load ;; (5) show Emacs Lisp ;;; Installation: ;; To use this program, you must have curl, command-line HTTP client. ;; You need to add to .emacs: ;; (require 'install-elisp) ;; (setq install-elisp-repository-directory "~/emacs/lisp/") ;;; Usage: ;; M-x install-elisp ;; M-x install-elisp-from-emacswiki ;; ;; It is convenient to add to your Emacs Lisp programs: ;; (install-elisp "http://your.site/hogehoge.el") ;; because users have only to evaluate this sexp by C-x C-e. ;; If you want to complete EmacsWiki pagename, eval: ;; (install-elisp "http://www.emacswiki.org/cgi-bin/wiki/download/oddmuse.el") ;; It is very convenient to access EmacsWiki with oddmuse.el. ;;; Upgrade this program: ;; Simply eval: ;; (install-elisp-from-emacswiki "install-elisp.el") ;;; Related project: ;; Emacs Lisp Package Archive: http://tromey.com/elpa/ ;;; History: ;; $Log: install-elisp.el,v $ ;; Revision 1.2 2007/07/24 10:44:31 rubikitch ;; Fixed a serious bug. ;; New variable: install-elisp-use-view-mode ;; ;; Revision 1.1 2007/07/24 10:39:40 rubikitch ;; Initial revision ;; ;;; Code: (defvar install-elisp-repository-directory nil "Directory to save Emacs Lisp programs downloaded by install-elisp.el. You MUST set it in .emacs. Developer's note: The default is nil to prevent install-elisp from installing wrong place.") (defvar install-elisp-use-view-mode t "If non-nil, turn on `view-mode' for installed Emacs Lisp program.") (defun %install-elisp-create-buffer (url) (let ((buffer (generate-new-buffer " *install-elisp-tmp*"))) (shell-command (format "curl --silent '%s'" url) buffer) (switch-to-buffer buffer))) ;;;###autoload (defun install-elisp (url &optional filename) "Retrieve Emacs Lisp program from URL and save and byte-compile and load. If optional FILENAME is supplied, save URL as FILENAME, otherwise URL's basename." (interactive "sInstall Emacs Lisp from URL: ") (if (null install-elisp-repository-directory) (with-output-to-temp-buffer "*Help*" (princ "You must prepare to use install-elisp program! Set `install-elisp-repository-directory' to your local Emacs Lisp repository directory in your ~/.emacs. For example: (setq install-elisp-repository-directory \"~/emacs/lisp/\")")) (%install-elisp-create-buffer url) (write-file (expand-file-name (or filename (file-name-nondirectory url)) install-elisp-repository-directory)) (byte-compile-file buffer-file-name t) (and install-elisp-use-view-mode (view-mode 1)))) (defun %install-elisp-from (baseurl) "Return higher-order function installing from BASEURL, which accepts an argument FILENAME." `(lambda (filename) (install-elisp (concat ,baseurl filename) filename))) ;;;###autoload (defun install-elisp-from-emacswiki (filename) "Install Emacs Lisp program from the EmacsWiki." (interactive (list (if (fboundp 'oddmuse-read-pagename) (oddmuse-read-pagename "EmacsWiki") (read-string "PageName: ")))) (funcall (%install-elisp-from "http://www.emacswiki.org/cgi-bin/wiki/download/") filename)) (provide 'install-elisp) ;; How to save (DO NOT REMOVE!!) ;; (emacswiki-post "install-elisp.el") ;;; install-elisp.el ends here -- rubikitch http://www.rubyist.net/~rubikitch/

Next Message by Date: click to view message preview

Re: install-elisp.el --- Simple Emacs Lisp installer using curl

I updated install-elisp.el. Thank you for quick comments. http://www.emacswiki.org/cgi-bin/wiki/download/install-elisp.el ;; (install-elisp-from-emacswiki "install-elisp.el") ;; Revision 1.6 2007/07/25 17:58:39 rubikitch ;; New command: dired-install-elisp-from-emacswiki ;; ;; Revision 1.5 2007/07/25 17:50:30 rubikitch ;; `install-elisp-repository-directory': "~/.emacs.d/" by default. ;; ;; Revision 1.4 2007/07/25 17:47:21 rubikitch ;; rename function: %install-elisp-from -> install-elisp-from ;; ;; Revision 1.3 2007/07/25 17:46:13 rubikitch ;; use `url-retrieve-synchronously' if available -- rubikitch http://www.rubyist.net/~rubikitch/

Previous Message by Thread: click to view message preview

Re: ;;; anything.el --- open anything

"spamfilteraccount@xxxxxxxxx" <spamfilteraccount@xxxxxxxxx> writes: Hi Tamas, >> I think it happens only if your start anything when then *anything* >> buffer is current. Did you try it like this too? Now I did so and it worked as expected. > Hmm, my bug doesn't occur here anymore, so your bug is about something > else. I can only do something with it if there is a way to reproduce > it. I haven't encountered this assertion for quite a while. Ok, the next time it happens I hope to find a way to reproduce it. Bye, Tassilo -- Chuck Norris' tears cure cancer. Too bad he has never cried. Ever.

Next Message by Thread: click to view message preview

Please don't post features that depend on proprietary software

It has been said to me that keyring.el is only useful for people who use either Windows or PalmOS. Both Windows and PalmOS are non-free, proprietary operating systems; in other words, unethical. (For the definition of free software, see http://www.gnu.org/philosophy/free-sw.html.) Our aim in developing GNU Emacs, and indeed the whole GNU operating system of which GNU Emacs is a part, is to replace non-free software with free, freedom-respecting software. We aim to replace and eliminate systems such as Windows and PalmOS, not to enhance them! So please don't post Emacs features here that only work (or only are useful) on non-free operating systems.
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by