(format "%d chars more" (- n (length ivy-text)))))
(defun counsel-unquote-regex-parens (str)
- (replace-regexp-in-string
- "\\\\)" ")"
- (replace-regexp-in-string
- "\\\\(" "("
- str)))
+ (let ((start 0)
+ ms)
+ (while (setq start (string-match "\\\\)\\|\\\\(\\|[()]" str start))
+ (setq ms (match-string-no-properties 0 str))
+ (cond ((equal ms "\\(")
+ (setq str (replace-match "(" nil t str))
+ (setq start (+ start 1)))
+ ((equal ms "\\)")
+ (setq str (replace-match ")" nil t str))
+ (setq start (+ start 1)))
+ ((equal ms "(")
+ (setq str (replace-match "\\(" nil t str))
+ (setq start (+ start 2)))
+ ((equal ms ")")
+ (setq str (replace-match "\\)" nil t str))
+ (setq start (+ start 2)))
+ (t
+ (error "unexpected"))))
+ str))
(defun counsel-directory-parent (dir)
"Return the directory parent of directory DIR."
;;** `counsel-M-x'
(ivy-set-actions
'counsel-M-x
- '(("d" counsel--find-symbol "definition")))
+ '(("d" counsel--find-symbol "definition")
+ ("h" (lambda (x) (describe-function (intern x))) "help")))
(ivy-set-display-transformer
'counsel-M-x
(when f (expand-file-name f))))
:require-match 'confirm-after-completion
:history 'file-name-history
- :keymap counsel-find-file-map))
+ :keymap counsel-find-file-map
+ :caller 'counsel-find-file))
(defun counsel-up-directory ()
"Go to the parent directory preselecting the current one."
(setq ivy--old-re
(ivy--regex string)))))
(counsel--async-command
- (format "grep -nP --ignore-case '%s' %s" regex counsel--git-grep-dir))
+ (format "grep -nE --ignore-case \"%s\" %s" regex counsel--git-grep-dir))
nil)))
(defun counsel-grep-action (x)