comparison lisp/emulation/viper-cmd.el @ 111426:5dbc2ccef17c

Silence viper-cmd compilation. * lisp/emulation/viper-cmd.el (viper-read-string-with-history): Prefix dynamic local `initial'. (viper-minibuffer-standard-hook): Update for above name change.
author Glenn Morris <rgm@gnu.org>
date Sat, 06 Nov 2010 12:44:11 -0700
parents 280c8ae2476d
children 56b71cddc9c5
comparison
equal deleted inserted replaced
111425:9ee34f35bd15 111426:5dbc2ccef17c
1 ;;; viper-cmd.el --- Vi command support for Viper 1 ;;; viper-cmd.el --- Vi command support for Viper
2 2
3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 ;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 5
6 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> 6 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
7 ;; Package: viper 7 ;; Package: viper
8 8
9 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
40 (defvar iso-accents-mode) 40 (defvar iso-accents-mode)
41 (defvar quail-mode) 41 (defvar quail-mode)
42 (defvar quail-current-str) 42 (defvar quail-current-str)
43 (defvar mark-even-if-inactive) 43 (defvar mark-even-if-inactive)
44 (defvar init-message) 44 (defvar init-message)
45 (defvar initial) 45 (defvar viper-initial)
46 (defvar undo-beg-posn) 46 (defvar undo-beg-posn)
47 (defvar undo-end-posn) 47 (defvar undo-end-posn)
48 48
49 (eval-and-compile 49 (eval-and-compile
50 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) 50 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
2063 viper-last-insertion nil 2063 viper-last-insertion nil
2064 viper-command-ring nil) 2064 viper-command-ring nil)
2065 (funcall hook) 2065 (funcall hook)
2066 )) 2066 ))
2067 2067
2068 ;; Thie is a temp hook that uses free variables init-message and initial. 2068 ;; This is a temp hook that uses free variables init-message and viper-initial.
2069 ;; A dirty feature, but it is the simplest way to have it do the right thing. 2069 ;; A dirty feature, but it is the simplest way to have it do the right thing.
2070 ;; The INIT-MESSAGE and INITIAL vars come from the scope set by 2070 ;; The INIT-MESSAGE and VIPER-INITIAL vars come from the scope set by
2071 ;; viper-read-string-with-history 2071 ;; viper-read-string-with-history
2072 (defun viper-minibuffer-standard-hook () 2072 (defun viper-minibuffer-standard-hook ()
2073 (if (stringp init-message) 2073 (if (stringp init-message)
2074 (viper-tmp-insert-at-eob init-message)) 2074 (viper-tmp-insert-at-eob init-message))
2075 (if (stringp initial) 2075 (when (stringp viper-initial)
2076 (progn 2076 ;; don't wait if we have unread events or in kbd macro
2077 ;; don't wait if we have unread events or in kbd macro 2077 (or unread-command-events
2078 (or unread-command-events 2078 executing-kbd-macro
2079 executing-kbd-macro 2079 (sit-for 840))
2080 (sit-for 840)) 2080 (if (fboundp 'minibuffer-prompt-end)
2081 (if (fboundp 'minibuffer-prompt-end) 2081 (delete-region (minibuffer-prompt-end) (point-max))
2082 (delete-region (minibuffer-prompt-end) (point-max)) 2082 (erase-buffer))
2083 (erase-buffer)) 2083 (insert viper-initial)))
2084 (insert initial))))
2085 2084
2086 (defsubst viper-minibuffer-real-start () 2085 (defsubst viper-minibuffer-real-start ()
2087 (if (fboundp 'minibuffer-prompt-end) 2086 (if (fboundp 'minibuffer-prompt-end)
2088 (minibuffer-prompt-end) 2087 (minibuffer-prompt-end)
2089 (point-min))) 2088 (point-min)))
2178 (delete-region (point) (point-max))))) 2177 (delete-region (point) (point-max)))))
2179 2178
2180 2179
2181 ;;; Reading string with history 2180 ;;; Reading string with history
2182 2181
2183 (defun viper-read-string-with-history (prompt &optional initial 2182 (defun viper-read-string-with-history (prompt &optional viper-initial
2184 history-var default keymap 2183 history-var default keymap
2185 init-message) 2184 init-message)
2186 ;; Read string, prompting with PROMPT and inserting the INITIAL 2185 ;; Read string, prompting with PROMPT and inserting the VIPER-INITIAL
2187 ;; value. Uses HISTORY-VAR. DEFAULT is the default value to accept if the 2186 ;; value. Uses HISTORY-VAR. DEFAULT is the default value to accept if the
2188 ;; input is an empty string. 2187 ;; input is an empty string.
2189 ;; Default value is displayed until the user types something in the 2188 ;; Default value is displayed until the user types something in the
2190 ;; minibuffer. 2189 ;; minibuffer.
2191 ;; KEYMAP is used, if given, instead of minibuffer-local-map. 2190 ;; KEYMAP is used, if given, instead of minibuffer-local-map.
2204 (val "") 2203 (val "")
2205 (padding "") 2204 (padding "")
2206 temp-msg) 2205 temp-msg)
2207 2206
2208 (setq keymap (or keymap minibuffer-local-map) 2207 (setq keymap (or keymap minibuffer-local-map)
2209 initial (or initial "") 2208 viper-initial (or viper-initial "")
2210 temp-msg (if default 2209 temp-msg (if default
2211 (format "(default %s) " default) 2210 (format "(default %s) " default)
2212 "")) 2211 ""))
2213 2212
2214 (setq viper-incomplete-ex-cmd nil) 2213 (setq viper-incomplete-ex-cmd nil)
2215 (setq val (read-from-minibuffer prompt 2214 (setq val (read-from-minibuffer prompt
2216 (concat temp-msg initial val padding) 2215 (concat temp-msg viper-initial val padding)
2217 keymap nil history-var)) 2216 keymap nil history-var))
2218 (setq minibuffer-setup-hook nil 2217 (setq minibuffer-setup-hook nil
2219 padding (viper-array-to-string (this-command-keys)) 2218 padding (viper-array-to-string (this-command-keys))
2220 temp-msg "") 2219 temp-msg "")
2221 ;; the following tries to be smart about what to put in history 2220 ;; the following tries to be smart about what to put in history
5091 )) 5090 ))
5092 5091
5093 5092
5094 5093
5095 5094
5096 ;; arch-tag: 739a6450-5fda-44d0-88b0-325053d888c2
5097 ;;; viper-cmd.el ends here 5095 ;;; viper-cmd.el ends here