From 8d42c3812b91cbf43b75e4f788e19dc9d51ad95d Mon Sep 17 00:00:00 2001 From: Thierry Volpiatto Date: Tue, 22 Nov 2011 09:49:43 +0100 Subject: [PATCH] * anything.el Reindent. --- anything.el | 526 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 263 insertions(+), 263 deletions(-) diff --git a/anything.el b/anything.el index 8d38d5e..ed45a46 100644 --- a/anything.el +++ b/anything.el @@ -750,7 +750,7 @@ See also `anything-set-source-filter'.") (define-key map (kbd "C-8") 'anything-select-with-digit-shortcut) (define-key map (kbd "C-9") 'anything-select-with-digit-shortcut) (loop for c from ?A to ?Z do - (define-key map (make-string 1 c) 'anything-select-with-digit-shortcut)) + (define-key map (make-string 1 c) 'anything-select-with-digit-shortcut)) (define-key map (kbd "C-i") 'anything-select-action) (define-key map (kbd "C-z") 'anything-execute-persistent-action) (define-key map (kbd "C-e") 'anything-select-2nd-action-or-end-of-line) @@ -797,7 +797,7 @@ See also `anything-set-source-filter'.") :prefix "anything-" :group 'convenience) (defface anything-header - '((t (:inherit header-line))) + '((t (:inherit header-line))) "Face for header lines in the anything buffer." :group 'anything) @@ -881,11 +881,11 @@ and before performing action.") "Run after moving selection in `anything-buffer'.") (defvar anything-restored-variables - '( anything-candidate-number-limit - anything-source-filter - anything-source-in-each-line-flag - anything-map - anything-sources) + '(anything-candidate-number-limit + anything-source-filter + anything-source-in-each-line-flag + anything-map + anything-sources) "Variables which are restored after `anything' invocation.") (defvar anything-saved-selection nil @@ -930,7 +930,7 @@ This flag makes `anything' a bit faster with many sources.") (defvar anything-last-buffer nil "`anything-buffer' of previously `anything' session.") - (defvar anything-save-configuration-functions +(defvar anything-save-configuration-functions '(set-window-configuration . current-window-configuration) "The functions used to restore/save window or frame configurations. It is a pair where the car is the function to restore window or frame config, @@ -987,7 +987,7 @@ If nil, use default `mode-line-format'.") It also accepts function or variable symbol.") ;; FIXME: What is this -;(put 'anything 'timid-completion 'disabled) + ;(put 'anything 'timid-completion 'disabled) (defvar anything-source-in-each-line-flag nil "Non-nil means add anything-source text-property in each candidate. @@ -1101,7 +1101,7 @@ ARGS are args given to `format'." (interactive) (if anything-last-log-file (view-file anything-last-log-file) - (switch-to-buffer "*Anything Log*"))) + (switch-to-buffer "*Anything Log*"))) (defun anything-print-error-messages () "Print error messages in `anything-issued-errors'." @@ -1124,7 +1124,7 @@ THEN-FORM and ELSE-FORMS are then excuted just like in `if'." Otherwise make a list with one element." (if (and (listp obj) (not (functionp obj))) obj - (list obj))) + (list obj))) ;; (@* "Anything API") @@ -1133,7 +1133,7 @@ Otherwise make a list with one element." "Return `anything-action-buffer' if shown otherwise `anything-buffer'." (if (anything-action-window) anything-action-buffer - anything-buffer)) + anything-buffer)) (defun anything-window () "Window of `anything-buffer'." @@ -1156,7 +1156,7 @@ Otherwise make a list with one element." "Eval BODY inside `anything-current-buffer'." (declare (indent 0) (debug t)) `(with-current-buffer anything-current-buffer - ,@body)) + ,@body)) (defmacro with-anything-restore-variables(&rest body) "Restore `anything-restored-variables' after executing BODY. @@ -1271,18 +1271,18 @@ Attributes: - candidates-buffer candidates, volatile and match attrubute are created." (cond - ;; action - ((anything-action-window) - anything-sources) - ;; memoized - (anything-compiled-sources) - ;; first time - (t - (prog1 - (setq anything-compiled-sources - (anything-compile-sources - anything-sources anything-compile-source-functions)) - (anything-log-eval anything-compiled-sources))))) + ;; action + ((anything-action-window) + anything-sources) + ;; memoized + (anything-compiled-sources) + ;; first time + (t + (prog1 + (setq anything-compiled-sources + (anything-compile-sources + anything-sources anything-compile-source-functions)) + (anything-log-eval anything-compiled-sources))))) (defun* anything-get-selection (&optional (buffer nil buffer-s) (force-display-part)) "Return the currently selected item or nil. @@ -1327,25 +1327,25 @@ filtered-candidate-transformer functions." ;; The name `anything-get-current-source' should be used in init function etc. (if (and (boundp 'anything-source-name) (stringp anything-source-name)) source - (with-current-buffer (anything-buffer-get) - (or (get-text-property (point) 'anything-source) - (block exit - ;; This goto-char shouldn't be necessary, but point is moved to - ;; point-min somewhere else which shouldn't happen. - (goto-char (overlay-start anything-selection-overlay)) - (let* ((header-pos (or (anything-get-previous-header-pos) - (anything-get-next-header-pos))) - (source-name - (save-excursion - (unless header-pos - ;(message "No candidates") - (return-from exit nil)) - (goto-char header-pos) - (anything-current-line-contents)))) - (some (lambda (source) - (if (equal (assoc-default 'name source) source-name) - source)) - (anything-get-sources)))))))) + (with-current-buffer (anything-buffer-get) + (or (get-text-property (point) 'anything-source) + (block exit + ;; This goto-char shouldn't be necessary, but point is moved to + ;; point-min somewhere else which shouldn't happen. + (goto-char (overlay-start anything-selection-overlay)) + (let* ((header-pos (or (anything-get-previous-header-pos) + (anything-get-next-header-pos))) + (source-name + (save-excursion + (unless header-pos + ;(message "No candidates") + (return-from exit nil)) + (goto-char header-pos) + (anything-current-line-contents)))) + (some (lambda (source) + (if (equal (assoc-default 'name source) source-name) + source)) + (anything-get-sources)))))))) (defun anything-buffer-is-modified (buffer) "Return non-nil when BUFFER is modified since `anything' was invoked." @@ -1394,8 +1394,8 @@ LONG-DOC is displayed below attribute name and short documentation." (declare (indent 2) (debug t)) (if long-doc (setq short-doc (concat "(" short-doc ")")) - (setq long-doc short-doc - short-doc "")) + (setq long-doc short-doc + short-doc "")) (add-to-list 'anything-additional-attributes attribute t) (put attribute 'anything-attrdoc (concat "- " (symbol-name attribute) @@ -1444,7 +1444,7 @@ as a list of one element." (mapcar (lambda (pair) (if (listp pair) (cons (car pair) (eval (cadr pair))) - (cons pair nil))) + (cons pair nil))) varlist)) ;; [NOT USED] @@ -1467,7 +1467,7 @@ as a list of one element." BINDING is a list of \(VARNAME . VALUE\) pair." (setq anything-let-variables binding) (unwind-protect - (funcall bodyfunc) + (funcall bodyfunc) (setq anything-let-variables nil))) @@ -1521,16 +1521,16 @@ It is used to check if candidate number is 0, 1, or 2+." (or (anything-pos-header-line-p) (eobp))) (eobp))) (search-forward anything-candidate-separator nil t)) - do (incf count-multi) - finally return count-multi)) + do (incf count-multi) + finally return count-multi)) (save-excursion (loop with ln = 0 - while (not (if in-current-source - (or (anything-pos-header-line-p) (eobp)) - (eobp))) - unless (anything-pos-header-line-p) - do (incf ln) - do (forward-line 1) finally return ln))))))) + while (not (if in-current-source + (or (anything-pos-header-line-p) (eobp)) + (eobp))) + unless (anything-pos-header-line-p) + do (incf ln) + do (forward-line 1) finally return ln))))))) (defmacro with-anything-quittable (&rest body) "If an error occur in execution of BODY, quit anything safely." @@ -1556,10 +1556,10 @@ This function allows easy sequencing of transformer functions." This is used in transformers to modify candidates list." (if (functionp funcs) (apply 'anything-funcall-with-source source funcs args) - (apply 'anything-funcall-with-source source - (lambda (&rest args) - (anything-compose args funcs)) - args))) + (apply 'anything-funcall-with-source source + (lambda (&rest args) + (anything-compose args funcs)) + args))) (defun anything-new-timer (variable timer) "Give VARIABLE value to TIMER and cancel old timer." @@ -1671,7 +1671,7 @@ in source." for symname = (substring (symbol-name key) 1) for sym = (intern (if (string-match "^anything-" symname) symname - (concat "anything-" symname))) + (concat "anything-" symname))) unless (memq key anything-argument-keys) collect (cons sym value))) @@ -1688,33 +1688,33 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `anything'." (anything-log-eval any-prompt any-preselect any-buffer any-keymap any-default) (unwind-protect - (condition-case v - (let (;; It is needed because `anything-source-name' is non-nil - ;; when `anything' is invoked by action. Awful global scope. - anything-source-name - anything-in-persistent-action - anything-quit - (case-fold-search t) - (anything-buffer (or any-buffer anything-buffer)) - ;; cua-mode ; avoid error when region is selected - ) - (with-anything-restore-variables - (anything-initialize any-resume any-input any-sources) - (anything-display-buffer anything-buffer) - (anything-log "show prompt") - (unwind-protect - (anything-read-pattern-maybe - any-prompt any-input any-preselect - any-resume any-keymap any-default - (when (and any-history (symbolp any-history)) any-history)) - (anything-cleanup))) - (prog1 (unless anything-quit - (anything-execute-selection-action-1)) - (anything-log (concat "[End session] " (make-string 41 ?-))))) - (quit - (anything-restore-position-on-quit) - (anything-log (concat "[End session (quit)] " (make-string 34 ?-))) - nil)) + (condition-case v + (let (;; It is needed because `anything-source-name' is non-nil + ;; when `anything' is invoked by action. Awful global scope. + anything-source-name + anything-in-persistent-action + anything-quit + (case-fold-search t) + (anything-buffer (or any-buffer anything-buffer)) + ;; cua-mode ; avoid error when region is selected + ) + (with-anything-restore-variables + (anything-initialize any-resume any-input any-sources) + (anything-display-buffer anything-buffer) + (anything-log "show prompt") + (unwind-protect + (anything-read-pattern-maybe + any-prompt any-input any-preselect + any-resume any-keymap any-default + (when (and any-history (symbolp any-history)) any-history)) + (anything-cleanup))) + (prog1 (unless anything-quit + (anything-execute-selection-action-1)) + (anything-log (concat "[End session] " (make-string 41 ?-))))) + (quit + (anything-restore-position-on-quit) + (anything-log (concat "[End session (quit)] " (make-string 34 ?-))) + nil)) (anything-log-save-maybe))) @@ -1755,11 +1755,11 @@ Just check if ANY-RESUME value is t or window-only." (defun anything-resume-select-buffer (input) "Resume precedent anything session with initial input INPUT." (or (anything :sources '(((name . "Resume anything buffer") - (candidates . anything-buffers) - (action . identity))) - :input input - :resume 'noresume - :buffer "*anything resume*") + (candidates . anything-buffers) + (action . identity))) + :input input + :resume 'noresume + :buffer "*anything resume*") (keyboard-quit))) @@ -1773,14 +1773,14 @@ ANY-SOURCES ANY-INPUT ANY-PROMPT ANY-RESUME ANY-PRESELECT and ANY-BUFFER are same args as in `anything'." (interactive) (anything :sources any-sources - :input (if current-prefix-arg - (concat "\\b" (thing-at-point 'symbol) "\\b" - (if (featurep 'anything-match-plugin) " " "")) - any-input) - :prompt any-prompt - :resume any-resume - :preselect any-preselect - :buffer any-buffer)) + :input (if current-prefix-arg + (concat "\\b" (thing-at-point 'symbol) "\\b" + (if (featurep 'anything-match-plugin) " " "")) + any-input) + :prompt any-prompt + :resume any-resume + :preselect any-preselect + :buffer any-buffer)) ;;;###autoload (defun anything-other-buffer (any-sources any-buffer) @@ -1805,7 +1805,7 @@ For ANY-RESUME ANY-INPUT and ANY-SOURCES See `anything'." (anything-current-position 'save) (if (anything-resume-p any-resume) (anything-initialize-overlays (anything-buffer-get)) - (anything-initial-setup)) + (anything-initial-setup)) (unless (eq any-resume 'noresume) (anything-recent-push anything-buffer 'anything-buffers) (setq anything-last-buffer anything-buffer)) @@ -1820,7 +1820,7 @@ Push current input to HISTORY if present, otherwise `minibuffer-history' will be used instead." (anything-log-run-hook 'anything-before-action-hook) (unwind-protect - (anything-execute-selection-action) + (anything-execute-selection-action) (anything-aif (get-buffer anything-action-buffer) (kill-buffer it)) (anything-log-run-hook 'anything-after-action-hook))) @@ -1994,9 +1994,9 @@ If TEST-MODE is non-nil, clear `anything-candidate-cache'." (move-overlay anything-selection-overlay (point-min) (point-min) (get-buffer buffer)) - (setq anything-selection-overlay - (make-overlay (point-min) (point-min) (get-buffer buffer))) - (overlay-put anything-selection-overlay 'face anything-selection-face)) + (setq anything-selection-overlay + (make-overlay (point-min) (point-min) (get-buffer buffer))) + (overlay-put anything-selection-overlay 'face anything-selection-face)) (cond (anything-enable-shortcuts (setq anything-shortcut-keys @@ -2061,10 +2061,10 @@ hooks concerned are `post-command-hook' and `minibuffer-setup-hook'." "Extract input string from the minibuffer and check if it needs to be handled." (let ((delay (with-current-buffer anything-buffer anything-input-idle-delay))) (if (or (not delay) (anything-action-window)) - (anything-check-minibuffer-input-1) - (anything-new-timer - 'anything-check-minibuffer-input-timer - (run-with-idle-timer delay nil 'anything-check-minibuffer-input-1))))) + (anything-check-minibuffer-input-1) + (anything-new-timer + 'anything-check-minibuffer-input-timer + (run-with-idle-timer delay nil 'anything-check-minibuffer-input-1))))) (defun anything-check-minibuffer-input-1 () "Check minibuffer content." @@ -2184,7 +2184,7 @@ Cache the candidates if there is not yet a cached value." This happen if PROCESS-P is non-nil." (if process-p (anything-process-filtered-candidate-transformer candidates source) - candidates)) + candidates)) (defun anything-process-real-to-display (candidates source) "Execute real-to-display function on all CANDIDATES of SOURCE." @@ -2195,7 +2195,7 @@ This happen if PROCESS-P is non-nil." (if (consp cand_) ;; override DISPLAY from candidate-transformer (cons (funcall it (cdr cand_)) (cdr cand_)) - (cons (funcall it cand_) cand_))) + (cons (funcall it cand_) cand_))) candidates)) candidates)) @@ -2230,12 +2230,12 @@ If \(candidate-number-limit . 123\) is in SOURCE limit candidate to 123." "Compute matched results from SOURCE according to its settings." (if debug-on-error (anything-compute-matches-internal source) - (condition-case v - (anything-compute-matches-internal source) - (error (anything-log-error - "anything-compute-matches: error when processing source: %s" - (assoc-default 'name source)) - nil)))) + (condition-case v + (anything-compute-matches-internal source) + (error (anything-log-error + "anything-compute-matches: error when processing source: %s" + (assoc-default 'name source)) + nil)))) (defun anything-candidate-get-display (candidate) "Get searched display part from CANDIDATE. @@ -2269,7 +2269,7 @@ if ITEM-COUNT reaches LIMIT, exit from inner loop." (defun anything-take-first-elements (seq n) (if (> (length seq) n) (setq seq (subseq seq 0 n)) - seq)) + seq)) (defun anything-match-from-candidates (cands matchfns limit) (let (matches) @@ -2298,8 +2298,8 @@ if ITEM-COUNT reaches LIMIT, exit from inner loop." (if (or (equal anything-pattern "") (equal matchfns '(identity))) (anything-take-first-elements (anything-get-cached-candidates source) limit) - (anything-match-from-candidates - (anything-get-cached-candidates source) matchfns limit)) + (anything-match-from-candidates + (anything-get-cached-candidates source) matchfns limit)) source)))) ;; (anything '(((name . "error")(candidates . (lambda () (hage))) (action . identity)))) @@ -2309,23 +2309,23 @@ if ITEM-COUNT reaches LIMIT, exit from inner loop." (anything-log-eval (assoc-default 'name source)) (if (assq 'direct-insert-match source) ;experimental (anything-process-source--direct-insert-match source) - (let ((matches (anything-compute-matches source))) - (when matches - (when anything-test-mode - (setq anything-test-candidate-list - `(,@anything-test-candidate-list - (,(assoc-default 'name source) - ,matches)))) - (anything-insert-header-from-source source) - (if (not (assq 'multiline source)) - (mapc 'anything-insert-match-with-digit-overlay matches) - (let ((start (point)) separate) - (dolist (match matches) - (if separate - (anything-insert-candidate-separator) - (setq separate t)) - (anything-insert-match-with-digit-overlay match)) - (put-text-property start (point) 'anything-multiline t))))))) + (let ((matches (anything-compute-matches source))) + (when matches + (when anything-test-mode + (setq anything-test-candidate-list + `(,@anything-test-candidate-list + (,(assoc-default 'name source) + ,matches)))) + (anything-insert-header-from-source source) + (if (not (assq 'multiline source)) + (mapc 'anything-insert-match-with-digit-overlay matches) + (let ((start (point)) separate) + (dolist (match matches) + (if separate + (anything-insert-candidate-separator) + (setq separate t)) + (anything-insert-match-with-digit-overlay match)) + (put-text-property start (point) 'anything-multiline t))))))) (defun anything-insert-match-with-digit-overlay (match) (declare (special source)) @@ -2400,10 +2400,10 @@ is done on whole `anything-buffer' and not on current source." (setq delayed-sources (loop for source in (remove-if-not 'anything-update-source-p (anything-get-sources)) - if (anything-delayed-source-p source) - collect source - else do (progn (push source normal-sources) - (anything-process-source source)))) + if (anything-delayed-source-p source) + collect source + else do (progn (push source normal-sources) + (anything-process-source source)))) (anything-log-eval (mapcar (lambda (s) (assoc-default 'name s)) delayed-sources)) (if anything-test-mode ; Need only to process sources. @@ -2567,15 +2567,15 @@ after the source name by overlay." (with-current-buffer anything-buffer (let ((source (cdr process-assoc))) (save-excursion - (anything-aif (assoc-default 'insertion-marker source) - (goto-char it) - (goto-char (point-max)) - (anything-insert-header-from-source source) - (setcdr process-assoc - (append source `((insertion-marker . ,(point-marker)))))) - (anything-output-filter--process-source - (car process-assoc) string source - (anything-candidate-number-limit source)))) + (anything-aif (assoc-default 'insertion-marker source) + (goto-char it) + (goto-char (point-max)) + (anything-insert-header-from-source source) + (setcdr process-assoc + (append source `((insertion-marker . ,(point-marker)))))) + (anything-output-filter--process-source + (car process-assoc) string source + (anything-candidate-number-limit source)))) (anything-output-filter--post-process))) (defun anything-output-filter--process-source (process string source limit) @@ -2586,10 +2586,10 @@ after the source name by overlay." source t)) (if (not (assq 'multiline source)) (anything-insert-match candidate 'insert-before-markers source) - (let ((start (point))) - (anything-insert-candidate-separator) - (anything-insert-match candidate 'insert-before-markers source) - (put-text-property start (point) 'anything-multiline t))) + (let ((start (point))) + (anything-insert-candidate-separator) + (anything-insert-match candidate 'insert-before-markers source) + (put-text-property start (point) 'anything-multiline t))) (incf (cdr (assoc 'item-count source))) (when (>= (assoc-default 'item-count source) limit) (anything-kill-async-process process) @@ -2603,7 +2603,7 @@ after the source name by overlay." (prog1 (concat (cdr incomplete-line-info) line) (setcdr incomplete-line-info nil)) - line) + line) finally (setcdr incomplete-line-info line)))) (defun anything-output-filter--post-process () @@ -2616,8 +2616,8 @@ after the source name by overlay." (defun anything-kill-async-processes () "Kill all known asynchronous processes of `anything-async-processes'." - (mapc 'anything-kill-async-process (mapcar 'car anything-async-processes)) - (setq anything-async-processes nil)) + (mapc 'anything-kill-async-process (mapcar 'car anything-async-processes)) + (setq anything-async-processes nil)) (defun anything-kill-async-process (process) "Kill PROCESS and detach the associated functions." @@ -2637,7 +2637,7 @@ If PRESERVE-SAVED-ACTION is non-nil don't save action." anything-saved-action (if (get-buffer anything-action-buffer) (anything-get-selection anything-action-buffer) - (anything-get-action))))) + (anything-get-action))))) (let ((source (or anything-saved-current-source (anything-get-current-source)))) (setq selection (or selection @@ -2653,14 +2653,14 @@ If PRESERVE-SAVED-ACTION is non-nil don't save action." "Apply coerce attribute function to SELECTION in SOURCE. Coerce source with coerce function." (anything-aif (assoc-default 'coerce source) - (anything-funcall-with-source source it selection) - selection)) + (anything-funcall-with-source source it selection) + selection)) (defun anything-get-default-action (action) "Get the first ACTION value of action list in source." (if (and (listp action) (not (functionp action))) (cdar action) - action)) + action)) (defun anything-select-action () "Select an action for the currently selected candidate. @@ -2679,10 +2679,10 @@ If action buffer is selected, back to the anything buffer." (let ((actions (anything-get-action))) (if (functionp actions) (message "Sole action: %s" actions) - (anything-show-action-buffer actions) - (anything-delete-minibuffer-contents) - (setq anything-pattern 'dummy) ; so that it differs from the previous one - (anything-check-minibuffer-input)))))) + (anything-show-action-buffer actions) + (anything-delete-minibuffer-contents) + (setq anything-pattern 'dummy) ; so that it differs from the previous one + (anything-check-minibuffer-input)))))) (defun anything-show-action-buffer (actions) (with-current-buffer (get-buffer-create anything-action-buffer) @@ -2753,8 +2753,8 @@ It is determined by UNIT and DIRECTION." (substitute-command-keys (if (listp anything-mode-line-string) (cadr anything-mode-line-string) anything-mode-line-string))) - (setq mode-line-format - (default-value 'mode-line-format))) + (setq mode-line-format + (default-value 'mode-line-format))) (setq header-line-format (anything-interpret-value (assoc-default 'header-line source) source))) @@ -2775,15 +2775,15 @@ it is \"Candidate\(s\)\" by default." (lambda () (if (not (anything-pos-multiline-p)) (forward-line -1) ;double forward-line is meaningful - (forward-line -1) ;because evaluation order is important - (anything-skip-header-and-separator-line 'previous) - (let ((header-pos (anything-get-previous-header-pos)) - (separator-pos (anything-get-previous-candidate-separator-pos))) - (when header-pos - (goto-char (if (or (null separator-pos) (< separator-pos header-pos)) - header-pos ; first candidate - separator-pos)) - (forward-line 1))))) + (forward-line -1) ;because evaluation order is important + (anything-skip-header-and-separator-line 'previous) + (let ((header-pos (anything-get-previous-header-pos)) + (separator-pos (anything-get-previous-candidate-separator-pos))) + (when header-pos + (goto-char (if (or (null separator-pos) (< separator-pos header-pos)) + header-pos ; first candidate + separator-pos)) + (forward-line 1))))) 'line 'previous)) (defun anything-next-line () @@ -2793,13 +2793,13 @@ it is \"Candidate\(s\)\" by default." (lambda () (if (not (anything-pos-multiline-p)) (forward-line 1) - (let ((header-pos (anything-get-next-header-pos)) - (separator-pos (anything-get-next-candidate-separator-pos))) - (cond ((and separator-pos - (or (null header-pos) (< separator-pos header-pos))) - (goto-char separator-pos)) - (header-pos - (goto-char header-pos)))))) + (let ((header-pos (anything-get-next-header-pos)) + (separator-pos (anything-get-next-candidate-separator-pos))) + (cond ((and separator-pos + (or (null header-pos) (< separator-pos header-pos))) + (goto-char separator-pos)) + (header-pos + (goto-char header-pos)))))) 'line 'next)) (defun anything-previous-page () @@ -2844,7 +2844,7 @@ it is \"Candidate\(s\)\" by default." (forward-line -1) (if (bobp) (goto-char (point-max)) - (anything-skip-header-and-separator-line 'previous)) + (anything-skip-header-and-separator-line 'previous)) (goto-char (anything-get-previous-header-pos)) (forward-line 1)) 'source 'previous)) @@ -2863,7 +2863,7 @@ it is \"Candidate\(s\)\" by default." (lambda () (goto-char (point-min)) (let ((name (if (stringp source-or-name) source-or-name - (assoc-default 'name source-or-name)))) + (assoc-default 'name source-or-name)))) (condition-case err (while (not (string= name (anything-current-line-contents))) (goto-char (anything-get-next-header-pos))) @@ -2884,7 +2884,7 @@ to mark candidates." separator-pos) header-pos (point-max))) - (1+ (point-at-eol)))) + (1+ (point-at-eol)))) (anything-follow-execute-persistent-action-maybe)) (defun anything-this-command-key () @@ -2902,10 +2902,10 @@ to mark candidates." (when (numberp key) (select-window (minibuffer-window)) (self-insert-command 1)) - (goto-char (overlay-start overlay)) - (anything-mark-current-line) - (anything-exit-minibuffer)))) - (self-insert-command 1))) + (goto-char (overlay-start overlay)) + (anything-mark-current-line) + (anything-exit-minibuffer)))) + (self-insert-command 1))) (defun anything-select-with-prefix-shortcut () "Invoke default action with prefix shortcut." @@ -3161,7 +3161,7 @@ if optional NOUPDATE is non-nil, anything buffer is not changed." (filtered-candidate-transformer . anything-dummy-candidate) (disable-shortcuts) (volatile))) - source)) + source)) ;; (@* "Built-in plug-in: disable-shortcuts") (defvar anything-orig-enable-shortcuts nil) @@ -3181,7 +3181,7 @@ if optional NOUPDATE is non-nil, anything buffer is not changed." (lambda () (setq anything-enable-shortcuts anything-orig-enable-shortcuts)))) source) - source)) + source)) ;; (@* "Built-in plug-in: candidates-in-buffer") (defun anything-candidates-in-buffer () @@ -3277,17 +3277,17 @@ get-line and search-from-end attributes. See also `anything-sources' docstring." (if (string= pattern "") (anything-initial-candidates-from-candidate-buffer endp get-line-fn limit search-from-end) - (anything-search-from-candidate-buffer - pattern get-line-fn search-fns limit search-from-end - start-point endp)))))) + (anything-search-from-candidate-buffer + pattern get-line-fn search-fns limit search-from-end + start-point endp)))))) (defun anything-point-is-moved (proc) "If point is moved after executing PROC, return t, otherwise nil." (/= (point) (progn (funcall proc) (point)))) (defun anything-search-from-candidate-buffer (pattern get-line-fn search-fns - limit search-from-end - start-point endp) + limit search-from-end + start-point endp) (let (buffer-read-only matches exit newmatches) (anything-search-from-candidate-buffer-internal @@ -3305,7 +3305,7 @@ get-line and search-from-end attributes. See also `anything-sources' docstring." (lambda () (if search-from-end (goto-char (1- (point-at-bol))) - (forward-line 1)))) + (forward-line 1)))) return nil) (setq matches (append matches (nreverse newmatches))) (if exit (return))) @@ -3315,7 +3315,7 @@ get-line and search-from-end attributes. See also `anything-sources' docstring." (delq nil (loop with next-line-fn = (if search-from-end (lambda (x) (goto-char (max (1- (point-at-bol)) 1))) - #'forward-line) + #'forward-line) until (funcall endp) for i from 1 to limit collect (funcall get-line-fn (point-at-bol) (point-at-eol)) @@ -3327,7 +3327,7 @@ get-line and search-from-end attributes. See also `anything-sources' docstring." (goto-char (point-max)) (insert "\n") (unwind-protect - (funcall search-fn) + (funcall search-fn) (goto-char (point-min)) (delete-char 1) (goto-char (1- (point-max))) @@ -3374,7 +3374,7 @@ Acceptable values of CREATE-OR-BUFFER: (with-current-buffer (get-buffer-create (if (eq create-or-buffer 'global) global-bname - local-bname)) + local-bname)) (buffer-disable-undo) (erase-buffer) (font-lock-mode -1)))) @@ -3410,7 +3410,7 @@ Acceptable values of CREATE-OR-BUFFER: (set-window-buffer (select-window (if (= (window-height) before-height) (prog1 - (split-window-vertically) + (split-window-vertically) (setq anything-split-window-state 'vertical)) (setq anything-split-window-state 'horizontal) (split-window-horizontally))) @@ -3477,7 +3477,7 @@ Otherwise goto the end of minibuffer." (interactive) (if (eolp) (anything-select-nth-action 1) - (end-of-line))) + (end-of-line))) ;; (@* "Utility: Persistent Action") (defmacro with-anything-display-same-window (&rest body) @@ -3573,11 +3573,11 @@ second argument of `display-buffer'." ;; (@* "Utility: Visible Mark") (defface anything-visible-mark - '((((min-colors 88) (background dark)) - (:background "green1" :foreground "black")) - (((background dark)) (:background "green" :foreground "black")) - (((min-colors 88)) (:background "green1")) - (t (:background "green"))) + '((((min-colors 88) (background dark)) + (:background "green1" :foreground "black")) + (((background dark)) (:background "green" :foreground "black")) + (((min-colors 88)) (:background "green1")) + (t (:background "green"))) "Face for visible mark." :group 'anything) @@ -3648,7 +3648,7 @@ It is analogous to `dired-get-marked-files'." for (source . real) in (reverse anything-marked-candidates) when (equal current-src source) collect (anything-coerce-selection real source)) - (list (anything-get-selection))))) + (list (anything-get-selection))))) (anything-log-eval cands) cands))) @@ -3684,22 +3684,22 @@ It is analogous to `dired-get-marked-files'." (defun anything-next-point-in-list (curpos points &optional prev) (cond - ;; rule out special cases - ((null points) curpos) - ((and prev (< curpos (car points))) curpos) - ((< (car (last points)) curpos) - (if prev (car (last points)) curpos)) - (t - (nth (if prev - (loop for pt in points - for i from 0 - if (<= curpos pt) - do (return (1- i))) - (loop for pt in points - for i from 0 - if (< curpos pt) - do (return i))) - points)))) + ;; rule out special cases + ((null points) curpos) + ((and prev (< curpos (car points))) curpos) + ((< (car (last points)) curpos) + (if prev (car (last points)) curpos)) + (t + (nth (if prev + (loop for pt in points + for i from 0 + if (<= curpos pt) + do (return (1- i))) + (loop for pt in points + for i from 0 + if (< curpos pt) + do (return i))) + points)))) (defun anything-next-visible-mark (&optional prev) "Move next anything visible mark. @@ -3840,7 +3840,7 @@ buffer as BUFFER." (with-current-buffer (or buffer (current-buffer)) (if (listp buffer-undo-list) (length buffer-undo-list) - (buffer-modified-tick))))) + (buffer-modified-tick))))) ;; (@* "CUA workaround") @@ -3850,7 +3850,7 @@ buffer as BUFFER." (defadvice copy-region-as-kill (around anything-avoid-cua activate) (if cua-mode (ignore-errors ad-do-it) - ad-do-it)) + ad-do-it)) ;;(@* "Attribute Documentation") (defun anything-describe-anything-attribute (anything-attribute) @@ -3864,14 +3864,14 @@ ANYTHING-ATTRIBUTE should be a symbol." (princ (get anything-attribute 'anything-attrdoc)))) (anything-document-attribute 'name "mandatory" - " The name of the source. It is also the heading which appears + " The name of the source. It is also the heading which appears above the list of matches from the source. Must be unique. ") (anything-document-attribute 'header-name "optional" - " A function returning the display string of the header. Its + " A function returning the display string of the header. Its argument is the name of the source. This attribute is useful to add an additional information with the source name. ") (anything-document-attribute 'candidates "mandatory if candidates-in-buffer attribute is not provided" - " Specifies how to retrieve candidates from the source. It can + " Specifies how to retrieve candidates from the source. It can either be a variable name, a function called with no parameters or the actual list of candidates. @@ -3903,7 +3903,7 @@ ANYTHING-ATTRIBUTE should be a symbol." last in the anything buffer regardless of their position in `anything-sources'. ") (anything-document-attribute 'action "mandatory if type attribute is not provided" - " It is a list of (DISPLAY . FUNCTION) pairs or FUNCTION. + " It is a list of (DISPLAY . FUNCTION) pairs or FUNCTION. FUNCTION is called with one parameter: the selected candidate. An action other than the default can be chosen from this list @@ -3912,7 +3912,7 @@ ANYTHING-ATTRIBUTE should be a symbol." buffer and the FUNCTION is invoked when an action is selected. The first action of the list is the default. ") (anything-document-attribute 'coerce "optional" - " It's a function called with one argument: the selected candidate. + " It's a function called with one argument: the selected candidate. This function is intended for type convertion. In normal case, the selected candidate (string) is passed to action function. @@ -3921,14 +3921,14 @@ ANYTHING-ATTRIBUTE should be a symbol." Example: converting string to symbol (coerce . intern) ") (anything-document-attribute 'type "optional if action attribute is provided" - " Indicates the type of the items the source returns. + " Indicates the type of the items the source returns. Merge attributes not specified in the source itself from `anything-type-attributes'. This attribute is implemented by plug-in. ") (anything-document-attribute 'init "optional" - " Function called with no parameters when anything is started. It + " Function called with no parameters when anything is started. It is useful for collecting current state information which can be used to create the list of candidates later. @@ -3938,11 +3938,11 @@ ANYTHING-ATTRIBUTE should be a symbol." `anything-buffer' and the current directory can be different there. ") (anything-document-attribute 'delayed-init "optional" - " Function called with no parameters before candidate function is + " Function called with no parameters before candidate function is called. It is similar with `init' attribute, but its evaluation is deferred. It is useful to combine with ") (anything-document-attribute 'match "optional" - " List of functions called with one parameter: a candidate. The + " List of functions called with one parameter: a candidate. The function should return non-nil if the candidate matches the current pattern (see variable `anything-pattern'). @@ -3965,7 +3965,7 @@ ANYTHING-ATTRIBUTE should be a symbol." attribute `candidates'), since they perform pattern matching themselves. ") (anything-document-attribute 'candidate-transformer "optional" - " It's a function or a list of functions called with one argument + " It's a function or a list of functions called with one argument when the completion list from the source is built. The argument is the list of candidates retrieved from the source. The function should return a transformed list of candidates which @@ -3979,7 +3979,7 @@ ANYTHING-ATTRIBUTE should be a symbol." function should also be able to handle candidates with (DISPLAY . REAL) format. ") (anything-document-attribute 'filtered-candidate-transformer "optional" - " It has the same format as `candidate-transformer', except the + " It has the same format as `candidate-transformer', except the function is called with two parameters: the candidate list and the source. @@ -4006,7 +4006,7 @@ ANYTHING-ATTRIBUTE should be a symbol." This option has no effect for asynchronous sources. (Not yet, at least. ") (anything-document-attribute 'action-transformer "optional" - " It's a function or a list of functions called with two + " It's a function or a list of functions called with two arguments when the action list from the source is assembled. The first argument is the list of actions, the second is the current selection. If it is a list of functions, @@ -4017,31 +4017,31 @@ ANYTHING-ATTRIBUTE should be a symbol." This can be used to customize the list of actions based on the currently selected candidate. ") (anything-document-attribute 'pattern-transformer "optional" - " It's a function or a list of functions called with one argument + " It's a function or a list of functions called with one argument before computing matches. Its argument is `anything-pattern'. Functions should return transformed `anything-pattern'. It is useful to change interpretation of `anything-pattern'. ") (anything-document-attribute 'delayed "optional" - " Candidates from the source are shown only if the user stops + " Candidates from the source are shown only if the user stops typing and is idle for `anything-idle-delay' seconds. ") (anything-document-attribute 'volatile "optional" - " Indicates the source assembles the candidate list dynamically, + " Indicates the source assembles the candidate list dynamically, so it shouldn't be cached within a single Anything invocation. It is only applicable to synchronous sources, because asynchronous sources are not cached. ") (anything-document-attribute 'requires-pattern "optional" - " If present matches from the source are shown only if the + " If present matches from the source are shown only if the pattern is not empty. Optionally, it can have an integer parameter specifying the required length of input which is useful in case of sources with lots of candidates. ") (anything-document-attribute 'persistent-action "optional" - " Function called with one parameter; the selected candidate. + " Function called with one parameter; the selected candidate. An action performed by `anything-execute-persistent-action'. If none, use the default action. ") (anything-document-attribute 'candidates-in-buffer "optional" - " Shortcut attribute for making and narrowing candidates using + " Shortcut attribute for making and narrowing candidates using buffers. This newly-introduced attribute prevents us from forgetting to add volatile and match attributes. @@ -4059,24 +4059,24 @@ ANYTHING-ATTRIBUTE should be a symbol." This attribute is implemented by plug-in. ") (anything-document-attribute 'search "optional" - " List of functions like `re-search-forward' or `search-forward'. + " List of functions like `re-search-forward' or `search-forward'. Buffer search function used by `anything-candidates-in-buffer'. By default, `anything-candidates-in-buffer' uses `re-search-forward'. This attribute is meant to be used with (candidates . anything-candidates-in-buffer) or (candidates-in-buffer) in short. ") (anything-document-attribute 'search-from-end "optional" - " Make `anything-candidates-in-buffer' search from the end of buffer. + " Make `anything-candidates-in-buffer' search from the end of buffer. If this attribute is specified, `anything-candidates-in-buffer' uses `re-search-backward' instead. ") (anything-document-attribute 'get-line "optional" - " A function like `buffer-substring-no-properties' or `buffer-substring'. + " A function like `buffer-substring-no-properties' or `buffer-substring'. This function converts point of line-beginning and point of line-end, which represents a candidate computed by `anything-candidates-in-buffer'. By default, `anything-candidates-in-buffer' uses `buffer-substring-no-properties'. ") (anything-document-attribute 'display-to-real "optional" - " Function called with one parameter; the selected candidate. + " Function called with one parameter; the selected candidate. The function transforms the selected candidate, and the result is passed to the action function. The display-to-real @@ -4089,7 +4089,7 @@ ANYTHING-ATTRIBUTE should be a symbol." can be generated from DISPLAY, display-to-real is more convenient and faster. ") (anything-document-attribute 'real-to-display "optional" - " Function called with one parameter; the selected candidate. + " Function called with one parameter; the selected candidate. The inverse of display-to-real attribute. @@ -4108,38 +4108,38 @@ ANYTHING-ATTRIBUTE should be a symbol." candidate-transformer are IGNORED as the name `display-to-real' says. ") (anything-document-attribute 'cleanup "optional" - " Function called with no parameters when *anything* buffer is closed. It + " Function called with no parameters when *anything* buffer is closed. It is useful for killing unneeded candidates buffer. Note that the function is executed BEFORE performing action. ") (anything-document-attribute 'candidate-number-limit "optional" - " Override `anything-candidate-number-limit' only for this source. ") + " Override `anything-candidate-number-limit' only for this source. ") (anything-document-attribute 'accept-empty "optional" - " Pass empty string \"\" to action function. ") + " Pass empty string \"\" to action function. ") (anything-document-attribute 'disable-shortcuts "optional" - " Disable `anything-enable-shortcuts' in current `anything' session. + " Disable `anything-enable-shortcuts' in current `anything' session. This attribute is implemented by plug-in. ") (anything-document-attribute 'dummy "optional" - " Set `anything-pattern' to candidate. If this attribute is + " Set `anything-pattern' to candidate. If this attribute is specified, The candidates attribute is ignored. This attribute is implemented by plug-in. This plug-in implies disable-shortcuts plug-in. ") (anything-document-attribute 'multiline "optional" - " Enable to selection multiline candidates. ") + " Enable to selection multiline candidates. ") (anything-document-attribute 'update "optional" - ;; FIXME: this is not displayed correctly in help buffer. - " Function called with no parameters when \\\\[anything-force-update] is pressed. ") + ;; FIXME: this is not displayed correctly in help buffer. + " Function called with no parameters when \\\\[anything-force-update] is pressed. ") (anything-document-attribute 'mode-line "optional" - " source local `anything-mode-line-string'. (included in `mode-line-format') + " source local `anything-mode-line-string'. (included in `mode-line-format') It accepts also variable/function name. ") (anything-document-attribute 'header-line "optional" - " source local `header-line-format'. + " source local `header-line-format'. It accepts also variable/function name. ") (anything-document-attribute - 'resume "optional" - " Function called with no parameters when `anything-resume' is started.") + 'resume "optional" + " Function called with no parameters when `anything-resume' is started.") ;; (@* "Bug Report") -- 2.11.4.GIT