Fix indentation according to dir-locals-file
This commit is contained in:
parent
7817fe8895
commit
b37d082297
1 changed files with 106 additions and 106 deletions
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
(require 'counsel)
|
(require 'counsel)
|
||||||
(require 'projectile)
|
(require 'projectile)
|
||||||
|
|
||||||
;;;; global
|
;;;; global
|
||||||
|
|
||||||
(defgroup counsel-projectile nil
|
(defgroup counsel-projectile nil
|
||||||
|
|
@ -64,7 +64,7 @@ function, and a name for each action)."
|
||||||
(eval
|
(eval
|
||||||
`(defcustom ,(intern (format "%s-action" command))
|
`(defcustom ,(intern (format "%s-action" command))
|
||||||
',action
|
',action
|
||||||
,(format "Action(s) for `%s'.
|
,(format "Action(s) for `%s'.
|
||||||
|
|
||||||
This variable holds either a single action function (function of
|
This variable holds either a single action function (function of
|
||||||
one variable, the selected candidate) or an action list
|
one variable, the selected candidate) or an action list
|
||||||
|
|
@ -74,7 +74,7 @@ consisting of:
|
||||||
action, etc),
|
action, etc),
|
||||||
- the available actions, each of which consists of:
|
- the available actions, each of which consists of:
|
||||||
- a key (string) to call the action,
|
- a key (string) to call the action,
|
||||||
- an action function of one variable,
|
- an action function of one variable,
|
||||||
- a name (string) for the action.
|
- a name (string) for the action.
|
||||||
|
|
||||||
In both cases, extra actions can be added with `ivy-set-actions'.
|
In both cases, extra actions can be added with `ivy-set-actions'.
|
||||||
|
|
@ -105,24 +105,24 @@ the default action in the list and the remaining elements are the
|
||||||
actions (a key, a function, and a name for each action)."
|
actions (a key, a function, and a name for each action)."
|
||||||
(let (index)
|
(let (index)
|
||||||
(if (integerp action-item)
|
(if (integerp action-item)
|
||||||
(when (and (> action-item 0)
|
(when (and (> action-item 0)
|
||||||
(< action-item (length action-list)))
|
(< action-item (length action-list)))
|
||||||
(setq index action-item))
|
(setq index action-item))
|
||||||
(setq index (cl-position-if
|
(setq index (cl-position-if
|
||||||
(cond
|
(cond
|
||||||
((functionp action-item)
|
((functionp action-item)
|
||||||
(lambda (action)
|
(lambda (action)
|
||||||
(equal action-item
|
(equal action-item
|
||||||
(cadr action))))
|
(cadr action))))
|
||||||
((stringp action-item)
|
((stringp action-item)
|
||||||
(lambda (action)
|
(lambda (action)
|
||||||
(member action-item
|
(member action-item
|
||||||
(list (car action) (caddr action))))))
|
(list (car action) (caddr action))))))
|
||||||
(cdr action-list)))
|
(cdr action-list)))
|
||||||
(when index
|
(when index
|
||||||
(setq index (1+ index))))
|
(setq index (1+ index))))
|
||||||
(or index
|
(or index
|
||||||
(error "Action not found: %s" action-item))))
|
(error "Action not found: %s" action-item))))
|
||||||
|
|
||||||
(defun counsel-projectile-modify-action (action-var modifications)
|
(defun counsel-projectile-modify-action (action-var modifications)
|
||||||
"Make MODIFICATIONS to ACTION-VAR.
|
"Make MODIFICATIONS to ACTION-VAR.
|
||||||
|
|
@ -178,69 +178,69 @@ following formats:
|
||||||
|
|
||||||
If anything goes wrong, throw an error and do not modify ACTION-VAR."
|
If anything goes wrong, throw an error and do not modify ACTION-VAR."
|
||||||
(let ((action-list (symbol-value action-var))
|
(let ((action-list (symbol-value action-var))
|
||||||
mod)
|
mod)
|
||||||
;; Make sure ACTION-VAR actually holds a list and not a single
|
;; Make sure ACTION-VAR actually holds a list and not a single
|
||||||
;; action function
|
;; action function
|
||||||
(unless (listp action-list)
|
(unless (listp action-list)
|
||||||
(error "%s's value is not a list" action-var))
|
(error "%s's value is not a list" action-var))
|
||||||
(while (setq mod (pop modifications))
|
(while (setq mod (pop modifications))
|
||||||
(pcase mod
|
(pcase mod
|
||||||
(`(remove ,action-item)
|
(`(remove ,action-item)
|
||||||
(setq action-list
|
(setq action-list
|
||||||
(remove (nth (counsel-projectile--action-index action-item action-list)
|
(remove (nth (counsel-projectile--action-index action-item action-list)
|
||||||
action-list)
|
action-list)
|
||||||
action-list)))
|
action-list)))
|
||||||
(`(add ,action ,target-item)
|
(`(add ,action ,target-item)
|
||||||
(let ((index (counsel-projectile--action-index target-item action-list)))
|
(let ((index (counsel-projectile--action-index target-item action-list)))
|
||||||
;; copied from `helm-append-at-nth'
|
;; copied from `helm-append-at-nth'
|
||||||
(setq action-list (cl-loop for a in action-list
|
(setq action-list (cl-loop for a in action-list
|
||||||
for count from 1
|
for count from 1
|
||||||
collect a
|
collect a
|
||||||
when (= count index)
|
when (= count index)
|
||||||
collect action))))
|
collect action))))
|
||||||
(`(add ,action)
|
(`(add ,action)
|
||||||
(setq action-list (append action-list (list action))))
|
(setq action-list (append action-list (list action))))
|
||||||
(`(move ,action-item ,target-item)
|
(`(move ,action-item ,target-item)
|
||||||
(push `(add ,(nth (counsel-projectile--action-index action-item action-list)
|
(push `(add ,(nth (counsel-projectile--action-index action-item action-list)
|
||||||
action-list)
|
action-list)
|
||||||
,target-item)
|
,target-item)
|
||||||
modifications)
|
modifications)
|
||||||
(push `(remove ,action-item)
|
(push `(remove ,action-item)
|
||||||
modifications))
|
modifications))
|
||||||
(`(move ,action-item)
|
(`(move ,action-item)
|
||||||
(push `(add ,(nth (counsel-projectile--action-index action-item action-list)
|
(push `(add ,(nth (counsel-projectile--action-index action-item action-list)
|
||||||
action-list))
|
action-list))
|
||||||
modifications)
|
modifications)
|
||||||
(push `(remove ,action-item)
|
(push `(remove ,action-item)
|
||||||
modifications))
|
modifications))
|
||||||
(`(setkey ,action-item ,key)
|
(`(setkey ,action-item ,key)
|
||||||
(let ((index (counsel-projectile--action-index action-item action-list)))
|
(let ((index (counsel-projectile--action-index action-item action-list)))
|
||||||
(setq action-list (cl-loop for a in action-list
|
(setq action-list (cl-loop for a in action-list
|
||||||
for count from 0
|
for count from 0
|
||||||
if (= count index)
|
if (= count index)
|
||||||
collect (cons key (cdr a))
|
collect (cons key (cdr a))
|
||||||
else
|
else
|
||||||
collect a))))
|
collect a))))
|
||||||
(`(setfun ,action-item ,fun)
|
(`(setfun ,action-item ,fun)
|
||||||
(let ((index (counsel-projectile--action-index action-item action-list)))
|
(let ((index (counsel-projectile--action-index action-item action-list)))
|
||||||
(setq action-list (cl-loop for a in action-list
|
(setq action-list (cl-loop for a in action-list
|
||||||
for count from 0
|
for count from 0
|
||||||
if (= count index)
|
if (= count index)
|
||||||
collect (list (car a) fun (caddr a))
|
collect (list (car a) fun (caddr a))
|
||||||
else
|
else
|
||||||
collect a))))
|
collect a))))
|
||||||
(`(setname ,action-item ,name)
|
(`(setname ,action-item ,name)
|
||||||
(let ((index (counsel-projectile--action-index action-item action-list)))
|
(let ((index (counsel-projectile--action-index action-item action-list)))
|
||||||
(setq action-list (cl-loop for a in action-list
|
(setq action-list (cl-loop for a in action-list
|
||||||
for count from 0
|
for count from 0
|
||||||
if (= count index)
|
if (= count index)
|
||||||
collect (list (car a) (cadr a) name)
|
collect (list (car a) (cadr a) name)
|
||||||
else
|
else
|
||||||
collect a))))
|
collect a))))
|
||||||
(`(default ,action-item)
|
(`(default ,action-item)
|
||||||
(setq action-list
|
(setq action-list
|
||||||
(cons (counsel-projectile--action-index action-item action-list)
|
(cons (counsel-projectile--action-index action-item action-list)
|
||||||
(cdr action-list))))))
|
(cdr action-list))))))
|
||||||
(set action-var action-list)))
|
(set action-var action-list)))
|
||||||
|
|
||||||
;;;; counsel-projectile-find-file
|
;;;; counsel-projectile-find-file
|
||||||
|
|
@ -342,8 +342,8 @@ With a prefix ARG, invalidate the cache first."
|
||||||
(defun counsel-projectile-find-dir-action-other-window (dir)
|
(defun counsel-projectile-find-dir-action-other-window (dir)
|
||||||
"Visit DIR with dired in another window and run
|
"Visit DIR with dired in another window and run
|
||||||
`projectile-find-dir-hook'."
|
`projectile-find-dir-hook'."
|
||||||
(dired-other-window (projectile-expand-root dir))
|
(dired-other-window (projectile-expand-root dir))
|
||||||
(run-hooks 'projectile-find-dir-hook))
|
(run-hooks 'projectile-find-dir-hook))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun counsel-projectile-find-dir (&optional arg)
|
(defun counsel-projectile-find-dir (&optional arg)
|
||||||
|
|
@ -455,7 +455,7 @@ construct the command.")
|
||||||
(setq ivy--old-re
|
(setq ivy--old-re
|
||||||
(ivy--regex string)))))
|
(ivy--regex string)))))
|
||||||
(counsel--async-command (format counsel-projectile-grep-command
|
(counsel--async-command (format counsel-projectile-grep-command
|
||||||
(shell-quote-argument regex)))
|
(shell-quote-argument regex)))
|
||||||
nil)))
|
nil)))
|
||||||
|
|
||||||
(defun counsel-projectile-grep-transformer (str)
|
(defun counsel-projectile-grep-transformer (str)
|
||||||
|
|
@ -505,7 +505,7 @@ called with a prefix argument."
|
||||||
(format "%s: " (projectile-prepend-project-name (ivy-state-prompt ivy-last)))))))
|
(format "%s: " (projectile-prepend-project-name (ivy-state-prompt ivy-last)))))))
|
||||||
(counsel-git-grep (or current-prefix-arg options-or-cmd)
|
(counsel-git-grep (or current-prefix-arg options-or-cmd)
|
||||||
counsel-projectile-grep-initial-input))
|
counsel-projectile-grep-initial-input))
|
||||||
(counsel-require-program (car (split-string counsel-projectile-grep-base-command)))
|
(counsel-require-program (car (split-string counsel-projectile-grep-base-command)))
|
||||||
(let* ((ignored-files (mapconcat (lambda (i)
|
(let* ((ignored-files (mapconcat (lambda (i)
|
||||||
(concat "--exclude="
|
(concat "--exclude="
|
||||||
(shell-quote-argument i)
|
(shell-quote-argument i)
|
||||||
|
|
@ -669,10 +669,10 @@ displayed as category). The second one points to outline path
|
||||||
all projects)."
|
all projects)."
|
||||||
:type ;; copied from `org-capture-templates'
|
:type ;; copied from `org-capture-templates'
|
||||||
(let ((file-variants '(choice :tag "Filename "
|
(let ((file-variants '(choice :tag "Filename "
|
||||||
(file :tag "Literal")
|
(file :tag "Literal")
|
||||||
(function :tag "Function")
|
(function :tag "Function")
|
||||||
(variable :tag "Variable")
|
(variable :tag "Variable")
|
||||||
(sexp :tag "Form"))))
|
(sexp :tag "Form"))))
|
||||||
`(repeat
|
`(repeat
|
||||||
(choice :value ("" "" entry (file "~/org/notes.org") "")
|
(choice :value ("" "" entry (file "~/org/notes.org") "")
|
||||||
(list :tag "Multikey description"
|
(list :tag "Multikey description"
|
||||||
|
|
@ -779,28 +779,28 @@ The capture templates are read from the variables
|
||||||
(interactive)
|
(interactive)
|
||||||
(require 'org-capture)
|
(require 'org-capture)
|
||||||
(let* ((root (projectile-project-root))
|
(let* ((root (projectile-project-root))
|
||||||
(name (projectile-project-name))
|
(name (projectile-project-name))
|
||||||
(org-capture-templates
|
(org-capture-templates
|
||||||
(cl-loop
|
(cl-loop
|
||||||
for template in counsel-projectile-org-capture-templates
|
for template in counsel-projectile-org-capture-templates
|
||||||
collect (cl-loop
|
collect (cl-loop
|
||||||
for item in template
|
for item in template
|
||||||
if (= (cl-position item template) 3) ;; template's target
|
if (= (cl-position item template) 3) ;; template's target
|
||||||
collect (cl-loop
|
collect (cl-loop
|
||||||
for x in item
|
for x in item
|
||||||
if (stringp x)
|
if (stringp x)
|
||||||
collect (replace-regexp-in-string
|
collect (replace-regexp-in-string
|
||||||
"\\${[^}]+}"
|
"\\${[^}]+}"
|
||||||
(lambda (s)
|
(lambda (s)
|
||||||
(pcase s
|
(pcase s
|
||||||
("${root}" root)
|
("${root}" root)
|
||||||
("${name}" name)))
|
("${name}" name)))
|
||||||
x)
|
x)
|
||||||
else
|
else
|
||||||
collect x)
|
collect x)
|
||||||
else
|
else
|
||||||
collect item)))
|
collect item)))
|
||||||
(org-capture-templates-contexts counsel-projectile-org-capture-templates-contexts)
|
(org-capture-templates-contexts counsel-projectile-org-capture-templates-contexts)
|
||||||
(ivy--prompts-list ivy--prompts-list))
|
(ivy--prompts-list ivy--prompts-list))
|
||||||
(ivy-set-prompt 'counsel-org-capture
|
(ivy-set-prompt 'counsel-org-capture
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
@ -1027,7 +1027,7 @@ action."
|
||||||
("m" counsel-projectile-action-find-file-manually
|
("m" counsel-projectile-action-find-file-manually
|
||||||
"find file manually")
|
"find file manually")
|
||||||
("p" (lambda (_) (counsel-projectile-switch-project))
|
("p" (lambda (_) (counsel-projectile-switch-project))
|
||||||
"switch project"))
|
"switch project"))
|
||||||
'counsel-projectile)
|
'counsel-projectile)
|
||||||
|
|
||||||
(defvar counsel-projectile--buffers nil
|
(defvar counsel-projectile--buffers nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue