Mercurial > hg > xemacs-beta
comparison lisp/minibuf.el @ 4806:fd36a980d701
Use uninterned symbols in various information-hiding contexts.
lisp/ChangeLog addition:
2010-01-01 Aidan Kehoe <kehoea@parhasard.net>
* syntax.el (map-syntax-table):
* subr.el (map-plist):
* startup.el (load-init-file):
* minibuf.el (read-from-minbuffer):
* cus-edit.el (custom-load-custom-defines-1):
* cmdloop.el (execute-extended-command):
Replace symbol names using underscore, whether to avoid dynamic
scope problems or to ensure helpful arguments to
#'call-with-condition-handler, with uninterned symbols.
src/ChangeLog addition:
2010-01-01 Aidan Kehoe <kehoea@parhasard.net>
* mule-charset.c (Fmake_charset):
Don't intern the symbols used to refer to temporary character
sets, that doesn't bring us anything.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Fri, 01 Jan 2010 19:45:39 +0000 |
parents | 74a5eaa67982 |
children | 668c73e222fd |
comparison
equal
deleted
inserted
replaced
4767:dba492ef7440 | 4806:fd36a980d701 |
---|---|
342 integer) | 342 integer) |
343 :group 'minibuffer) | 343 :group 'minibuffer) |
344 | 344 |
345 (define-error 'input-error "Keyboard input error" 'io-error) | 345 (define-error 'input-error "Keyboard input error" 'io-error) |
346 | 346 |
347 (defun read-from-minibuffer (prompt &optional initial-contents | 347 ((macro |
348 keymap | 348 . (lambda (read-from-minibuffer-definition) |
349 readp | 349 (nsublis |
350 history | 350 ;; `M-x doctor' makes (the interned) history a local variable, use an |
351 abbrev-table | 351 ;; uninterned symbol here so we don't interact with it. |
352 default) | 352 '((history . #:history)) |
353 "Read a string from the minibuffer, prompting with string PROMPT. | 353 read-from-minibuffer-definition))) |
354 (defun read-from-minibuffer (prompt &optional initial-contents keymap | |
355 readp history abbrev-table default) | |
356 "Read a string from the minibuffer, prompting with string PROMPT. | |
354 If optional second arg INITIAL-CONTENTS is non-nil, it is a string | 357 If optional second arg INITIAL-CONTENTS is non-nil, it is a string |
355 to be inserted into the minibuffer before reading input. | 358 to be inserted into the minibuffer before reading input. |
356 If INITIAL-CONTENTS is (STRING . POSITION), the initial input | 359 If INITIAL-CONTENTS is (STRING . POSITION), the initial input |
357 is STRING, but point is placed POSITION characters into the string. | 360 is STRING, but point is placed POSITION characters into the string. |
358 Third arg KEYMAP is a keymap to use while reading; | 361 Third arg KEYMAP is a keymap to use while reading; |
374 Seventh arg DEFAULT, if non-nil, will be returned when user enters | 377 Seventh arg DEFAULT, if non-nil, will be returned when user enters |
375 an empty string. | 378 an empty string. |
376 | 379 |
377 See also the variable `completion-highlight-first-word-only' for | 380 See also the variable `completion-highlight-first-word-only' for |
378 control over completion display." | 381 control over completion display." |
379 (if (and (not enable-recursive-minibuffers) | 382 (if (and (not enable-recursive-minibuffers) |
380 (> (minibuffer-depth) 0) | 383 (> (minibuffer-depth) 0) |
381 (eq (selected-window) (minibuffer-window))) | 384 (eq (selected-window) (minibuffer-window))) |
382 (error "Command attempted to use minibuffer while in minibuffer")) | 385 (error "Command attempted to use minibuffer while in minibuffer")) |
383 | 386 |
384 (if (and minibuffer-max-depth | 387 (if (and minibuffer-max-depth |
385 (> minibuffer-max-depth 0) | 388 (> minibuffer-max-depth 0) |
386 (>= (minibuffer-depth) minibuffer-max-depth)) | 389 (>= (minibuffer-depth) minibuffer-max-depth)) |
387 (minibuffer-max-depth-exceeded)) | 390 (minibuffer-max-depth-exceeded)) |
388 | 391 |
389 ;; catch this error before the poor user has typed something... | 392 ;; catch this error before the poor user has typed something... |
390 (if history | 393 (if history |
391 (if (symbolp history) | 394 (if (symbolp history) |
392 (or (boundp history) | 395 (or (boundp history) |
393 (error "History list %S is unbound" history)) | 396 (error "History list %S is unbound" history)) |
394 (or (boundp (car history)) | 397 (or (boundp (car history)) |
395 (error "History list %S is unbound" (car history))))) | 398 (error "History list %S is unbound" (car history))))) |
396 | 399 |
397 (if (noninteractive) | 400 (if (noninteractive) |
398 (progn | 401 (progn |
399 ;; XEmacs in -batch mode calls minibuffer: print the prompt. | 402 ;; XEmacs in -batch mode calls minibuffer: print the prompt. |
400 (message "%s" (gettext prompt)) | 403 (message "%s" (gettext prompt)) |
401 ;;#### force-output | 404 ;;#### force-output |
402 | 405 |
403 ;;#### Should this even be falling though to the code below? | 406 ;;#### Should this even be falling though to the code below? |
404 ;;#### How does this stuff work now, anyway? | 407 ;;#### How does this stuff work now, anyway? |
405 )) | 408 )) |
406 (let* ((dir default-directory) | 409 (let* ((dir default-directory) |
407 (owindow (selected-window)) | 410 (owindow (selected-window)) |
408 (oframe (selected-frame)) | 411 (oframe (selected-frame)) |
409 (window (minibuffer-window)) | 412 (window (minibuffer-window)) |
410 (buffer (get-buffer-create (format " *Minibuf-%d*" | 413 (buffer (get-buffer-create (format " *Minibuf-%d*" |
411 (minibuffer-depth)))) | 414 (minibuffer-depth)))) |
412 (frame (window-frame window)) | 415 (frame (window-frame window)) |
413 (mconfig (if (eq frame (selected-frame)) | 416 (mconfig (if (eq frame (selected-frame)) |
414 nil (current-window-configuration frame))) | 417 nil (current-window-configuration frame))) |
415 (oconfig (current-window-configuration)) | 418 (oconfig (current-window-configuration)) |
416 ;; dynamic scope sucks sucks sucks sucks sucks sucks. | 419 (minibuffer-default default)) |
417 ;; `M-x doctor' makes history a local variable, and thus | 420 (unwind-protect |
418 ;; our binding above is buffer-local and doesn't apply | |
419 ;; once we switch buffers!!!! We demand better scope! | |
420 (_history_ history) | |
421 (minibuffer-default default)) | |
422 (unwind-protect | |
423 (progn | 421 (progn |
424 (set-buffer (reset-buffer buffer)) | 422 (set-buffer (reset-buffer buffer)) |
425 (setq default-directory dir) | 423 (setq default-directory dir) |
426 (make-local-variable 'print-escape-newlines) | 424 (make-local-variable 'print-escape-newlines) |
427 (setq print-escape-newlines t) | 425 (setq print-escape-newlines t) |
460 (let ((mouse-grabbed-buffer | 458 (let ((mouse-grabbed-buffer |
461 (and minibuffer-smart-completion-tracking-behavior | 459 (and minibuffer-smart-completion-tracking-behavior |
462 (current-buffer))) | 460 (current-buffer))) |
463 (current-prefix-arg current-prefix-arg) | 461 (current-prefix-arg current-prefix-arg) |
464 ;; (help-form minibuffer-help-form) | 462 ;; (help-form minibuffer-help-form) |
465 (minibuffer-history-variable (cond ((not _history_) | 463 (minibuffer-history-variable (cond ((not history) |
466 'minibuffer-history) | 464 'minibuffer-history) |
467 ((consp _history_) | 465 ((consp history) |
468 (car _history_)) | 466 (car history)) |
469 (t | 467 (t |
470 _history_))) | 468 history))) |
471 (minibuffer-history-position (cond ((consp _history_) | 469 (minibuffer-history-position (cond ((consp history) |
472 (cdr _history_)) | 470 (cdr history)) |
473 (t | 471 (t |
474 0))) | 472 0))) |
475 (minibuffer-scroll-window owindow)) | 473 (minibuffer-scroll-window owindow)) |
476 (setq initial-minibuffer-history-position | 474 (setq initial-minibuffer-history-position |
477 minibuffer-history-position) | 475 minibuffer-history-position) |
478 (if abbrev-table | 476 (if abbrev-table |
479 (setq local-abbrev-table abbrev-table | 477 (setq local-abbrev-table abbrev-table |
480 abbrev-mode t)) | 478 abbrev-mode t)) |
481 ;; This is now run from read-minibuffer-internal | 479 ;; This is now run from read-minibuffer-internal |
482 ;(if minibuffer-setup-hook | 480 ;(if minibuffer-setup-hook |
483 ; (run-hooks 'minibuffer-setup-hook)) | 481 ; (run-hooks 'minibuffer-setup-hook)) |
484 ;(message nil) | 482 ;(message nil) |
485 (if (eq 't | 483 (if (eq 't |
486 (catch 'exit | 484 (catch 'exit |
487 (if (> (recursion-depth) (minibuffer-depth)) | 485 (if (> (recursion-depth) (minibuffer-depth)) |
488 (let ((standard-output t) | 486 (let ((standard-output t) |
489 (standard-input t)) | 487 (standard-input t)) |
490 (read-minibuffer-internal prompt)) | 488 (read-minibuffer-internal prompt)) |
491 (read-minibuffer-internal prompt)))) | 489 (read-minibuffer-internal prompt)))) |
492 ;; Translate an "abort" (throw 'exit 't) | 490 ;; Translate an "abort" (throw 'exit 't) |
493 ;; into a real quit | 491 ;; into a real quit |
494 (signal 'quit '()) | 492 (signal 'quit '()) |
495 ;; return value | 493 ;; return value |
496 (let* ((val (progn (set-buffer buffer) | 494 (let* ((val (progn (set-buffer buffer) |
536 (if minibuffer-history-uniquify | 534 (if minibuffer-history-uniquify |
537 (cons histval (remove histval list)) | 535 (cons histval (remove histval list)) |
538 (cons histval list)))))) | 536 (cons histval list)))))) |
539 (if err (signal (car err) (cdr err))) | 537 (if err (signal (car err) (cdr err))) |
540 val)))) | 538 val)))) |
541 ;; stupid display code requires this for some reason | 539 ;; stupid display code requires this for some reason |
542 (set-buffer buffer) | 540 (set-buffer buffer) |
543 (buffer-disable-undo buffer) | 541 (buffer-disable-undo buffer) |
544 (setq buffer-read-only nil) | 542 (setq buffer-read-only nil) |
545 (erase-buffer) | 543 (erase-buffer) |
546 | 544 |
547 ;; restore frame configurations | 545 ;; restore frame configurations |
548 (if (and mconfig (frame-live-p oframe) | 546 (if (and mconfig (frame-live-p oframe) |
549 (eq frame (selected-frame))) | 547 (eq frame (selected-frame))) |
550 ;; if we changed frames (due to surrogate minibuffer), | 548 ;; if we changed frames (due to surrogate minibuffer), |
551 ;; and we're still on the new frame, go back to the old one. | 549 ;; and we're still on the new frame, go back to the old one. |
552 (select-frame oframe)) | 550 (select-frame oframe)) |
553 (if mconfig (set-window-configuration mconfig)) | 551 (if mconfig (set-window-configuration mconfig)) |
554 (set-window-configuration oconfig)))) | 552 (set-window-configuration oconfig))))) |
555 | |
556 | 553 |
557 (defun minibuffer-max-depth-exceeded () | 554 (defun minibuffer-max-depth-exceeded () |
558 ;; | 555 ;; |
559 ;; This signals an error if an Nth minibuffer is invoked while N-1 are | 556 ;; This signals an error if an Nth minibuffer is invoked while N-1 are |
560 ;; already active, whether the minibuffer window is selected or not. | 557 ;; already active, whether the minibuffer window is selected or not. |