comparison lisp/emulation/edt.el @ 108791:737446e13a3f

* lisp/emulation/edt.el (edt-load-keys): Use locate-library. This simplifies the code, and handles compressed .el.gz files, which the previous version did not.
author Glenn Morris <rgm@gnu.org>
date Tue, 25 May 2010 21:06:09 -0700
parents be3f6d650654
children 7a3558eb670e
comparison
equal deleted inserted replaced
108790:1b3be6d705bd 108791:737446e13a3f
1 ;;; edt.el --- enhanced EDT keypad mode emulation for GNU Emacs 19 1 ;;; edt.el --- enhanced EDT keypad mode emulation for GNU Emacs 19
2 2
3 ;; Copyright (C) 1986, 1992, 1993, 1994, 1995, 2000, 2001, 2002, 2003, 3 ;; Copyright (C) 1986, 1992, 1993, 1994, 1995, 2000, 2001, 2002, 2003,
4 ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 ;; Free Software Foundation, Inc.
5 6
6 ;; Author: Kevin Gallagher <Kevin.Gallagher@boeing.com> 7 ;; Author: Kevin Gallagher <Kevin.Gallagher@boeing.com>
7 ;; Maintainer: Kevin Gallagher <Kevin.Gallagher@boeing.com> 8 ;; Maintainer: Kevin Gallagher <Kevin.Gallagher@boeing.com>
8 ;; Keywords: emulations 9 ;; Keywords: emulations
9 10
2054 (erase-buffer) 2055 (erase-buffer)
2055 (insert " 2056 (insert "
2056 2057
2057 Ack!! You're running the Enhanced EDT Emulation without loading an 2058 Ack!! You're running the Enhanced EDT Emulation without loading an
2058 EDT key mapping file. To create an EDT key mapping file, run the 2059 EDT key mapping file. To create an EDT key mapping file, run the
2059 edt-mapper.el program. It is safest to run it from an Emacs loaded 2060 edt-mapper program. It is safest to run it from an Emacs loaded
2060 without any of your own customizations found in your .emacs file, etc. 2061 without any of your own customizations found in your .emacs file, etc.
2061 The reason for this is that some user customizations confuse edt-mapper. 2062 The reason for this is that some user customizations confuse edt-mapper.
2062 You can do this by quitting Emacs and then invoking Emacs again as 2063 You can do this by quitting Emacs and then invoking Emacs again as
2063 follows: 2064 follows:
2064 2065
2065 emacs -q -l edt-mapper.el 2066 emacs -q -l edt-mapper
2066 2067
2067 [NOTE: If you do nothing out of the ordinary in your .emacs file, and 2068 [NOTE: If you do nothing out of the ordinary in your .emacs file, and
2068 the search for edt-mapper.el is successful, you can try running it now.] 2069 the search for edt-mapper is successful, you can try running it now.]
2069 2070
2070 The file edt-mapper.el includes these same directions on how to 2071 The library edt-mapper includes these same directions on how to
2071 use it! Perhaps it's lying around here someplace. \n ") 2072 use it! Perhaps it's lying around here someplace. \n ")
2072 (let ((file "edt-mapper.el") 2073 (let ((path (locate-library
2073 (found nil) 2074 "edt-mapper"
2074 (path nil) 2075 nil (append (list (expand-file-name ".")) load-path))))
2075 (search-list (append (list (expand-file-name ".")) load-path))) 2076 (if path
2076 (while (and (not found) search-list) 2077 (progn
2077 (setq path (concat (car search-list) 2078 (insert (format
2078 (if (string-match "/$" (car search-list)) "" "/") 2079 "Ah yes, there it is, in \n\n %s \n\n" path))
2079 file)) 2080 (if (edt-y-or-n-p "Do you want to run it now? ")
2080 (if (and (file-exists-p path) (not (file-directory-p path))) 2081 (load-file path)
2081 (setq found t)) 2082 (error "EDT Emulation not configured")))
2082 (setq search-list (cdr search-list))) 2083 (insert "Nope, I can't seem to find it. :-(\n\n")
2083 (cond (found 2084 (sit-for 20)
2084 (insert (format 2085 (error "EDT Emulation not configured"))))))
2085 "Ah yes, there it is, in \n\n %s \n\n" path))
2086 (if (edt-y-or-n-p "Do you want to run it now? ")
2087 (load-file path)
2088 (error "EDT Emulation not configured")))
2089 (t
2090 (insert "Nope, I can't seem to find it. :-(\n\n")
2091 (sit-for 20)
2092 (error "EDT Emulation not configured")))))))
2093 2086
2094 ;;; 2087 ;;;
2095 ;;; Turning the EDT Emulation on and off. 2088 ;;; Turning the EDT Emulation on and off.
2096 ;;; 2089 ;;;
2097 2090