completing buffers it means kill the buffer. Both actions
require user confirmation."
(interactive)
- (let ((beg (icomplete--field-beg)) (end (icomplete--field-end)))
+ (let ((end (icomplete--field-end)))
(if (< (point) end)
(call-interactively 'kill-line)
- (let* ((md (completion--field-metadata beg))
- (category (alist-get 'category (cdr md)))
- (all (completion-all-sorted-completions))
+ (let* ((all (completion-all-sorted-completions))
(thing (car all))
(action
- (pcase category
+ (pcase (icomplete--category)
(`buffer
(lambda ()
(when (yes-or-no-p (concat "Kill buffer " thing "? "))
(defun icomplete-fido-delete-char ()
"Delete char or maybe call `dired', like `ido-mode'."
(interactive)
- (let* ((beg (icomplete--field-beg))
- (end (icomplete--field-end))
- (md (completion--field-metadata beg))
- (category (alist-get 'category (cdr md))))
- (if (or (< (point) end) (not (eq category 'file)))
+ (let ((end (icomplete--field-end)))
+ (if (or (< (point) end) (not (eq (icomplete--category) 'file)))
(call-interactively 'delete-char)
(dired (file-name-directory (icomplete--field-string)))
(exit-minibuffer))))
(defun icomplete-fido-ret ()
"Exit minibuffer or enter directory, like `ido-mode'."
(interactive)
- (let* ((beg (icomplete--field-beg))
- (md (completion--field-metadata beg))
- (category (alist-get 'category (cdr md)))
- (dir (and (eq category 'file)
+ (let* ((dir (and (eq (icomplete--category) 'file)
(file-name-directory (icomplete--field-string))))
(current (car (completion-all-sorted-completions)))
(probe (and dir current
(defun icomplete-fido-backward-updir ()
"Delete char before or go up directory, like `ido-mode'."
(interactive)
- (let* ((beg (icomplete--field-beg))
- (md (completion--field-metadata beg))
- (category (alist-get 'category (cdr md))))
- (if (and (eq (char-before) ?/) (eq category 'file))
- (backward-kill-sexp 1)
- (call-interactively 'backward-delete-char))))
+ (if (and (eq (char-before) ?/)
+ (eq (icomplete--category) 'file))
+ (backward-kill-sexp 1)
+ (call-interactively 'backward-delete-char)))
(defvar icomplete-fido-mode-map
(let ((map (make-sparse-keymap)))
(defun icomplete--field-end ()
(if (window-minibuffer-p) (point-max)
(nth 1 completion-in-region--data)))
+(defun icomplete--category ()
+ (let* ((beg (icomplete--field-beg))
+ (md (completion--field-metadata beg)))
+ (alist-get 'category (cdr md))))
;;;_ > icomplete-simple-completing-p ()
(defun icomplete-simple-completing-p ()
(sit-for icomplete-compute-delay)))
(when (and
icomplete-tidy-shadowed-file-names
- (eq (alist-get 'category
- (cdr (completion--field-metadata
- (icomplete--field-beg))))
- 'file)
+ (eq (icomplete--category) 'file)
rfn-eshadow-overlay (overlay-buffer rfn-eshadow-overlay)
(eq this-command 'self-insert-command)
(= saved-point (icomplete--field-end))