This variable is set by `ivy-read' and used by `ivy--set-candidates'.")
+(defcustom ivy-use-ignore-default t
+ "The default policy for user-configured candidate filtering."
+ :type '(choice
+ (const :tag "Ignore ignored always" always)
+ (const :tag "Ignore ignored when others exist" t)
+ (const :tag "Don't ignore" nil)))
+
(defvar ivy-use-ignore t
- "Store policy for user-configured candidate filtering.")
+ "Store policy for user-configured candidate filtering.
+This may be changed dynamically by `ivy-toggle-ignore'.
+Use `ivy-use-ignore-default' for a permanent configuration.")
(defvar ivy--default nil
"Default initial input.")
(defun ivy-toggle-ignore ()
"Toggle user-configured candidate filtering."
(interactive)
- (setq ivy-use-ignore (null ivy-use-ignore))
+ (setq ivy-use-ignore
+ (if ivy-use-ignore
+ nil
+ (or ivy-use-ignore-default t)))
;; invalidate cache
(setq ivy--old-cands nil))
(setq ivy--full-length nil)
(setq ivy-text "")
(setq ivy-calling nil)
- (setq ivy-use-ignore t)
+ (setq ivy-use-ignore ivy-use-ignore-default)
(let (coll sort-fn)
(cond ((eq collection 'Info-read-node-name-1)
(if (equal Info-current-file "dir")
:test #'equal)))
(setq coll (all-completions "" collection predicate))))
((eq collection 'read-file-name-internal)
- (setq ivy--directory default-directory)
+ (if (and initial-input (file-directory-p initial-input))
+ (progn
+ (setq ivy--directory initial-input)
+ (setq initial-input nil))
+ (setq ivy--directory default-directory))
(require 'dired)
(when preselect
(let ((preselect-directory (file-name-directory preselect)))
match-len)
(while (and (string-match " +" str start1)
(< start1 len))
- (setq match-len (- (match-end 0) (match-beginning 0)))
- (if (= match-len 1)
+ (if (and (> (match-beginning 0) 2)
+ (string= "[^" (substring
+ str
+ (- (match-beginning 0) 2)
+ (match-beginning 0))))
(progn
- (when start0
- (setq start1 start0)
- (setq start0 nil))
- (push (substring str start1 (match-beginning 0)) res)
- (setq start1 (match-end 0)))
- (setq str (replace-match
- (make-string (1- match-len) ?\ )
- nil nil str))
- (setq start0 (or start0 start1))
- (setq start1 (1- (match-end 0)))))
+ (setq start1 (match-end 0))
+ (setq start0 0))
+ (setq match-len (- (match-end 0) (match-beginning 0)))
+ (if (= match-len 1)
+ (progn
+ (when start0
+ (setq start1 start0)
+ (setq start0 nil))
+ (push (substring str start1 (match-beginning 0)) res)
+ (setq start1 (match-end 0)))
+ (setq str (replace-match
+ (make-string (1- match-len) ?\ )
+ nil nil str))
+ (setq start0 (or start0 start1))
+ (setq start1 (1- (match-end 0))))))
(if start0
(push (substring str start0) res)
(setq s (substring str start1))
(not (eq ivy--regex-function 'ivy--regex-fuzzy)))
(unless ivy--old-re
(setq ivy--old-re (funcall ivy--regex-function ivy-text)))
- (while (and (string-match ivy--old-re str start)
- (> (- (match-end 0) (match-beginning 0)) 0))
- (setq start (match-end 0))
- (let ((i 0))
- (while (<= i ivy--subexps)
- (let ((face
- (cond ((zerop ivy--subexps)
- (cadr ivy-minibuffer-faces))
- ((zerop i)
- (car ivy-minibuffer-faces))
- (t
- (nth (1+ (mod (+ i 2) (1- (length ivy-minibuffer-faces))))
- ivy-minibuffer-faces)))))
- (ivy-add-face-text-property
- (match-beginning i) (match-end i)
- face str))
- (cl-incf i))))))
+ (ignore-errors
+ (while (and (string-match ivy--old-re str start)
+ (> (- (match-end 0) (match-beginning 0)) 0))
+ (setq start (match-end 0))
+ (let ((i 0))
+ (while (<= i ivy--subexps)
+ (let ((face
+ (cond ((zerop ivy--subexps)
+ (cadr ivy-minibuffer-faces))
+ ((zerop i)
+ (car ivy-minibuffer-faces))
+ (t
+ (nth (1+ (mod (+ i 2) (1- (length ivy-minibuffer-faces))))
+ ivy-minibuffer-faces)))))
+ (ivy-add-face-text-property
+ (match-beginning i) (match-end i)
+ face str))
+ (cl-incf i)))))))
str))
(ivy-set-display-transformer
(string-match-p f-or-r buf)))
ivy-ignore-buffers))
res)
- res))))
+ (and (eq ivy-use-ignore t)
+ res)))))
(ivy-set-display-transformer
'ivy-switch-buffer 'ivy-switch-buffer-transformer)
(declare-function swiper--cleanup "swiper")
(declare-function swiper--add-overlays "swiper")
(defvar ivy-occur-timer nil)
+(defvar counsel-grep-last-line)
(defun ivy-occur-press ()
"Execute action for the current candidate."
(action (ivy--get-action ivy-last))
(ivy-exit 'done))
(with-ivy-window
+ (setq counsel-grep-last-line nil)
(funcall action
(if (and (consp coll)
(consp (car coll)))