[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Wed, 30 Mar 2005 20:22:38 +0200
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (windows-nt)
Version 0.2, 2005-03-30
* Added read and write of command list from file and made
* Made all functions that deals with the command list interactive
so that the user can control it.
;;; w32-exec-predef.el --- execute Start Menu shortcuts from inside Emacs
;; Copyright (C) 2005 Mathias Dahl
;; Version: 0.2
;; Keywords: w32, vbscript, shortcuts, start menu
;; Author: Mathias Dahl <address@hidden>
;; Maintainer: Mathias Dahl
;; URL: http://www.emacswiki.org/cgi-bin/wiki/WThirtyTwoExecPredef
;; This file is not part of GNU Emacs.
;; This 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 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., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;; This package provide the function `w32-exec-predef' which can be
;; used to execute shortcuts from the Start Menu in Windows, using
;; iswitchb completion. This is yet another step in avoiding to leave
;; the safe environment living inside Emacs... :)
;; The user does not need to keep this list updated himself as there
;; is a function, `w32-exec-predef-build', that does it for him. This,
;; however, means that the first time in each session that the
;; function is run, it will take a bit longer because it will populate
;; all information from the Start Menu.
;; * requires findr.el for doing the recursive scan for .lnk files and
;; w32-utl.el for some utility functions.
;; Version 0.2, 2005-03-30
;; * Added read and write of command list from file and made
;; `w32-exec-predef' smarter.
;; * Made all functions that deals with the command list interactive
;; so that the user can control it.
;; Version 0.1, 2005-03-26
;; * First release.
;; - Customize option to tell from where to populate the shortcuts;
;; StartMenu, AllUsersStartMenu, Desktop, or all.
(defvar w32-exec-predef-command-list nil
"Keeps the list of avaible commands. Populated by
(defun w32-exec-predef-build ()
"Build the command list by recursively look for .lnk files"
(let ((files (findr "\.lnk$" (w32-utl-special-folder "StartMenu")))
(message "Shortcuts found. Building program list...")
(setq link-name (file-name-nondirectory file))
(setq link-name (substring
link-name 0 (- (length link-name) 4)))
(cons link-name (w32-utl-lnk-get-target-and-args file)))
"File to store the command list")
(defun w32-exec-predef-save-command-list ()
(let ((buf (get-buffer-create "*w32-exec-predef-save-command-list*")))
(insert "(setq w32-exec-predef-command-list '")
(print w32-exec-predef-command-list buf)
(write-region (point-min) (point-max)
(defun w32-exec-predef-load-command-list ()
(if (file-exists-p w32-exec-predef-command-list-file-name)
;; The code for w32-exec-predef-read-completing was ripped from the
;; function my-icompleting-read in the Commentary of
;; iswitchb.el. Original code by Kin Cho.
(defun w32-exec-predef-read-completing (prompt choices)
"Use iswitch as a completing-read replacement to choose from
choices. PROMPT is a string to prompt with. CHOICES is a list of
strings to choose from."
(setq iswitchb-temp-buflist choices))))
(defun w32-exec-predef ()
"Using iswitchb completion, execute a program from a list of
programs collected from the user's Start Menu."
;; If command list is empty, try reading it from file. If the file
;; could not be read, the last option is to build the file from
(if (and (eq 0 (length w32-exec-predef-command-list))
(let ((program (cdr
(mapcar (lambda (x)
(w32-shell-execute "Open" (car program) (cadr program))))
;;; w32-exec-predef.el ends here
|[Prev in Thread]
||[Next in Thread]|
- w32-exec-predef.el 0.2,
Mathias Dahl <=