Commit 8bbb7c70 authored by Miles Bader's avatar Miles Bader
Browse files

(minibuf-eldef-setup-minibuffer)

(minibuf-eldef-update-minibuffer): Use `minibuffer-' functions
instead of calling `field-' functions directly.
(minibuf-eldef-setup-minibuffer): Remove unused variable `prompt'.
parent a346ec72
;;; minibuf-eldef.el --- Only show defaults in prompts when applicable ;;; minibuf-eldef.el --- Only show defaults in prompts when applicable
;; ;;
;; Copyright (C) 2000 Free Software Foundation, Inc. ;; Copyright (C) 2000, 2001 Free Software Foundation, Inc.
;; ;;
;; Author: Miles Bader <miles@gnu.org> ;; Author: Miles Bader <miles@gnu.org>
;; Keywords: convenience ;; Keywords: convenience
...@@ -76,15 +76,14 @@ regexp subexpression that matched.") ...@@ -76,15 +76,14 @@ regexp subexpression that matched.")
(defun minibuf-eldef-setup-minibuffer () (defun minibuf-eldef-setup-minibuffer ()
"Set up a minibuffer for `minibuffer-electric-default-mode'. "Set up a minibuffer for `minibuffer-electric-default-mode'.
The prompt and initial input should already have been inserted." The prompt and initial input should already have been inserted."
(let ((prompt (field-string-no-properties (point-min))) (let ((regexps minibuffer-default-in-prompt-regexps)
(regexps minibuffer-default-in-prompt-regexps)
(match nil) (match nil)
(inhibit-point-motion-hooks t)) (inhibit-point-motion-hooks t))
(save-excursion (save-excursion
(save-restriction (save-restriction
;; Narrow to only the prompt ;; Narrow to only the prompt
(goto-char (point-min)) (goto-char (point-min))
(narrow-to-region (point) (field-end)) (narrow-to-region (point) (minibuffer-prompt-end))
;; See the prompt contains a default input indicator ;; See the prompt contains a default input indicator
(while regexps (while regexps
(setq match (pop regexps)) (setq match (pop regexps))
...@@ -101,7 +100,7 @@ The prompt and initial input should already have been inserted." ...@@ -101,7 +100,7 @@ The prompt and initial input should already have been inserted."
(make-overlay (match-beginning match) (match-end match))) (make-overlay (match-beginning match) (match-end match)))
(setq minibuf-eldef-showing-default-in-prompt t) (setq minibuf-eldef-showing-default-in-prompt t)
(setq minibuf-eldef-initial-input (setq minibuf-eldef-initial-input
(field-string-no-properties (point-max))) (minibuffer-contents-no-properties))
(setq minibuf-eldef-initial-buffer-length (point-max)) (setq minibuf-eldef-initial-buffer-length (point-max))
(add-to-list 'minibuf-eldef-frobbed-minibufs (current-buffer)) (add-to-list 'minibuf-eldef-frobbed-minibufs (current-buffer))
(add-hook 'post-command-hook #'minibuf-eldef-update-minibuffer nil t)))) (add-hook 'post-command-hook #'minibuf-eldef-update-minibuffer nil t))))
...@@ -114,7 +113,7 @@ This is intended to be used as a minibuffer post-command-hook for ...@@ -114,7 +113,7 @@ This is intended to be used as a minibuffer post-command-hook for
been set up by `minibuf-eldef-setup-minibuffer'." been set up by `minibuf-eldef-setup-minibuffer'."
(unless (eq minibuf-eldef-showing-default-in-prompt (unless (eq minibuf-eldef-showing-default-in-prompt
(and (= (point-max) minibuf-eldef-initial-buffer-length) (and (= (point-max) minibuf-eldef-initial-buffer-length)
(string-equal (field-string-no-properties (point-max)) (string-equal (minibuffer-contents-no-properties)
minibuf-eldef-initial-input))) minibuf-eldef-initial-input)))
;; swap state ;; swap state
(setq minibuf-eldef-showing-default-in-prompt (setq minibuf-eldef-showing-default-in-prompt
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment