comparison lisp/cmdloop.el @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 8626e4521993
children de805c49cfc1
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
317 (t 317 (t
318 "M-x "))))) 318 "M-x ")))))
319 319
320 (if (and teach-extended-commands-p 320 (if (and teach-extended-commands-p
321 (interactive-p)) 321 (interactive-p))
322 ;; We need to fiddle with keys: remember the keys, run the 322 ;; Remember the keys, run the command, and show the keys (if
323 ;; command, and show the keys (if any). 323 ;; any). The funny variable names are a poor man's guarantee
324 ;; that we don't get tripped by this-command doing something
325 ;; funny. Quoth our forefathers: "We want lexical scope!"
324 (let ((_execute_command_keys_ (where-is-internal this-command)) 326 (let ((_execute_command_keys_ (where-is-internal this-command))
325 (_execute_command_name_ this-command)) ; the name can change 327 (_execute_command_name_ this-command)) ; the name can change
326 (command-execute this-command t) 328 (command-execute this-command t)
327 (when (and _execute_command_keys_ 329 (when _execute_command_keys_
328 ;; Wait for a while, so the user can see a message 330 ;; Normally the region is adjusted in post_command_hook;
329 ;; printed, if any. 331 ;; however, it is not called until after we finish. It
330 (sit-for 1)) 332 ;; looks ugly for the region to get updated after the
331 (display-message 333 ;; delays, so we do it now. The code below is a Lispified
332 'no-log 334 ;; copy of code in event-stream.c:post_command_hook().
333 (format "Command `%s' is bound to key%s: %s" 335 (if (and (not zmacs-region-stays)
334 _execute_command_name_ 336 (or (not (eq (selected-window) (minibuffer-window)))
335 (if (cdr _execute_command_keys_) "s" "") 337 (eq (zmacs-region-buffer) (current-buffer))))
336 (sorted-key-descriptions _execute_command_keys_))) 338 (zmacs-deactivate-region)
337 (sit-for teach-extended-commands-timeout) 339 (zmacs-update-region))
338 (clear-message 'no-log))) 340 ;; Wait for a while, so the user can see a message printed,
341 ;; if any.
342 (when (sit-for 1)
343 (display-message
344 'no-log
345 (format (if (cdr _execute_command_keys_)
346 "Command `%s' is bound to keys: %s"
347 "Command `%s' is bound to key: %s")
348 _execute_command_name_
349 (sorted-key-descriptions _execute_command_keys_)))
350 (sit-for teach-extended-commands-timeout)
351 (clear-message 'no-log))))
339 ;; Else, just run the command. 352 ;; Else, just run the command.
340 (command-execute this-command t))) 353 (command-execute this-command t)))
341 354
342 355
343 ;;; C code calls this; the underscores in the variable names are to avoid 356 ;;; C code calls this; the underscores in the variable names are to avoid