diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2013-11-04 08:39:27 +0100 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2013-11-04 08:39:27 +0100 |
commit | b82caa80eaa937adc1246298865bb52cc4534fc1 (patch) | |
tree | b6874f14a385c0085bad02fe10f2624d103d0496 | |
parent | 82d3cde7d7708b62b9524a75fdd5fe2ddffbfdd9 (diff) |
replace all cl symbol by their cl-lib equivalent.
40 files changed, 487 insertions, 487 deletions
diff --git a/helm-adaptative.el b/helm-adaptative.el index 1fb47d06..59f25d5a 100644 --- a/helm-adaptative.el +++ b/helm-adaptative.el @@ -144,7 +144,7 @@ Format: ((SOURCE-NAME (SELECTED-CANDIDATE (PATTERN . NUMBER-OF-USE) ...) ...) .. ;; truncate history if needed (if (> (length (cdr selection-info)) helm-adaptive-history-length) (setcdr selection-info - (subseq (cdr selection-info) 0 helm-adaptive-history-length)))))))) + (cl-subseq (cdr selection-info) 0 helm-adaptive-history-length)))))))) (defun helm-adaptative-maybe-load-history () "Load `helm-adaptive-history-file' which contain `helm-adaptive-history'. @@ -177,11 +177,11 @@ This is a filtered candidate transformer you can use with the ;; ... assemble a list containing the (CANIDATE . USAGE-COUNT) ;; pairs (mapcar (lambda (candidate-info) - (let ((count 0)) - (dolist (pattern-info (cdr candidate-info)) + (let ((cl-count 0)) + (cl-dolist (pattern-info (cdr candidate-info)) (if (not (equal (car pattern-info) helm-pattern)) - (incf count (cdr pattern-info)) + (cl-incf count (cdr pattern-info)) ;; if current pattern is equal to the previously ;; used one then this candidate has priority @@ -189,7 +189,7 @@ This is a filtered candidate transformer you can use with the ;; it only has to compete with other candidates ;; which were also selected with the same pattern (setq count (+ 10000 (cdr pattern-info))) - (return))) + (cl-return))) (cons (car candidate-info) count))) (cdr source-info))) sorted) @@ -197,15 +197,15 @@ This is a filtered candidate transformer you can use with the ;; sort the list in descending order, so candidates with highest ;; priorty come first (progn - (setq usage (sort usage (lambda (first second) + (setq usage (sort usage (lambda (cl-first second) (> (cdr first) (cdr second))))) ;; put those candidates first which have the highest usage count - (dolist (info usage) - (when (member* (car info) candidates + (cl-dolist (info usage) + (when (cl-member (car info) candidates :test 'helm-adaptive-compare) (push (car info) sorted) - (setq candidates (remove* (car info) candidates + (setq candidates (cl-remove (car info) candidates :test 'helm-adaptive-compare)))) ;; and append the rest diff --git a/helm-aliases.el b/helm-aliases.el index 62cebbf2..4df68ee5 100644 --- a/helm-aliases.el +++ b/helm-aliases.el @@ -31,31 +31,31 @@ (t nil))) (defun helm-check-conflicting-prefixes () - (loop for s in (all-completions "helm-c-" obarray) + (cl-loop for s in (all-completions "helm-c-" obarray) for rep = (replace-regexp-in-string "helm-c-" "helm-" s) when (or (and (not (helm-alias-p (intern s))) (fboundp (intern rep))) (and (not (helm-alias-p (intern s))) (boundp (intern rep)))) collect rep)) (defun helm-collect-functions-with-bad-prefix () - (loop for s in (all-completions "helm-c-" obarray) + (cl-loop for s in (all-completions "helm-c-" obarray) for sym = (intern s) when (and (not (helm-alias-p sym)) (fboundp sym)) collect s)) (defun helm-collect-vars-with-bad-prefix () - (loop for s in (all-completions "helm-c-" obarray) + (cl-loop for s in (all-completions "helm-c-" obarray) for sym = (intern s) when (and (not (helm-alias-p sym)) (boundp sym)) collect s)) (defun helm-insert-fn-aliases () - (loop for s in (helm-collect-functions-with-bad-prefix) + (cl-loop for s in (helm-collect-functions-with-bad-prefix) for rep = (replace-regexp-in-string "helm-c-" "helm-" s) do (insert (format "(defalias '%s '%s)\n(make-obsolete '%s '%s \"1.5.1\")\n" s rep s rep)))) (defun helm-insert-var-aliases () - (loop for s in (helm-collect-vars-with-bad-prefix) + (cl-loop for s in (helm-collect-vars-with-bad-prefix) for rep = (replace-regexp-in-string "helm-c-" "helm-" s) do (insert (format "(defvaralias '%s '%s)\n(make-obsolete-variable '%s '%s \"1.5.1\")\n" s rep s rep)))) diff --git a/helm-apt.el b/helm-apt.el index 8ff31db8..4e922ec4 100644 --- a/helm-apt.el +++ b/helm-apt.el @@ -44,7 +44,7 @@ (defvar helm-apt-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "C-c ?") 'helm-apt-help) (define-key map (kbd "M-I") 'helm-apt-show-only-installed) @@ -91,7 +91,7 @@ (defun helm-apt-candidate-transformer (candidates) "Show installed CANDIDATES and the ones to deinstall in a different color." - (loop for cand in candidates + (cl-loop for cand in candidates for name = (helm-apt-display-to-real cand) for deinstall = (string= (assoc-default name helm-apt-installed-packages) @@ -145,7 +145,7 @@ (with-temp-buffer (call-process-shell-command "dpkg --get-selections" nil (current-buffer)) - (loop for i in (split-string (buffer-string) "\n" t) + (cl-loop for i in (split-string (buffer-string) "\n" t) for p = (split-string i) collect (cons (car p) (cadr p))))) (helm-init-candidates-in-buffer @@ -201,7 +201,7 @@ package name - description." "Run 'apt-get purge' shell command on PACKAGE." (helm-apt-generic-action :action 'purge)) -(defun* helm-apt-generic-action (&key action) +(cl-defun helm-apt-generic-action (&key action) "Run 'apt-get ACTION'. Support install, remove and purge actions." (if (and helm-apt-term-buffer @@ -210,7 +210,7 @@ Support install, remove and purge actions." (ansi-term (getenv "SHELL") "term apt") (setq helm-apt-term-buffer (buffer-name))) (term-line-mode) - (let ((command (case action + (let ((command (cl-case action (install "sudo apt-get install ") (reinstall "sudo apt-get install --reinstall ") (uninstall "sudo apt-get remove ") diff --git a/helm-bbdb.el b/helm-bbdb.el index e1edd02a..cb208d99 100644 --- a/helm-bbdb.el +++ b/helm-bbdb.el @@ -50,7 +50,7 @@ The format is \"Firstname Lastname\"." (defun helm-bbdb-read-phone () "Return a list of vector address objects. See docstring of `bbdb-create-internal' for more info on address entries." - (loop with phone-list + (cl-loop with phone-list with loc-list = (cons "[Exit when no more]" (bbdb-label-completion-list "phones")) with loc ; Defer count @@ -69,7 +69,7 @@ See docstring of `bbdb-create-internal' for more info on address entries." (defun helm-read-repeat-string (prompt &optional count) "Prompt as many time PROMPT is not empty. If COUNT is non--nil add a number after each prompt." - (loop with elm with new-prompt = prompt + (cl-loop with elm with new-prompt = prompt while (not (string= elm "")) for n from 1 do (when count @@ -80,7 +80,7 @@ If COUNT is non--nil add a number after each prompt." (defun helm-bbdb-read-address () "Return a list of vector address objects. See docstring of `bbdb-create-internal' for more info on address entries." - (loop with address-list + (cl-loop with address-list with loc-list = (cons "[Exit when no more]" (bbdb-label-completion-list "addresses")) with loc ; Defer count @@ -147,14 +147,14 @@ http://bbdb.sourceforge.net/") "View BBDB data of single CANDIDATE or marked candidates." (helm-aif (helm-marked-candidates) (let ((bbdb-append-records (length it))) - (dolist (i it) + (cl-dolist (i it) (bbdb-redisplay-one-record (helm-bbdb-get-record i)))) (bbdb-redisplay-one-record (helm-bbdb-get-record candidate)))) (defun helm-bbdb-collect-mail-addresses () "Return a list of all mail addresses of records in bbdb buffer." (with-current-buffer bbdb-buffer-name - (loop for i in bbdb-records + (cl-loop for i in bbdb-records if (bbdb-record-net (car i)) collect (bbdb-dwim-net-address (car i))))) diff --git a/helm-bmkext.el b/helm-bmkext.el index 6c7293a9..f98fe9a8 100644 --- a/helm-bmkext.el +++ b/helm-bmkext.el @@ -33,7 +33,7 @@ ;; (defun helm-bmkext-filter-setup-alist (fn &rest args) "Return a filtered `bookmark-alist' sorted alphabetically." - (loop + (cl-loop with alist = (if args (apply #'(lambda (x) (funcall fn x)) args) (funcall fn)) @@ -61,7 +61,7 @@ 'global (helm-bmkext-addressbook-setup-alist)))) (candidates-in-buffer) - (search helm-bookmark-search-fn) + (cl-search helm-bookmark-search-fn) (match-part . helm-pp-bookmark-match-fn) (persistent-action . (lambda (candidate) @@ -80,7 +80,7 @@ (helm-bookmark-get-bookmark-from-name (car contacts))) (helm-aif (cdr contacts) (let ((current-prefix-arg '(4))) - (loop for bmk in it do + (cl-loop for bmk in it do (bookmark-jump (helm-bookmark-get-bookmark-from-name bmk)))))))) ("Send Mail" @@ -94,7 +94,7 @@ (addressbook-set-mail-buffer1 bmk)) (setq contacts (cdr contacts)) (when contacts - (loop for bmk in contacts do + (cl-loop for bmk in contacts do (addressbook-set-mail-buffer1 bmk 'append)))))) ("Edit Bookmark" . (lambda (candidate) @@ -149,7 +149,7 @@ (helm-init-candidates-in-buffer 'global (helm-bookmark-w3m-setup-alist)))) (candidates-in-buffer) - (search helm-bookmark-search-fn) + (cl-search helm-bookmark-search-fn) (match-part . helm-pp-bookmark-match-fn) (filtered-candidate-transformer helm-adaptive-sort @@ -171,7 +171,7 @@ (helm-init-candidates-in-buffer 'global (helm-bookmark-images-setup-alist)))) (candidates-in-buffer) - (search helm-bookmark-search-fn) + (cl-search helm-bookmark-search-fn) (match-part . helm-pp-bookmark-match-fn) (filtered-candidate-transformer helm-adaptive-sort @@ -193,7 +193,7 @@ (helm-init-candidates-in-buffer 'global (helm-bookmark-man-setup-alist)))) (candidates-in-buffer) - (search helm-bookmark-search-fn) + (cl-search helm-bookmark-search-fn) (match-part . helm-pp-bookmark-match-fn) (filtered-candidate-transformer helm-adaptive-sort @@ -216,7 +216,7 @@ (helm-init-candidates-in-buffer 'global (helm-bookmark-gnus-setup-alist)))) (candidates-in-buffer) - (search helm-bookmark-search-fn) + (cl-search helm-bookmark-search-fn) (match-part . helm-pp-bookmark-match-fn) (filtered-candidate-transformer helm-adaptive-sort @@ -238,7 +238,7 @@ (helm-init-candidates-in-buffer 'global (helm-bookmark-info-setup-alist)))) (candidates-in-buffer) - (search helm-bookmark-search-fn) + (cl-search helm-bookmark-search-fn) (match-part . helm-pp-bookmark-match-fn) (filtered-candidate-transformer helm-adaptive-sort @@ -260,7 +260,7 @@ (helm-init-candidates-in-buffer 'global (helm-bookmark-local-files-setup-alist)))) (candidates-in-buffer) - (search helm-bookmark-search-fn) + (cl-search helm-bookmark-search-fn) (match-part . helm-pp-bookmark-match-fn) (filtered-candidate-transformer helm-adaptive-sort diff --git a/helm-bookmark.el b/helm-bookmark.el index ab3e3d27..ffa6d9f8 100644 --- a/helm-bookmark.el +++ b/helm-bookmark.el @@ -71,7 +71,7 @@ (defvar helm-bookmark-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "C-c o") 'helm-bookmark-run-jump-other-window) (define-key map (kbd "C-d") 'helm-bookmark-run-delete) @@ -97,7 +97,7 @@ "See (info \"(emacs)Bookmarks\").") (defun helm-bookmark-transformer (candidates _source) - (loop for i in candidates + (cl-loop for i in candidates for loc = (bookmark-location i) for len = (string-width i) for trunc = (if (> len bookmark-bmenu-file-column) @@ -153,10 +153,10 @@ (init . (lambda () (require 'bookmark) (helm-init-candidates-in-buffer - 'global (loop for b in (bookmark-all-names) collect + 'global (cl-loop for b in (bookmark-all-names) collect (propertize b 'location (bookmark-location b)))))) (candidates-in-buffer) - (search helm-bookmark-search-fn) + (cl-search helm-bookmark-search-fn) (match-part . helm-pp-bookmark-match-fn) (filtered-candidate-transformer helm-adaptive-sort @@ -187,7 +187,7 @@ Should be used with `helm-bookmark-search-fn' as `search' function." "Used as `filtered-candidate-transformer' to colorize bookmarks. Work both with standard Emacs bookmarks and bookmark-extensions.el." (let ((non-essential t)) - (loop for i in bookmarks + (cl-loop for i in bookmarks for isfile = (bookmark-get-filename i) for bufp = (and (fboundp 'bmkext-get-buffer-name) (bmkext-get-buffer-name i)) @@ -263,7 +263,7 @@ Work both with standard Emacs bookmarks and bookmark-extensions.el." ;;; Bookmarks attributes ;; (define-helm-type-attribute 'bookmark - `((coerce . helm-bookmark-get-bookmark-from-name) + `((cl-coerce . helm-bookmark-get-bookmark-from-name) (action ("Jump to bookmark" . helm-bookmark-jump) ("Jump to BM other window" . helm-bookmark-jump-other-window) @@ -304,7 +304,7 @@ Return nil if bmk is not a valid bookmark." (defun helm-delete-marked-bookmarks (ignore) "Delete this bookmark or all marked bookmarks." - (dolist (i (helm-marked-candidates)) + (cl-dolist (i (helm-marked-candidates)) (bookmark-delete (helm-bookmark-get-bookmark-from-name i) 'batch))) diff --git a/helm-buffers.el b/helm-buffers.el index 1f2a14cc..613ef971 100644 --- a/helm-buffers.el +++ b/helm-buffers.el @@ -88,7 +88,7 @@ When disabled (nil) use the longest buffer-name length found." ;;; Buffers keymap ;; (defvar helm-buffer-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "C-c ?") 'helm-buffer-help) ;; No need to have separate command for grep and zgrep @@ -114,7 +114,7 @@ When disabled (nil) use the longest buffer-name length found." "Keymap for buffer sources in helm.") (defvar helm-buffers-ido-virtual-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "C-c ?") 'helm-buffers-ido-virtual-help) (define-key map (kbd "C-c o") 'helm-ff-run-switch-other-window) @@ -133,7 +133,7 @@ When disabled (nil) use the longest buffer-name length found." (init . (lambda () ;; Issue #51 Create the list before `helm-buffer' creation. (setq helm-buffers-list-cache (helm-buffer-list)) - (let ((result (loop for b in helm-buffers-list-cache + (let ((result (cl-loop for b in helm-buffers-list-cache maximize (length b) into len-buf maximize (length (with-current-buffer b (symbol-name major-mode))) @@ -284,7 +284,7 @@ See `ido-make-buffer-list' for more infos." (defun helm-highlight-buffers (buffers source) "Transformer function to highlight BUFFERS list. Should be called after others transformers i.e (boring buffers)." - (loop for i in buffers + (cl-loop for i in buffers for (name size mode meta) = (if helm-buffer-details-flag (helm-buffer-details i 'details) (helm-buffer-details i)) @@ -348,12 +348,12 @@ with name matching pattern." (helm-buffers-match-inside cand (cdr split)))) ((string-match "\\s-" helm-pattern) (and (funcall match-mjm (car split) mjm) - (loop for i in (cdr split) always (string-match i cand)))) + (cl-loop for i in (cdr split) always (string-match i cand)))) (t (or (funcall match-mjm helm-pattern mjm) (string-match helm-pattern cand))))))))) (defun helm-buffers-match-inside (candidate lst) - (loop for i in lst + (cl-loop for i in lst always (cond ((string-match "\\`[\\]@" i) (string-match i candidate)) @@ -371,7 +371,7 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (let ((fn (if regexp-flag 'query-replace-regexp 'query-replace)) (prompt (if regexp-flag "Query replace regexp" "Query replace")) (bufs (helm-marked-candidates))) - (loop with replace = (query-replace-read-from prompt regexp-flag) + (cl-loop with replace = (query-replace-read-from prompt regexp-flag) with tostring = (unless (consp replace) (query-replace-read-to replace prompt regexp-flag)) @@ -409,7 +409,7 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (defun helm-buffer-revert-and-update (candidate) (let ((marked (helm-marked-candidates))) - (loop for buf in marked do (helm-revert-buffer buf)) + (cl-loop for buf in marked do (helm-revert-buffer buf)) (when (> (length marked) 1) (helm-unmark-all)) (helm-force-update candidate))) @@ -423,7 +423,7 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (defun helm-buffer-save-and-update (candidate) (let ((marked (helm-marked-candidates)) (enable-recursive-minibuffers t)) - (loop for buf in marked do + (cl-loop for buf in marked do (with-current-buffer (get-buffer buf) (save-buffer))) (when (> (length marked) 1) (helm-unmark-all)) @@ -519,15 +519,15 @@ If REGEXP-FLAG is given use `query-replace-regexp'." With optional arg MERGE call `ediff-merge-buffers'." (let ((lg-lst (length (helm-marked-candidates))) buf1 buf2) - (case lg-lst + (cl-case lg-lst (0 (error "Error:You have to mark at least 1 buffer")) (1 (setq buf1 helm-current-buffer - buf2 (first (helm-marked-candidates)))) + buf2 (cl-first (helm-marked-candidates)))) (2 - (setq buf1 (first (helm-marked-candidates)) - buf2 (second (helm-marked-candidates)))) + (setq buf1 (cl-first (helm-marked-candidates)) + buf2 (cl-second (helm-marked-candidates)))) (t (error "Error:To much buffers marked!"))) (if merge @@ -547,7 +547,7 @@ Can be used by any source that list buffers." (not helm-moccur-always-search-in-current) helm-moccur-always-search-in-current)) (buffers (helm-marked-candidates)) - (input (loop for i in (split-string helm-pattern " " t) + (input (cl-loop for i in (split-string helm-pattern " " t) thereis (and (string-match "\\`@\\(.*\\)" i) (match-string 1 i))))) (helm-multi-occur-1 buffers input))) diff --git a/helm-call-tree.el b/helm-call-tree.el index 454da448..b6402499 100644 --- a/helm-call-tree.el +++ b/helm-call-tree.el @@ -51,7 +51,7 @@ http://www.emacswiki.org/cgi-bin/wiki/download/simple-call-tree.el") (helm-simple-call-tree-analyze-maybe) (let ((list (funcall function simple-call-tree-alist))) (with-current-buffer (helm-candidate-buffer 'local) - (dolist (entry list) + (cl-dolist (entry list) (let ((funcs (concat " " (mapconcat #'identity (cdr entry) "\n ")))) (insert (car entry) message (if (string= funcs " ") @@ -78,7 +78,7 @@ http://www.emacswiki.org/cgi-bin/wiki/download/simple-call-tree.el") "" candidate) "\n"))) (setq helm-simple-call-tree-function-index -1)) - (incf helm-simple-call-tree-function-index) + (cl-incf helm-simple-call-tree-function-index) (helm-simple-call-tree-find-definition candidate)) (defun helm-simple-call-tree-find-definition (candidate) diff --git a/helm-command.el b/helm-command.el index 941125e5..dbeffded 100644 --- a/helm-command.el +++ b/helm-command.el @@ -49,9 +49,9 @@ Set it to 0 to show all candidates on startup." (defvar helm-M-x-input-history nil) -(defun* helm-M-x-get-major-mode-command-alist (mode-map) +(cl-defun helm-M-x-get-major-mode-command-alist (mode-map) "Return alist of MODE-MAP." - (loop for key being the key-seqs of mode-map using (key-bindings com) + (cl-loop for key being the key-seqs of mode-map using (key-bindings com) for str-key = (key-description key) for ismenu = (string-match "<menu-bar>" str-key) unless ismenu collect (cons str-key com))) @@ -61,7 +61,7 @@ Set it to 0 to show all candidates on startup." Some modes don't use conventional mode-map name so we need to guess mode-map name. e.g python-mode ==> py-mode-map. Return nil if no mode-map found." - (loop ;; Start with a conventional mode-map name. + (cl-loop ;; Start with a conventional mode-map name. with mode-map = (intern-soft (format "%s-map" mode)) with mode-string = (symbol-name mode) with mode-name = (replace-regexp-in-string "-mode" "" mode-string) @@ -75,7 +75,7 @@ Return nil if no mode-map found." (defun helm-M-x-current-mode-map-alist () "Return mode-map alist of current `major-mode'." - (let ((map (helm-get-mode-map-from-mode major-mode))) + (let ((cl-map (helm-get-mode-map-from-mode major-mode))) (when (and map (boundp map)) (helm-M-x-get-major-mode-command-alist (symbol-value map))))) @@ -84,7 +84,7 @@ Return nil if no mode-map found." "filtered-candidate-transformer to show bindings in emacs commands. Show global bindings and local bindings according to current `major-mode'." (with-helm-current-buffer - (loop with local-map = (helm-M-x-current-mode-map-alist) + (cl-loop with local-map = (helm-M-x-current-mode-map-alist) for cand in candidates for local-key = (car (rassq cand local-map)) for key = (substitute-command-keys (format "\\[%s]" cand)) @@ -108,7 +108,7 @@ Show global bindings and local bindings according to current `major-mode'." "Preconfigured `helm' for Emacs commands. It is `helm' replacement of regular `M-x' `execute-extended-command'." (interactive) - (let* ((history (loop with hist + (let* ((history (cl-loop with hist for i in extended-command-history for com = (intern i) when (commandp com) diff --git a/helm-config.el b/helm-config.el index 85b29e78..0ea090e8 100644 --- a/helm-config.el +++ b/helm-config.el @@ -49,7 +49,7 @@ :group 'helm-config :set (lambda (var key) - (dolist (map '(minibuffer-local-completion-map + (cl-dolist (cl-map '(minibuffer-local-completion-map minibuffer-local-filename-completion-map minibuffer-local-filename-must-match-map ; Emacs 23.1.+ minibuffer-local-isearch-map @@ -70,7 +70,7 @@ ;; ;; (defvar helm-command-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (define-key map (kbd "a") 'helm-apropos) (define-key map (kbd "e") 'helm-etags-select) (define-key map (kbd "l") 'helm-locate) @@ -180,7 +180,7 @@ (customize-group "helm")) ;;; Fontlock -(dolist (mode '(emacs-lisp-mode lisp-interaction-mode)) +(cl-dolist (mode '(emacs-lisp-mode lisp-interaction-mode)) (font-lock-add-keywords mode '(("(\\<\\(with-helm-after-update-hook\\)\\>" 1 font-lock-keyword-face) @@ -1543,7 +1543,7 @@ Keys description: (See `helm-mode-line-string') - KEYMAP: A keymap to use in this `helm-comp-read'. - (The keymap will be shared with history source) + (cl-the keymap will be shared with history source) - NAME: The name related to this local source. diff --git a/helm-dabbrev.el b/helm-dabbrev.el index 6f6114af..0309ea66 100644 --- a/helm-dabbrev.el +++ b/helm-dabbrev.el @@ -76,7 +76,7 @@ but the initial search for all candidates in buffer(s)." (other :tag "Smart" 'smart))) (defvar helm-dabbrev-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "M-/") 'helm-next-line) (define-key map (kbd "M-:") 'helm-previous-line) @@ -86,10 +86,10 @@ but the initial search for all candidates in buffer(s)." (defvar helm-dabbrev--exclude-current-buffer-flag nil) (defun helm-dabbrev--buffer-list () - (loop with lst = (buffer-list) + (cl-loop with lst = (buffer-list) for buf in (if helm-dabbrev--exclude-current-buffer-flag (cdr lst) lst) - unless (loop for r in helm-dabbrev-ignored-buffers-regexps + unless (cl-loop for r in helm-dabbrev-ignored-buffers-regexps thereis (string-match r (buffer-name buf))) collect buf)) @@ -132,8 +132,8 @@ but the initial search for all candidates in buffer(s)." (minibuf (minibufferp buffer1)) (search-and-store #'(lambda (pattern direction) - (declare (special result pos-before pos-after)) - (while (case direction + (cl-declare (special result pos-before pos-after)) + (while (cl-case direction (1 (search-forward pattern nil t)) (-1 (search-backward pattern nil t)) (2 (let ((pos @@ -157,11 +157,11 @@ but the initial search for all candidates in buffer(s)." (lst (if (string= match-1 match-2) (list match-1) (list match-1 match-2)))) - (loop for match in lst + (cl-loop for match in lst unless (or (string= str match) (member match result)) do (push match result))))))) - (loop with result with pos-before with pos-after + (cl-loop with result with pos-before with pos-after for buf in (if all (helm-dabbrev--buffer-list) (list (current-buffer))) @@ -188,12 +188,12 @@ but the initial search for all candidates in buffer(s)." finally return (nreverse result)))) (defun helm-dabbrev--get-candidates (abbrev) - (assert abbrev nil "[No Match]") + (cl-assert abbrev nil "[No Match]") (with-current-buffer (current-buffer) (let* ((dabbrev-get #'(lambda (str all-bufs) (helm-dabbrev--collect str helm-candidate-number-limit - (case helm-dabbrev-case-fold-search + (cl-case helm-dabbrev-case-fold-search (smart (helm-set-case-fold-search-1 abbrev)) (t helm-dabbrev-case-fold-search)) all-bufs))) @@ -208,7 +208,7 @@ but the initial search for all candidates in buffer(s)." ;; Internal (defvar helm-dabbrev--cache nil) (defvar helm-dabbrev--data nil) -(defstruct helm-dabbrev-info dabbrev limits iterator) +(cl-defstruct helm-dabbrev-info dabbrev limits iterator) (defvar helm-source-dabbrev `((name . "Dabbrev Expand") @@ -241,7 +241,7 @@ but the initial search for all candidates in buffer(s)." (helm-quit-if-no-candidate #'(lambda () (message "[Helm-dabbrev: No expansion found]")))) - (assert (and (stringp dabbrev) (not (string= dabbrev ""))) + (cl-assert (and (stringp dabbrev) (not (string= dabbrev ""))) nil "[Helm-dabbrev: Nothing found before point]") (when (and ;; have been called at least once. @@ -260,7 +260,7 @@ but the initial search for all candidates in buffer(s)." :limits limits :iterator (helm-iter-list - (loop with selection + (cl-loop with selection for i in helm-dabbrev--cache when (string-match diff --git a/helm-elisp.el b/helm-elisp.el index 542b8259..09de6286 100644 --- a/helm-elisp.el +++ b/helm-elisp.el @@ -102,7 +102,7 @@ BEG and END are the beginning and end position of the current completion in `helm-current-buffer'. BODY is an helm call where we want to enable show completion. If `helm-turn-on-show-completion' is nil just do nothing." - (declare (indent 2) (debug t)) + (cl-declare (indent 2) (debug t)) `(let ((helm-move-selection-after-hook (and helm-turn-on-show-completion (append (list 'helm-show-completion) @@ -205,7 +205,7 @@ Return a cons \(beg . end\)." '((name . "Lisp completion") (init . (lambda () (with-current-buffer (helm-candidate-buffer 'global) - (loop for sym in candidates + (cl-loop for sym in candidates for len = (length sym) when (> len lgst-len) do (setq lgst-len len) do (insert (concat sym "\n")))))) @@ -236,8 +236,8 @@ Return a cons \(beg . end\)." (defun helm-lisp-completion-transformer (candidates _source) "Helm candidates transformer for lisp completion." - (declare (special lgst-len)) - (loop for c in candidates + (cl-declare (special lgst-len)) + (cl-loop for c in candidates for sym = (intern c) for annot = (cond ((commandp sym) " (Com)") ((fboundp sym) " (Fun)") @@ -343,7 +343,7 @@ First call indent, second complete symbol, third complete fname." (not (string= default "nil")) (funcall test (intern default))) (insert (concat default "\n"))) - (loop with all = (all-completions "" obarray test) + (cl-loop with all = (all-completions "" obarray test) for sym in all for s = (intern sym) unless (or (and default (string= sym default)) @@ -366,7 +366,7 @@ First call indent, second complete symbol, third complete fname." (helm-apropos-init 'facep ,default))) (candidates-in-buffer) (filtered-candidate-transformer . (lambda (candidates _source) - (loop for c in candidates + (cl-loop for c in candidates collect (propertize c 'face (intern c))))) (action . (lambda (candidate) (describe-face (intern candidate)))))) @@ -442,11 +442,11 @@ First call indent, second complete symbol, third complete fname." (persistent-help . "Describe function / C-u C-z: Toggle advice"))) (defun helm-advice-candidates () - (loop for (fname) in ad-advised-functions + (cl-loop for (fname) in ad-advised-functions for function = (intern fname) append - (loop for class in ad-advice-classes append - (loop for advice in (ad-get-advice-info-field function class) + (cl-loop for class in ad-advice-classes append + (cl-loop for advice in (ad-get-advice-info-field function class) for enabled = (ad-advice-enabled advice) collect (cons (format @@ -462,7 +462,7 @@ First call indent, second complete symbol, third complete fname." (describe-function (car func-class-advice)))) (defun helm-advice-toggle (func-class-advice) - (destructuring-bind (function class advice) func-class-advice + (cl-destructuring-bind (function class advice) func-class-advice (cond ((ad-advice-enabled advice) (ad-advice-set-enabled advice nil) (message "Disabled")) @@ -512,7 +512,7 @@ First call indent, second complete symbol, third complete fname." 'global (helm-locate-library-scan-list))) (defun helm-locate-library-scan-list () - (loop for dir in load-path + (cl-loop for dir in load-path when (file-directory-p dir) append (directory-files dir t (regexp-opt (get-load-suffixes))) into lst @@ -545,7 +545,7 @@ First call indent, second complete symbol, third complete fname." (define-helm-type-attribute 'command `((action ("Call interactively" . helm-call-interactively) ,@actions) - (coerce . helm-symbolify) + (cl-coerce . helm-symbolify) (persistent-action . describe-function)) "Command. (string or symbol)") @@ -553,7 +553,7 @@ First call indent, second complete symbol, third complete fname." `((action . ,actions) (action-transformer helm-transform-function-call-interactively) (candidate-transformer helm-mark-interactive-functions) - (coerce . helm-symbolify)) + (cl-coerce . helm-symbolify)) "Function. (string or symbol)")) (define-helm-type-attribute 'variable @@ -562,7 +562,7 @@ First call indent, second complete symbol, third complete fname." ("Add variable to kill ring" . helm-kill-new) ("Go to variable's definition" . find-variable) ("Set variable" . helm-set-variable)) - (coerce . helm-symbolify)) + (cl-coerce . helm-symbolify)) "Variable.") (defun helm-sexp-eval (cand) diff --git a/helm-elscreen.el b/helm-elscreen.el index 96287490..e33afb64 100644 --- a/helm-elscreen.el +++ b/helm-elscreen.el @@ -27,7 +27,7 @@ "Open buffer in new screen, if marked buffers open all in elscreens." (helm-require-or-error 'elscreen 'helm-find-buffer-on-elscreen) (helm-aif (helm-marked-candidates) - (dolist (i it) + (cl-dolist (i it) (let ((target-screen (elscreen-find-screen-by-buffer (get-buffer i) 'create))) (elscreen-goto target-screen))) @@ -45,7 +45,7 @@ . (lambda () (if (cdr (elscreen-get-screen-to-name-alist)) (sort - (loop for sname in (elscreen-get-screen-to-name-alist) + (cl-loop for sname in (elscreen-get-screen-to-name-alist) append (list (format "[%d] %s" (car sname) (cdr sname)))) #'(lambda (a b) (compare-strings a nil nil b nil nil)))))) (action @@ -54,7 +54,7 @@ (elscreen-goto (- (aref candidate 1) (aref "0" 0))))) ("Kill Screen(s)" . (lambda (candidate) - (dolist (i (helm-marked-candidates)) + (cl-dolist (i (helm-marked-candidates)) (elscreen-goto (- (aref i 1) (aref "0" 0))) (elscreen-kill)))) ("Only Screen" . diff --git a/helm-emms.el b/helm-emms.el index f367ac56..b860ee98 100644 --- a/helm-emms.el +++ b/helm-emms.el @@ -43,7 +43,7 @@ (defun helm-emms-stream-edit-bookmark (elm) "Change the information of current emms-stream bookmark from helm." - (declare (special emms-stream-list)) + (cl-declare (special emms-stream-list)) (let* ((cur-buf helm-current-buffer) (bookmark (assoc elm emms-stream-list)) (name (read-from-minibuffer "Description: " @@ -67,7 +67,7 @@ (defun helm-emms-stream-delete-bookmark (candidate) "Delete emms-streams bookmarks from helm." (let* ((cands (helm-marked-candidates)) - (bmks (loop for bm in cands collect + (bmks (cl-loop for bm in cands collect (car (assoc bm emms-stream-list)))) (bmk-reg (mapconcat 'regexp-quote bmks "\\|^"))) (when (y-or-n-p (format "Really delete radios\n -%s: ? " @@ -75,7 +75,7 @@ (save-window-excursion (emms-streams) (goto-char (point-min)) - (loop while (re-search-forward bmk-reg nil t) + (cl-loop while (re-search-forward bmk-reg nil t) do (progn (forward-line 0) (emms-stream-delete-bookmark)) finally do (progn @@ -87,13 +87,13 @@ (init . (lambda () (emms-stream-init))) (candidates . (lambda () - (declare (special emms-stream-list)) + (cl-declare (special emms-stream-list)) (mapcar 'car emms-stream-list))) (action . (("Play" . (lambda (elm) - (declare (special emms-stream-list)) + (cl-declare (special emms-stream-list)) (let* ((stream (assoc elm emms-stream-list)) (fn (intern (concat "emms-play-" (symbol-name (car (last stream)))))) - (url (second stream))) + (url (cl-second stream))) (funcall fn url)))) ("Delete" . helm-emms-stream-delete-bookmark) ("Edit" . helm-emms-stream-edit-bookmark))) @@ -119,7 +119,7 @@ (defvar helm-emms-current-playlist nil) (defun helm-emms-files-modifier (candidates _source) - (loop for i in candidates + (cl-loop for i in candidates if (member (cdr i) helm-emms-current-playlist) collect (cons (propertize (car i) 'face 'helm-emms-playlist) @@ -137,14 +137,14 @@ (init . (lambda () (setq helm-emms-current-playlist (with-current-emms-playlist - (loop with cur-list = (emms-playlist-tracks-in-region + (cl-loop with cur-list = (emms-playlist-tracks-in-region (point-min) (point-max)) for i in cur-list for name = (assoc-default 'name i) when name collect name))))) (candidates . (lambda () - (loop for v being the hash-values in emms-cache-db + (cl-loop for v being the hash-values in emms-cache-db for name = (assoc-default 'name v) for artist = (or (assoc-default 'info-artist v) "unknown") for genre = (or (assoc-default 'info-genre v) "unknown") diff --git a/helm-eshell.el b/helm-eshell.el index 306553fe..82393e2c 100644 --- a/helm-eshell.el +++ b/helm-eshell.el @@ -34,14 +34,14 @@ (declare-function eshell-parse-arguments "esh-arg" (beg end)) (defvar helm-eshell-history-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "M-p") 'helm-next-line) map) "Keymap for `helm-eshell-history'.") (defvar helm-esh-completion-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "TAB") 'helm-next-line) map) @@ -58,7 +58,7 @@ (candidates . helm-esh-get-candidates) (filtered-candidate-transformer (lambda (candidates _sources) - (loop for i in candidates collect + (cl-loop for i in candidates collect (cons (abbreviate-file-name i) i)))) (action . helm-ec-insert)) "Helm source for Eshell completion.") @@ -90,7 +90,7 @@ The function that call this should set `helm-ec-target' to thing at point." (entry (or (try-completion helm-pattern (pcomplete-entries)) helm-pattern))) - (loop ;; expand entry too to be able to compare it with file-cand. + (cl-loop ;; expand entry too to be able to compare it with file-cand. with exp-entry = (and (stringp entry) (not (string= entry "")) (file-name-as-directory @@ -162,7 +162,7 @@ The function that call this should set `helm-ec-target' to thing at point." ;; Use thing-at-point instead of last args value ;; to exclude possible delimiters e.g "(". (target (thing-at-point 'symbol)) - (first (car args)) ; Maybe lisp delimiter "(". + (cl-first (car args)) ; Maybe lisp delimiter "(". last) ; Will be the last but parsed by pcomplete. (setq helm-ec-target (or target " ") end (point) diff --git a/helm-eval.el b/helm-eval.el index d5dd40a0..4304a03b 100644 --- a/helm-eval.el +++ b/helm-eval.el @@ -50,7 +50,7 @@ Should take one arg: the string to display." (defvar helm-eldoc-active-minibuffers-list nil) (defvar helm-eval-expression-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "<C-return>") 'helm-eval-new-line-and-indent) (define-key map (kbd "<tab>") 'lisp-indent-line) @@ -153,7 +153,7 @@ Should take one arg: the string to display." (defun helm-eval-expression-with-eldoc () "Preconfigured helm for `helm-source-evaluation-result' with `eldoc' support. " (interactive) - (declare (special eldoc-idle-delay)) + (cl-declare (special eldoc-idle-delay)) (let ((timer (run-with-idle-timer eldoc-idle-delay 'repeat 'helm-eldoc-show-in-eval))) diff --git a/helm-external.el b/helm-external.el index ab91c17a..6e9cf745 100644 --- a/helm-external.el +++ b/helm-external.el @@ -65,12 +65,12 @@ and sets `helm-external-commands-list'." (if helm-external-commands-list helm-external-commands-list (setq helm-external-commands-list - (loop + (cl-loop with paths = (split-string (getenv "PATH") path-separator) with completions = () for dir in paths when (and (file-exists-p dir) (file-accessible-directory-p dir)) - for lsdir = (loop for i in (directory-files dir t) + for lsdir = (cl-loop for i in (directory-files dir t) for bn = (file-name-nondirectory i) when (and (not (member bn completions)) (not (file-directory-p i)) @@ -93,7 +93,7 @@ In this case EXE must be provided as \"EXE %s\"." (if helm-raise-command (shell-command (format helm-raise-command real-com)) (error "Error: %s is already running" real-com)) - (when (loop for i in helm-external-commands-list thereis real-com) + (when (cl-loop for i in helm-external-commands-list thereis real-com) (message "Starting %s..." real-com) (if file (start-process-shell-command @@ -181,7 +181,7 @@ If not found or a prefix arg is given query the user which tool to use." (setq helm-external-command-history (cons real-prog-name (delete real-prog-name - (loop for i in helm-external-command-history + (cl-loop for i in helm-external-command-history when (executable-find i) collect i)))))) ;;;###autoload @@ -201,7 +201,7 @@ You can set your own list of commands with (helm-run-or-raise program) (setq helm-external-command-history (cons program (delete program - (loop for i in helm-external-command-history + (cl-loop for i in helm-external-command-history when (executable-find i) collect i))))) diff --git a/helm-files.el b/helm-files.el index 33a872c8..aa7dd2d2 100644 --- a/helm-files.el +++ b/helm-files.el @@ -283,7 +283,7 @@ This happen only in `helm-find-files'." ;; ;; Keymaps (defvar helm-find-files-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "C-]") 'helm-ff-run-toggle-basename) (define-key map (kbd "C-x C-f") 'helm-ff-run-locate) @@ -336,7 +336,7 @@ This happen only in `helm-find-files'." "Keymap for `helm-find-files'.") (defvar helm-read-file-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "<C-return>") 'helm-cr-empty-string) (define-key map (kbd "C-]") 'helm-ff-run-toggle-basename) @@ -355,7 +355,7 @@ This happen only in `helm-find-files'." "Keymap for `helm-read-file-name'.") (defvar helm-esh-on-file-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "C-c ?") 'helm-esh-help) map) @@ -510,13 +510,13 @@ ACTION must be an action supported by `helm-dired-action'." "Byte compile elisp files from `helm-find-files'." (let ((files (helm-marked-candidates)) (parg helm-current-prefix-arg)) - (loop for fname in files + (cl-loop for fname in files do (byte-compile-file fname parg)))) (defun helm-find-files-load-files (_candidate) "Load elisp files from `helm-find-files'." (let ((files (helm-marked-candidates))) - (loop for fname in files + (cl-loop for fname in files do (load fname)))) (defun helm-find-files-ediff-files-1 (candidate &optional merge) @@ -557,7 +557,7 @@ ACTION must be an action supported by `helm-dired-action'." (defun helm-ff-pdfgrep (_candidate) "Default action to pdfgrep files from `helm-find-files'." - (let ((cands (loop for file in (helm-marked-candidates) + (let ((cands (cl-loop for file in (helm-marked-candidates) if (or (string= (file-name-extension file) "pdf") (string= (file-name-extension file) "PDF")) collect file)) @@ -620,7 +620,7 @@ will not be loaded first time you use this." default-directory)) (command (helm-comp-read "Command: " - (loop for (a . c) in eshell-command-aliases-list + (cl-loop for (a . c) in eshell-command-aliases-list when (string-match "\\(\\$1\\|\\$\\*\\)$" (car c)) collect (propertize a 'help-echo (car c)) into ls finally return (sort ls 'string<)) @@ -665,7 +665,7 @@ will not be loaded first time you use this." (eshell-command (format "%s %s" command mapfiles)))) ;; Run eshell-command on EACH marked files. - (loop for i in cand-list + (cl-loop for i in cand-list for bn = (helm-basename i) for files = (format "'%s'" i) for com = (if (string-match "'%s'\\|\"%s\"\\|%s" command) @@ -715,7 +715,7 @@ See `helm-ff-serial-rename-1'." (expand-file-name helm-ff-default-directory) :test 'file-directory-p :must-match t))) - (res (loop for f in cands + (res (cl-loop for f in cands for bn = (helm-basename f) for count from start concat (format "%s <-> %s%s.%s\n" @@ -735,7 +735,7 @@ See `helm-ff-serial-rename-1'." (cur-dir (expand-file-name (file-name-as-directory directory)))) (string= dir-file cur-dir))) -(defun* helm-ff-serial-rename-1 +(cl-defun helm-ff-serial-rename-1 (directory collection new-name start-at-num extension &key (method 'rename)) "rename files in COLLECTION to DIRECTORY with the prefix name NEW-NAME. Rename start at number START-AT-NUM - ex: prefixname-01.jpg. @@ -746,11 +746,11 @@ Files will be renamed if they are files of current directory, otherwise they will be treated with METHOD. Default METHOD is rename." ;; Maybe remove directories selected by error in collection. - (setq collection (remove-if 'file-directory-p collection)) + (setq collection (cl-remove-if 'file-directory-p collection)) (let* ((tmp-dir (file-name-as-directory (concat (file-name-as-directory directory) - (symbol-name (gensym "tmp"))))) - (fn (case method + (symbol-name (cl-gensym "tmp"))))) + (fn (cl-case method (copy 'copy-file) (symlink 'make-symbolic-link) (rename 'rename-file) @@ -761,7 +761,7 @@ Default METHOD is rename." ;; Rename all files to tmp-dir with new-name. ;; If files are not from start directory, use method ;; to move files to tmp-dir. - (loop for i in collection + (cl-loop for i in collection for count from start-at-num for fnum = (if (< count 10) "0%s" "%s") for nname = (concat tmp-dir new-name (format fnum count) @@ -773,7 +773,7 @@ Default METHOD is rename." (rename-file i nname) (funcall fn i nname))) ;; Now move all from tmp-dir to destination. - (loop with dirlist = (directory-files + (cl-loop with dirlist = (directory-files tmp-dir t directory-files-no-dot-files-regexp) for f in dirlist do (if (file-symlink-p f) @@ -1094,7 +1094,7 @@ The checksum is copied to kill-ring." (helm-attrset 'toggle-basename '(helm-ff-toggle-basename . never-split)) (helm-execute-persistent-action 'toggle-basename))) -(defun* helm-reduce-file-name (fname level &key unix-close expand) +(cl-defun helm-reduce-file-name (fname level &key unix-close expand) "Reduce FNAME by LEVEL from end or beginning depending LEVEL value. If LEVEL is positive reduce from end else from beginning. If UNIX-CLOSE is non--nil close filename with /. @@ -1104,8 +1104,8 @@ If EXPAND is non--nil expand-file-name." exp-fname fname) "/" t)) (len (length fname-list)) (pop-list (if (< level 0) - (subseq fname-list (* level -1)) - (subseq fname-list 0 (- len level)))) + (cl-subseq fname-list (* level -1)) + (cl-subseq fname-list 0 (- len level)))) (result (mapconcat 'identity pop-list "/")) (empty (string= result ""))) (when unix-close (setq result (concat result "/"))) @@ -1132,7 +1132,7 @@ You should not modify this yourself unless you know what you do.") "Return non--nil if current source is a file completion source." (or (with-helm-buffer helm-in-file-completion-p) (let ((cur-source (cdr (assoc 'name (helm-get-current-source))))) - (loop for i in helm-file-completion-sources + (cl-loop for i in helm-file-completion-sources thereis (string= cur-source i))))) ;;;###autoload @@ -1297,10 +1297,10 @@ On windows system substitute from start up to \"/[a-z]:/\"." (defun helm-create-tramp-name (fname) "Build filename for `helm-pattern' like /su:: or /sudo::." (apply #'tramp-make-tramp-file-name - (loop with v = (tramp-dissect-file-name fname) + (cl-loop with v = (tramp-dissect-file-name fname) for i across v collect i))) -(defun* helm-ff-tramp-hostnames (&optional (pattern helm-pattern)) +(cl-defun helm-ff-tramp-hostnames (&optional (pattern helm-pattern)) "Get a list of hosts for tramp method found in `helm-pattern'. Argument PATTERN default to `helm-pattern', it is here only for debugging purpose." @@ -1309,8 +1309,8 @@ purpose." (tn (match-string 0 pattern)) (all-methods (mapcar 'car tramp-methods))) (helm-fast-remove-dups - (loop for (f . h) in (tramp-get-completion-function method) - append (loop for e in (funcall f (car h)) + (cl-loop for (f . h) in (tramp-get-completion-function method) + append (cl-loop for e in (funcall f (car h)) for host = (and (consp e) (cadr e)) when (and host (not (member host all-methods))) collect (concat tn host))) @@ -1325,7 +1325,7 @@ purpose." (error "Error: Unknow file or directory `%s'" cand)))) (add-hook 'helm-before-action-hook 'helm-ff-before-action-hook-fn) -(defun* helm-ff-invalid-tramp-name-p (&optional (pattern helm-pattern)) +(cl-defun helm-ff-invalid-tramp-name-p (&optional (pattern helm-pattern)) "Return non--nil when PATTERN is an invalid tramp filename." (string= (helm-ff-set-pattern pattern) "Invalid tramp file name")) @@ -1467,7 +1467,7 @@ systems." (defun helm-ff-handle-backslash (fname) ;; Allow creation of filenames containing a backslash. - (loop with bad = '((92 . "")) + (cl-loop with bad = '((92 . "")) for i across fname for isbad = (assq i bad) if isbad concat (cdr isbad) @@ -1491,7 +1491,7 @@ If FNAME is a valid directory name,return FNAME unchanged." (let ((bn (helm-basename fname)) (bd (or (helm-basedir fname) "")) (dir-p (file-directory-p fname)) - (tramp-p (loop for (m . f) in tramp-methods + (tramp-p (cl-loop for (m . f) in tramp-methods thereis (string-match m fname)))) ;; Always regexp-quote base directory name to handle ;; crap dirnames such e.g bookmark+ @@ -1565,7 +1565,7 @@ Note that only directories are saved here." (defun helm-get-default-mode-for-file (filename) "Return the default mode to open FILENAME." - (let ((mode (loop for (r . m) in auto-mode-alist + (let ((mode (cl-loop for (r . m) in auto-mode-alist thereis (and (string-match r filename) m)))) (or (and (symbolp mode) mode) "Fundamental"))) @@ -1574,16 +1574,16 @@ Note that only directories are saved here." (let* ((all (helm-file-attributes candidate)) (dired-line (helm-file-attributes candidate :dired t :human-size t)) - (type (getf all :type)) - (mode-type (getf all :mode-type)) - (owner (getf all :uid)) - (owner-right (getf all :user t)) - (group (getf all :gid)) - (group-right (getf all :group)) - (other-right (getf all :other)) - (size (helm-file-human-size (getf all :size))) - (modif (getf all :modif-time)) - (access (getf all :access-time)) + (type (cl-getf all :type)) + (mode-type (cl-getf all :mode-type)) + (owner (cl-getf all :uid)) + (owner-right (cl-getf all :user t)) + (group (cl-getf all :gid)) + (group-right (cl-getf all :group)) + (other-right (cl-getf all :other)) + (size (helm-file-human-size (cl-getf all :size))) + (modif (cl-getf all :modif-time)) + (access (cl-getf all :access-time)) (ext (helm-get-default-program-for-file candidate)) (tooltip-hide-delay (or helm-tooltip-hide-delay tooltip-hide-delay))) (if (and (window-system) tooltip-mode) @@ -1633,7 +1633,7 @@ Note that only directories are saved here." "Delete file CANDIDATE without quitting." (let ((marked (helm-marked-candidates))) (save-selected-window - (loop for c in marked do + (cl-loop for c in marked do (progn (helm-preselect (if (and helm-ff-transformer-show-only-basename (not (helm-ff-dot-file-p c))) (helm-basename c) c)) @@ -1709,7 +1709,7 @@ is non--nil." helm-ff-tramp-not-fancy) (> (length files) helm-ff-maximum-candidate-to-decorate)) (if helm-ff-transformer-show-only-basename - (loop for i in files collect + (cl-loop for i in files collect (if (helm-dir-is-dot i) i (cons (or (helm-ff-get-host-from-tramp-invalid-fname i) (helm-basename i)) i))) @@ -1752,7 +1752,7 @@ Return candidates prefixed with basename of `helm-input' first." "Candidate transformer function for `helm-source-find-files'. Don't use it directly in `filtered-candidate-transformer' use instead `helm-find-files-transformer'." - (loop for i in files + (cl-loop for i in files for disp = (if (and helm-ff-transformer-show-only-basename (not (helm-dir-is-dot i)) (not (and ffap-url-regexp @@ -1831,7 +1831,7 @@ Don't use it directly in `filtered-candidate-transformer' use instead (defun helm-ff-rotate-current-image-1 (file &optional num-arg) "Rotate current image at NUM-ARG degrees. This is a destructive operation on FILE made by external tool mogrify." - (declare (special image-dired-display-image-buffer)) + (cl-declare (special image-dired-display-image-buffer)) (setq file (file-truename file)) ; For symlinked images. ;; When FILE is not an image-file, do nothing. (when (string-match (image-file-name-regexp) file) @@ -1924,10 +1924,10 @@ If a prefix arg is given or `helm-follow-mode' is on open file." (setq helm-ff-last-expanded helm-ff-default-directory)) (funcall insert-in-minibuffer (file-name-as-directory (expand-file-name candidate)))) - ;; A symlink file, expand to it's true name. (first hit) + ;; A symlink file, expand to it's true name. (cl-first hit) ((and (file-symlink-p candidate) (not current-prefix-arg) (not follow)) (funcall insert-in-minibuffer (file-truename candidate))) - ;; A regular file, expand it, (first hit) + ;; A regular file, expand it, (cl-first hit) ((and (>= num-lines-buf 3) (not current-prefix-arg) (not follow)) (funcall insert-in-minibuffer new-pattern)) ;; An image file and it is the second hit on C-z, @@ -1982,7 +1982,7 @@ If a prefix arg is given or `helm-follow-mode' is on open file." (abbreviate-file-name candidate)))) (insert candidate)))))) -(defun* helm-find-files-history (&key (comp-read t)) +(cl-defun helm-find-files-history (&key (comp-read t)) "The `helm-find-files' history. Show the first `helm-ff-history-max-length' elements of `helm-ff-history' in an `helm-comp-read'." @@ -1992,7 +1992,7 @@ Show the first `helm-ff-history-max-length' elements of (when history (setq helm-ff-history (if (>= (length history) helm-ff-history-max-length) - (subseq history 0 helm-ff-history-max-length) + (cl-subseq history 0 helm-ff-history-max-length) history)) (if comp-read (helm-comp-read @@ -2076,7 +2076,7 @@ Use it for non--interactive calls of `helm-find-files'." ;; Org link. (when (and (stringp he) (string-match "^LINK: " he)) (setq he (replace-match "" t t he))) - (loop for i in (list he ov-he w3m-l nt-prop) + (cl-loop for i in (list he ov-he w3m-l nt-prop) thereis (and (stringp i) ffap-url-regexp (string-match ffap-url-regexp i) i)))) (defun helm-find-library-at-point () @@ -2095,33 +2095,33 @@ Find inside `require' and `declare-function' sexp." "'\\|\)\\|\(" "" ;; If require use third arg, ignore it, ;; always use library path found in `load-path'. - (second (split-string (match-string 0 sexp)))))) + (cl-second (split-string (match-string 0 sexp)))))) ((and sexp (string-match-p "^declare-function" sexp)) (find-library-name (replace-regexp-in-string "\"\\|ext:" "" - (third (split-string sexp))))) + (cl-third (split-string sexp))))) (t nil))))) ;;; Handle copy, rename, symlink, relsymlink and hardlink from helm. ;; ;; -(defun* helm-dired-action (candidate +(cl-defun helm-dired-action (candidate &key action follow (files (dired-get-marked-files))) "Execute ACTION on FILES to CANDIDATE. Where ACTION is a symbol that can be one of: 'copy, 'rename, 'symlink,'relsymlink, 'hardlink. Argument FOLLOW when non--nil specify to follow FILES to destination." - (declare (special helm-async-be-async)) + (cl-declare (special helm-async-be-async)) (when (get-buffer dired-log-buffer) (kill-buffer dired-log-buffer)) - (let ((fn (case action + (let ((fn (cl-case action (copy 'dired-copy-file) (rename 'dired-rename-file) (symlink 'make-symbolic-link) (relsymlink 'dired-make-relative-symlink) (hardlink 'dired-hardlink))) - (marker (case action + (marker (cl-case action ((copy rename) dired-keep-marker-copy) (symlink dired-keep-marker-symlink) (relsymlink dired-keep-marker-relsymlink) @@ -2170,7 +2170,7 @@ If RENAME-DIR-FLAG is non--nil collect the `directory-file-name' of transformed members of FLIST." ;; At this point files have been renamed/copied at destination. ;; That's mean DEST-CAND exists. - (loop + (cl-loop with dest = (expand-file-name dest-cand) for src in flist for basename-src = (helm-basename src) @@ -2208,7 +2208,7 @@ following files to destination." "Returns a list of buffer names corresponding to FILENAME." (let ((name (expand-file-name filename)) (buf-list ())) - (dolist (buf (buffer-list) buf-list) + (cl-dolist (buf (buffer-list) buf-list) (let ((bfn (buffer-file-name buf))) (when (and bfn (string= name bfn)) (push (buffer-name buf) buf-list)))))) @@ -2238,7 +2238,7 @@ Ask to kill buffers associated with that file, too." (dired-delete-file file dired-recursive-deletes delete-by-moving-to-trash)) (when buffers - (dolist (buf buffers) + (cl-dolist (buf buffers) (when (y-or-n-p (format "Kill buffer %s, too? " buf)) (kill-buffer buf)))))) @@ -2250,7 +2250,7 @@ Ask to kill buffers associated with that file, too." len (mapconcat (lambda (f) (format "- %s\n" f)) files "")))) (message "(No deletions performed)") - (dolist (i files) + (cl-dolist (i files) (set-text-properties 0 (length i) nil i) (helm-delete-file i helm-ff-signal-error-on-dot-files)) (message "%s File(s) deleted" len)))) @@ -2341,7 +2341,7 @@ Else return ACTIONS unmodified." ;; (defun helm-files-in-all-dired-candidates () (save-excursion - (loop for (f . b) in dired-buffers + (cl-loop for (f . b) in dired-buffers when (buffer-live-p b) append (let ((dir (with-current-buffer b dired-directory))) (if (listp dir) (cdr dir) @@ -2368,9 +2368,9 @@ Else return ACTIONS unmodified." (require 'filecache nil t) (unless helm-file-cache-initialized-p (setq helm-file-cache-files - (loop for item in file-cache-alist append - (destructuring-bind (base &rest dirs) item - (loop for dir in dirs collect + (cl-loop for item in file-cache-alist append + (cl-destructuring-bind (base &rest dirs) item + (cl-loop for dir in dirs collect (concat dir base))))) (defadvice file-cache-add-file (after file-cache-list activate) (add-to-list 'helm-file-cache-files (expand-file-name file))) @@ -2414,7 +2414,7 @@ Else return ACTIONS unmodified." (expand-file-name candidate)))))))) (defun helm-file-name-history-transformer (candidates _source) - (loop for c in candidates collect + (cl-loop for c in candidates collect (cond ((file-remote-p c) (cons (propertize c 'face 'helm-history-remote) c)) ((file-exists-p c) @@ -2441,7 +2441,7 @@ Else return ACTIONS unmodified." (candidates . recentf-list) (match . helm-files-match-only-basename) (filtered-candidate-transformer . (lambda (candidates _source) - (loop for i in candidates + (cl-loop for i in candidates if helm-ff-transformer-show-only-basename collect (cons (helm-basename i) i) else collect i))) @@ -2498,7 +2498,7 @@ and (defvar helm-source-session `((name . "Session") (candidates . (lambda () - (delete-if-not #'(lambda (f) + (cl-delete-if-not #'(lambda (f) (or (string-match tramp-file-name-regexp f) (file-exists-p f))) (mapcar 'car session-file-alist)))) @@ -2516,7 +2516,7 @@ and (defun helm-highlight-files (files) "A basic transformer for helm files sources. Colorize only symlinks, directories and files." - (loop for i in files + (cl-loop for i in files for disp = (if (and helm-ff-transformer-show-only-basename (not (helm-dir-is-dot i)) (not (and ffap-url-regexp @@ -2569,7 +2569,7 @@ Colorize only symlinks, directories and files." "tracker-search" helm-pattern))) (filtered-candidate-transformer . (lambda (candidates _source) - (loop for cand in (cdr candidates) + (cl-loop for cand in (cdr candidates) collect (ansi-color-apply cand)))) (action . ,(cdr (helm-get-attribute-from-type 'action 'file))) (action-transformer @@ -2620,7 +2620,7 @@ utility mdfind.") (delayed))) (defun helm-findutils-transformer (candidates _source) - (loop for i in candidates + (cl-loop for i in candidates for abs = (expand-file-name i helm-default-directory) for disp = (if (and helm-ff-transformer-show-only-basename (not (string-match "[.]\\{1,2\\}$" i))) @@ -2686,7 +2686,7 @@ Called with a prefix arg show history if some. Don't call it from programs, use `helm-find-files-1' instead. This is the starting point for nearly all actions you can do on files." (interactive "P") - (declare (special org-directory)) + (cl-declare (special org-directory)) (let* ((hist (and arg helm-ff-history (helm-find-files-history))) (default-input (or hist (helm-find-files-initial-input))) (input (cond ((and (eq major-mode 'org-agenda-mode) diff --git a/helm-firefox.el b/helm-firefox.el index e4b66848..8d22ee48 100644 --- a/helm-firefox.el +++ b/helm-firefox.el @@ -88,7 +88,7 @@ (assoc-default elm helm-firefox-bookmarks-alist)) (defun helm-highlight-firefox-bookmarks (bookmarks source) - (loop for i in bookmarks + (cl-loop for i in bookmarks collect (propertize i 'face '((:foreground "YellowGreen")) 'help-echo (helm-firefox-bookmarks-get-value i)))) diff --git a/helm-font.el b/helm-font.el index 8db06353..0411d5d3 100644 --- a/helm-font.el +++ b/helm-font.el @@ -21,7 +21,7 @@ (require 'helm) (defvar helm-ucs-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "<C-backspace>") 'helm-ucs-persistent-delete) (define-key map (kbd "<C-left>") 'helm-ucs-persistent-backward) @@ -66,7 +66,7 @@ (defvar helm-ucs-max-len 0) (defun helm-calculate-ucs-max-len () "Calculate the length of longest `ucs-names' candidate." - (loop with count = 0 + (cl-loop with count = 0 for (n . v) in (ucs-names) for len = (length n) if (> len count) @@ -83,7 +83,7 @@ Only math* symbols are collected." (get-buffer-create "*helm ucs*")) ;; `ucs-names' fn will not run again, data is cached in ;; var `ucs-names'. - (loop for (n . v) in (ucs-names) + (cl-loop for (n . v) in (ucs-names) for len = (length n) for diff = (+ (- helm-ucs-max-len len) 2) unless (string= "" n) diff --git a/helm-gentoo.el b/helm-gentoo.el index e7434ae6..eb28dc96 100644 --- a/helm-gentoo.el +++ b/helm-gentoo.el @@ -85,11 +85,11 @@ (setq helm-cache-world (helm-gentoo-get-world)))))))) -(defun* helm-gentoo-install (candidate &key action) +(cl-defun helm-gentoo-install (candidate &key action) (setq helm-external-commands-list nil) (ansi-term (getenv "SHELL") "Gentoo emerge") (term-line-mode) - (let ((command (case action + (let ((command (cl-case action ('install "sudo emerge -av ") ('uninstall "sudo emerge -avC ") (t (error "Unknow action")))) @@ -154,7 +154,7 @@ (let* ((portage-buf (get-buffer-create "*helm-gentoo*")) (buf (helm-candidate-buffer 'portage-buf))) (with-current-buffer buf - (dolist (i helm-cache-gentoo) + (cl-dolist (i helm-cache-gentoo) (insert (concat i "\n")))))) (defun helm-gentoo-setup-cache () @@ -183,7 +183,7 @@ (let* ((use-buf (get-buffer-create "*helm-gentoo-use*")) (buf (helm-candidate-buffer 'use-buf))) (with-current-buffer buf - (dolist (i helm-gentoo-use-flags) + (cl-dolist (i helm-gentoo-use-flags) (insert (concat i "\n")))))) @@ -197,7 +197,7 @@ (defun helm-gentoo-get-url (elm) "Return a list of urls from eix output." - (loop with url-list = (split-string + (cl-loop with url-list = (split-string (with-temp-buffer (call-process "eix" nil t nil elm "--format" "<homepage>\n") @@ -226,7 +226,7 @@ (defun helm-highlight-world (eix) "Highlight all installed package." - (loop for i in eix + (cl-loop for i in eix if (member i helm-cache-world) collect (propertize i 'face 'helm-gentoo-match) else @@ -234,7 +234,7 @@ (defun helm-highlight-local-use (use-flags) (let ((local-uses (helm-gentoo-get-local-use))) - (loop for i in use-flags + (cl-loop for i in use-flags if (member i local-uses) collect (propertize i 'face 'helm-gentoo-match) else diff --git a/helm-grep.el b/helm-grep.el index 31cda29f..414e3ee7 100644 --- a/helm-grep.el +++ b/helm-grep.el @@ -171,7 +171,7 @@ If set to nil `doc-view-mode' will be used instead of an external command." ;; ;; (defvar helm-grep-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "M-<down>") 'helm-goto-next-file) (define-key map (kbd "M-<up>") 'helm-goto-precedent-file) @@ -187,7 +187,7 @@ If set to nil `doc-view-mode' will be used instead of an external command." "Keymap used in Grep sources.") (defvar helm-pdfgrep-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "M-<down>") 'helm-goto-next-file) (define-key map (kbd "M-<up>") 'helm-goto-precedent-file) @@ -197,7 +197,7 @@ If set to nil `doc-view-mode' will be used instead of an external command." "Keymap used in pdfgrep.") (defvar helm-grep-mode-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (define-key map (kbd "RET") 'helm-grep-mode-jump) (define-key map (kbd "C-o") 'helm-grep-mode-jump-other-window) (define-key map (kbd "q") 'helm-grep-mode-quit) @@ -247,7 +247,7 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") candidates)) (if helm-zgrep-recurse-flag (mapconcat 'shell-quote-argument candidates " ") - (loop for i in candidates append + (cl-loop for i in candidates append (cond ((string-match "^git" helm-grep-default-command) (list i)) ;; Candidate is a directory and we use recursion. @@ -291,8 +291,8 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") helm-grep-default-command) " ")))) (if (string= com "git") "git-grep" com))) -(defun* helm-grep-use-ack-p (&key where) - (case where +(cl-defun helm-grep-use-ack-p (&key where) + (cl-case where (default (string= (helm-grep-command) "ack-grep")) (recursive (string= (helm-grep-command t) "ack-grep")) (strict (and (string= (helm-grep-command t) "ack-grep") @@ -439,7 +439,7 @@ WHERE can be one of other-window, elscreen, other-frame." (tramp-prefix (concat "/" tramp-method ":" tramp-host ":")) (fname (if tramp-host (concat tramp-prefix loc-fname) loc-fname))) - (case where + (cl-case where (other-window (find-file-other-window fname)) (elscreen (helm-elscreen-find-file fname)) (other-frame (find-file-other-frame fname)) @@ -587,7 +587,7 @@ If N is positive go forward otherwise go backward." new-buf) (when (get-buffer buf) (setq new-buf (read-string "GrepBufferName: " buf)) - (loop for b in (helm-buffer-list) + (cl-loop for b in (helm-buffer-list) when (and (string= new-buf b) (not (y-or-n-p (format "Buffer `%s' already exists overwrite? " @@ -676,7 +676,7 @@ Special commands: (call-process "ack-grep" nil t nil "--help" "types") (goto-char (point-min)) - (loop while (re-search-forward + (cl-loop while (re-search-forward "^ *--\\(\\[no\\]\\)\\([^. ]+\\) *\\(.*\\)" nil t) collect (cons (concat (match-string 2) " [" (match-string 3) "]") @@ -686,7 +686,7 @@ Special commands: (concat "no" (match-string 2)))))) (defun helm-grep-ack-types-transformer (candidates _source) - (loop for i in candidates + (cl-loop for i in candidates if (stringp i) collect (rassoc i helm-grep-ack-types-cache) else @@ -715,7 +715,7 @@ Special commands: (defun helm-grep-guess-extensions (files) "Try to guess file extensions in FILES list when using grep recurse. These extensions will be added to command line with --include arg of grep." - (loop with glob-list + (cl-loop with glob-list with ext-list = (list helm-grep-preferred-ext "*") with lst = (if (file-directory-p (car files)) (directory-files @@ -747,7 +747,7 @@ These extensions will be added to command line with --include arg of grep." ;; assume user entered more than one glob separated by space(s) and ;; split this string to pass it later to mapconcat. ;; e.g '("*.el *.py") - (loop for i in extensions + (cl-loop for i in extensions append (split-string-and-unquote i " ")) (list "*")))) @@ -894,11 +894,11 @@ in recurse, search being made on `helm-zgrep-file-extension-regexp'." (when (string-match helm-grep-split-line-regexp line) ;; Don't use split-string because buffer/file name or string ;; may contain a ":". - (loop for n from 1 to 3 collect (match-string n line)))) + (cl-loop for n from 1 to 3 collect (match-string n line)))) (defun helm-grep-cand-transformer (candidates sources) "Filtered candidate transformer function for `helm-do-grep'." - (loop with root = (and helm-grep-default-directory-fn + (cl-loop with root = (and helm-grep-default-directory-fn (funcall helm-grep-default-directory-fn)) for i in candidates for split = (and i (helm-grep-split-line i)) @@ -924,8 +924,8 @@ in recurse, search being made on `helm-zgrep-file-extension-regexp'." (with-temp-buffer (insert str) (goto-char (point-min)) - (loop for reg in (if multi-match - (loop for r in (helm-mp-split-pattern + (cl-loop for reg in (if multi-match + (cl-loop for r in (helm-mp-split-pattern helm-pattern) unless (string-match "\\`!" r) collect r) @@ -961,7 +961,7 @@ If a prefix arg is given run grep on all buffers ignoring non--file-buffers." (helm-marked-candidates))) (win-conf (current-window-configuration)) ;; Non--fname and remote buffers are ignored. - (bufs (loop for buf in cands + (bufs (cl-loop for buf in cands for fname = (buffer-file-name (get-buffer buf)) when (and fname (not (file-remote-p fname))) collect (expand-file-name fname)))) diff --git a/helm-help.el b/helm-help.el index 66c6dbc9..0cc98691 100644 --- a/helm-help.el +++ b/helm-help.el @@ -126,13 +126,13 @@ text to be displayed in BUFNAME." 'face 'helm-helper)) (scroll-error-top-bottom t)) (condition-case err - (loop for event = (read-key prompt) do - (case event + (cl-loop for event = (read-key prompt) do + (cl-case event ((?\C-v ? down) (scroll-up-command helm-scroll-amount)) ((?\M-v ?b up) (scroll-down-command helm-scroll-amount)) ((?\C-s) (isearch-forward)) ((?\C-r) (isearch-backward)) - (t (return)))) + (t (cl-return)))) (beginning-of-buffer (message "Beginning of buffer")) (end-of-buffer (message "End of Buffer"))))) @@ -898,7 +898,7 @@ HELM-ATTRIBUTE should be a symbol." before action function. Example: converting string to symbol - (coerce . intern)") + (cl-coerce . intern)") (helm-document-attribute 'type "optional if action attribute is provided" " Indicates the type of the items the source returns. @@ -1029,7 +1029,7 @@ HELM-ATTRIBUTE should be a symbol." useful in case of sources with lots of candidates.") (helm-document-attribute 'persistent-action "optional" - " Can be a either a Function called with one parameter (the + " Can be a either a Function called with one parameter (cl-the selected candidate) or a cons cell where first element is this same function and second element a symbol (e.g never-split) that inform `helm-execute-persistent-action'to not split his diff --git a/helm-imenu.el b/helm-imenu.el index 119ef1a9..19b961e6 100644 --- a/helm-imenu.el +++ b/helm-imenu.el @@ -51,7 +51,7 @@ (defun helm-imenu-create-candidates (entry) "Create candidates with ENTRY." (if (listp (cdr entry)) - (mapcan + (cl-mapcan (lambda (sub) (if (consp (cdr sub)) (mapcar @@ -82,7 +82,7 @@ (setq helm-cached-imenu-tick tick helm-cached-imenu-candidates (ignore-errors - (mapcan + (cl-mapcan 'helm-imenu-create-candidates (setq helm-cached-imenu-alist (let ((index (imenu--make-index-alist))) @@ -99,7 +99,7 @@ (helm-log-run-hook 'helm-goto-line-before-hook) (let ((path (split-string elm helm-imenu-delimiter)) (alist helm-cached-imenu-alist)) - (dolist (elm path) + (cl-dolist (elm path) (setq alist (assoc elm alist))) (imenu alist))) diff --git a/helm-info.el b/helm-info.el index b1ee9255..c3b44543 100644 --- a/helm-info.el +++ b/helm-info.el @@ -50,7 +50,7 @@ Arg SOURCE will be an existing helm source named Sources are generated for all entries of `helm-default-info-index-list'. If COMMANDS arg is non--nil build also commands named `helm-info<NAME>'. Where NAME is one of `helm-default-info-index-list'." - (loop with symbols = (loop for str in var-value + (cl-loop with symbols = (cl-loop for str in var-value collect (intern (concat "helm-source-info-" str))) for sym in symbols diff --git a/helm-locate.el b/helm-locate.el index 0c3ea796..9c57194b 100644 --- a/helm-locate.el +++ b/helm-locate.el @@ -85,7 +85,7 @@ the opposite of \"locate\" command." (defvar helm-generic-files-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "C-]") 'helm-ff-run-toggle-basename) (define-key map (kbd "C-s") 'helm-ff-run-grep) @@ -174,7 +174,7 @@ See `helm-locate-with-db' and `helm-locate'." "Setup `helm-locate-command' if not already defined." (unless helm-locate-command (setq helm-locate-command - (case system-type + (cl-case system-type (gnu/linux "locate %s -r %s") (berkeley-unix "locate %s %s") (windows-nt "es %s %s") @@ -198,7 +198,7 @@ See also `helm-locate'." (mapconcat 'identity ;; Remove eventually ;; marked directories by error. - (loop for i in db + (cl-loop for i in db unless (file-directory-p i) collect i) ":")) helm-locate-command) @@ -223,7 +223,7 @@ See also `helm-locate'." (start-process-shell-command "locate-process" helm-buffer (format helm-locate-command - (case helm-locate-case-fold-search + (cl-case helm-locate-case-fold-search (smart (let ((case-fold-search nil)) (if (string-match "[A-Z]" helm-pattern) case-sensitive-flag diff --git a/helm-match-plugin.el b/helm-match-plugin.el index c0ae1356..369893d2 100644 --- a/helm-match-plugin.el +++ b/helm-match-plugin.el @@ -36,7 +36,7 @@ (defun helm-mp-set-matching-method (var key) "Default function to set matching methods in helm match plugin." (set-default var key) - (case (symbol-value var) + (cl-case (symbol-value var) (multi1 (setq helm-mp-default-match-functions '(helm-mp-exact-match helm-mp-1-match) helm-mp-default-search-functions @@ -135,7 +135,7 @@ i.e \"foo bar\"=> (\"foo\" \"bar\") but \"foo\ bar\"=> (\"foobar\")." (if (string= pattern "") '("") - (loop for s in (split-string + (cl-loop for s in (split-string (replace-regexp-in-string helm-mp-space-regexp "\000\000" pattern) " " t) @@ -213,7 +213,7 @@ but \"foo\ bar\"=> (\"foobar\")." (concat "^" (helm-mp-1-make-regexp pattern)))) helm-mp-1-pattern-real) -(defun* helm-mp-1-match (str &optional (pattern helm-pattern)) +(cl-defun helm-mp-1-match (str &optional (pattern helm-pattern)) (string-match (helm-mp-1-get-pattern pattern) str)) (defun helm-mp-1-search (pattern &rest ignore) @@ -237,7 +237,7 @@ but \"foo\ bar\"=> (\"foobar\")." (concat "^.*" (helm-mp-1-make-regexp pattern)))) helm-mp-2-pattern-real) -(defun* helm-mp-2-match (str &optional (pattern helm-pattern)) +(cl-defun helm-mp-2-match (str &optional (pattern helm-pattern)) (string-match (helm-mp-2-get-pattern pattern) str)) (defun helm-mp-2-search (pattern &rest ignore) @@ -268,7 +268,7 @@ This is done only if `helm-mp-3-pattern-str' is same as PATTERN." "Return a list of predicate/regexp cons cells. e.g ((identity . \"foo\") (identity . \"bar\"))." (unless (string= pattern "") - (loop for pat in (helm-mp-split-pattern pattern) + (cl-loop for pat in (helm-mp-split-pattern pattern) collect (if (string= "!" (substring pat 0 1)) (cons 'not (substring pat 1)) (cons 'identity pat))))) @@ -285,7 +285,7 @@ Then each predicate of cons cell(s) is called with regexp of same cons cell against STR (a candidate). i.e (identity (string-match \"foo\" \"foo bar\")) => t." (let ((pat (helm-mp-3-get-patterns (or pattern helm-pattern)))) - (loop for (predicate . regexp) in pat + (cl-loop for (predicate . regexp) in pat always (funcall predicate (string-match regexp str))))) (defun helm-mp-3-search-base (pattern searchfn1 searchfn2) @@ -294,13 +294,13 @@ This is the search function for `candidates-in-buffer' enabled sources. Use the same method as `helm-mp-3-match' except it search in buffer instead of matching on a string. i.e (identity (re-search-forward \"foo\" (point-at-eol) t)) => t." - (loop with pat = (if (stringp pattern) + (cl-loop with pat = (if (stringp pattern) (helm-mp-3-get-patterns pattern) pattern) while (funcall searchfn1 (or (cdar pat) "") nil t) for bol = (point-at-bol) for eol = (point-at-eol) - if (loop for (pred . str) in (cdr pat) always + if (cl-loop for (pred . str) in (cdr pat) always (progn (goto-char bol) (funcall pred (funcall searchfn2 str eol t)))) do (goto-char eol) and return t @@ -329,9 +329,9 @@ Same as `helm-mp-3-match' but more strict, matching against prefix also. e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to `helm-mp-3-match'." (let* ((pat (helm-mp-3-get-patterns (or pattern helm-pattern))) - (first (car pat))) + (cl-first (car pat))) (and (funcall (car first) (helm-mp-prefix-match str (cdr first))) - (loop for (predicate . regexp) in (cdr pat) + (cl-loop for (predicate . regexp) in (cdr pat) always (funcall predicate (string-match regexp str)))))) (defun helm-mp-3p-search (pattern &rest ignore) @@ -375,7 +375,7 @@ e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to `(,(if (or (assoc 'candidates-in-buffer source) (equal '(identity) matchfns)) '(match identity) `(match ,@matchfns)) - (search ,@searchfns) + (cl-search ,@searchfns) ,@source)))) @@ -408,7 +408,7 @@ e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to (defun helm-mp-highlight-match-internal (end) (when helm-alive-p (set-buffer helm-buffer) - (let ((requote (loop for (pred . re) in + (let ((requote (cl-loop for (pred . re) in (helm-mp-3-get-patterns helm-pattern) when (and (eq pred 'identity) (>= (length re) diff --git a/helm-misc.el b/helm-misc.el index 5e21de96..a65a8264 100644 --- a/helm-misc.el +++ b/helm-misc.el @@ -43,9 +43,9 @@ ;;; Latex completion (defun helm-latex-math-candidates () "Collect candidates for latex math completion." - (declare (special LaTeX-math-menu)) - (loop for i in (cddr LaTeX-math-menu) - for elm = (loop for s in i when (vectorp s) + (cl-declare (special LaTeX-math-menu)) + (cl-loop for i in (cddr LaTeX-math-menu) + for elm = (cl-loop for s in i when (vectorp s) collect (cons (aref s 0) (aref s 1))) append elm)) @@ -121,7 +121,7 @@ http://www.emacswiki.org/cgi-bin/wiki/download/linkd.el") . (lambda () (ignore-errors (with-helm-current-buffer - (loop initially (goto-char (point-min)) + (cl-loop initially (goto-char (point-min)) while (re-search-forward (format ee-anchor-format "\\([^\.].+\\)") nil t) for anchor = (match-string-no-properties 1) @@ -140,7 +140,7 @@ http://www.emacswiki.org/cgi-bin/wiki/download/linkd.el") "List online Jabber contacts." (with-no-warnings (let (jids) - (dolist (item (jabber-concat-rosters) jids) + (cl-dolist (item (jabber-concat-rosters) jids) (when (get item 'connected) (push (if (get item 'name) (cons (get item 'name) item) @@ -159,7 +159,7 @@ http://www.emacswiki.org/cgi-bin/wiki/download/linkd.el") ;;; World time ;; (defun helm-time-zone-transformer (candidates sources) - (loop for i in candidates + (cl-loop for i in candidates collect (cond ((string-match (format-time-string "%H:%M" (current-time)) i) (propertize i 'face 'helm-time-zone-current)) @@ -214,7 +214,7 @@ It is added to `extended-command-history'. (format "%s (%s)" name minibuffer-history-variable))) (candidates . (lambda () - (let ((history (loop for i in + (let ((history (cl-loop for i in (symbol-value minibuffer-history-variable) unless (string= "" i) collect i))) (if (consp (car history)) diff --git a/helm-mode.el b/helm-mode.el index 20b91777..8f51e21c 100644 --- a/helm-mode.el +++ b/helm-mode.el @@ -87,7 +87,7 @@ This enable support for `completing-read-multiple' when non--nil." (defvar helm-comp-read-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "<C-return>") 'helm-cr-empty-string) map) @@ -146,9 +146,9 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." (cond ((eq collection obarray) (all-completions "" collection test)) ((and (vectorp collection) test) - (loop for i across collection when (funcall test i) collect i)) + (cl-loop for i across collection when (funcall test i) collect i)) ((vectorp collection) - (loop for i across collection collect i)) + (cl-loop for i across collection collect i)) ;; When collection is a symbol, most of the time ;; it should be a symbol used as a minibuffer-history. ;; The value of this symbol in this case return a list @@ -170,14 +170,14 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." ((and (symbolp collection) (boundp collection)) (all-completions "" (symbol-value collection))) ((and alistp test) - (loop for i in collection when (funcall test i) collect i)) + (cl-loop for i in collection when (funcall test i) collect i)) (alistp collection) (t (all-completions "" collection test))))) (if sort-fn (sort cands sort-fn) cands))) (defun helm-cr-default-transformer (candidates _source) "Default filter candidate function for `helm-comp-read'." - (loop with lst for c in candidates + (cl-loop with lst for c in candidates for cand = (if (stringp c) (replace-regexp-in-string "\\s\\" "" c) c) for pat = (replace-regexp-in-string "\\s\\" "" helm-pattern) if (and (equal cand pat) helm-cr-unknow-pattern-flag) @@ -191,7 +191,7 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." finally return (helm-fast-remove-dups lst :test 'equal))) ;;;###autoload -(defun* helm-comp-read (prompt collection +(cl-defun helm-comp-read (prompt collection &key test initial-input @@ -268,7 +268,7 @@ Keys description: (See `helm-mode-line-string') - KEYMAP: A keymap to use in this `helm-comp-read'. - (The keymap will be shared with history source) + (cl-the keymap will be shared with history source) - NAME: The name related to this local source. @@ -307,7 +307,7 @@ that use `helm-comp-read' See `helm-M-x' for example." (setq must-match 'confirm)) (let* ((minibuffer-completion-confirm must-match) (must-match-map (when must-match - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (define-key map (kbd "RET") 'helm-confirm-and-exit-minibuffer) map))) @@ -334,7 +334,7 @@ that use `helm-comp-read' See `helm-M-x' for example." :test 'equal))))) (filtered-candidate-transformer . (lambda (candidates sources) - (loop for i in candidates + (cl-loop for i in candidates ;; Input is added to history in completing-read's ;; and may be regexp-quoted, so unquote it. for cand = (replace-regexp-in-string "\\s\\" "" i) @@ -377,7 +377,7 @@ that use `helm-comp-read' See `helm-M-x' for example." (setq cands (append (list helm-pattern) cands)) (setq helm-cr-unknow-pattern-flag t)) (with-current-buffer (helm-candidate-buffer 'global) - (loop for i in + (cl-loop for i in (if (and default (not (string= default ""))) (delq nil (cons default (delete default cands))) cands) @@ -472,7 +472,7 @@ that use `helm-comp-read' See `helm-M-x' for example." (not (string= default "nil")) (not (string= default ""))) (insert (concat default "\n"))) - (loop with all = (all-completions "" obarray test) + (cl-loop with all = (all-completions "" obarray test) for sym in all for s = (intern sym) unless (or (and default (string= sym default)) @@ -551,7 +551,7 @@ It should be used when candidate list don't need to rebuild dynamically." init hist default inherit-input-method name buffer t))) -(defun* helm-completing-read-default +(cl-defun helm-completing-read-default (prompt collection &optional predicate require-match initial-input hist def @@ -562,7 +562,7 @@ This function should be used only as a `completing-read-function'. Don't use it directly, use instead `helm-comp-read' in your programs. See documentation of `completing-read' and `all-completions' for details." - (declare (special helm-mode)) + (cl-declare (special helm-mode)) (let* ((current-command (or (helm-this-command) this-command)) (str-command (if (consp current-command) ; Maybe a lambda. "Anonymous" @@ -593,7 +593,7 @@ See documentation of `completing-read' and `all-completions' for details." ;; a nil value, so we exit from here, disable `helm-mode' ;; and run the command again with it original behavior. ;; `helm-mode' will be restored on exit. - (return-from helm-completing-read-default + (cl-return-from helm-completing-read-default (unwind-protect (progn (helm-mode -1) @@ -636,7 +636,7 @@ See documentation of `completing-read' and `all-completions' for details." ;;; Generic read-file-name ;; ;; -(defun* helm-read-file-name +(cl-defun helm-read-file-name (prompt &key (name "Read File Name") @@ -705,7 +705,7 @@ Keys description: history nil nil alistp))) (minibuffer-completion-confirm must-match) (must-match-map (when must-match - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (define-key map (kbd "RET") 'helm-confirm-and-exit-minibuffer) map))) @@ -744,7 +744,7 @@ Keys description: (not (file-exists-p helm-pattern)) (list helm-pattern)) (if test - (loop with hn = (helm-ff-tramp-hostnames) + (cl-loop with hn = (helm-ff-tramp-hostnames) for i in (helm-find-files-get-candidates must-match) when (or (member i hn) ; A tramp host @@ -786,10 +786,10 @@ Keys description: (identity helm-pattern)) (keyboard-quit))))) -(defun* helm-generic-read-file-name +(cl-defun helm-generic-read-file-name (prompt &optional dir default-filename mustmatch initial predicate) "An helm replacement of `read-file-name'." - (declare (special helm-mode)) + (cl-declare (special helm-mode)) (let* ((init (or initial dir default-directory)) (current-command (or (helm-this-command) this-command)) (str-command (symbol-name current-command)) @@ -820,7 +820,7 @@ Keys description: (when (and def-com (> (length (help-function-arglist def-com)) 8)) (setq def-com 'incompatible)) (unless (or (not entry) def-com) - (return-from helm-generic-read-file-name + (cl-return-from helm-generic-read-file-name (unwind-protect (progn (helm-mode -1) @@ -869,7 +869,7 @@ Keys description: (defun helm--completion-in-region (start end collection &optional predicate) "[EXPERIMENTAL] Helm replacement of `completion--in-region'. Can be used as value for `completion-in-region-function'." - (declare (special require-match prompt)) + (cl-declare (special require-match prompt)) (let* ((enable-recursive-minibuffers t) (input (buffer-substring start end)) (result (helm-comp-read prompt @@ -906,7 +906,7 @@ Note: This mode is incompatible with Emacs23." :group 'helm-mode :global t :lighter helm-completion-mode-string - (assert (boundp 'completing-read-function) nil + (cl-assert (boundp 'completing-read-function) nil "`helm-mode' not available, upgrade to Emacs-24") (if helm-mode (progn diff --git a/helm-net.el b/helm-net.el index b0a52d55..4ecf8558 100644 --- a/helm-net.el +++ b/helm-net.el @@ -100,14 +100,14 @@ Return an alist with elements like (data . number_results)." (let ((request (concat helm-google-suggest-url (url-hexify-string input))) (fetch #'(lambda () - (loop + (cl-loop with result-alist = (xml-get-children (car (xml-parse-region (point-min) (point-max))) 'CompleteSuggestion) for i in result-alist - for data = (cdr (caadr (assoc 'suggestion i))) - for nqueries = (cdr (caadr (assoc 'num_queries i))) + for data = (cdr (cl-caadr (assoc 'suggestion i))) + for nqueries = (cdr (cl-caadr (assoc 'num_queries i))) for lqueries = (length (helm-ggs-set-number-result nqueries)) for ldata = (length data) @@ -130,7 +130,7 @@ Return an alist with elements like (data . number_results)." (defun helm-google-suggest-set-candidates (&optional request-prefix) "Set candidates with result and number of google results found." (let ((suggestions - (loop with suggested-results = (helm-google-suggest-fetch + (cl-loop with suggested-results = (helm-google-suggest-fetch (or (and request-prefix (concat request-prefix " " helm-pattern)) @@ -158,7 +158,7 @@ Return an alist with elements like (data . number_results)." for display = (format "%s%s(%s results)" real spaces align-fnumresult) collect (cons display real)))) - (if (loop for (disp . dat) in suggestions + (if (cl-loop for (disp . dat) in suggestions thereis (equal dat helm-pattern)) suggestions ;; if there is no suggestion exactly matching the input then @@ -172,7 +172,7 @@ Return an alist with elements like (data . number_results)." (if num (progn (and (numberp num) (setq num (number-to-string num))) - (loop for i in (reverse (split-string num "" t)) + (cl-loop for i in (reverse (split-string num "" t)) for count from 1 append (list i) into C when (= count 3) @@ -219,13 +219,13 @@ Return an alist with elements like (data . number_results)." (url-hexify-string input)))) (with-current-buffer (url-retrieve-synchronously request) - (loop with result-alist = + (cl-loop with result-alist = (xml-get-children (car (xml-parse-region (point-min) (point-max))) 'Result) for i in result-alist - collect (caddr i))))) + collect (cl-caddr i))))) (defun helm-yahoo-suggest-set-candidates () "Set candidates with Yahoo results found." @@ -274,7 +274,7 @@ Return an alist with elements like (data . number_results)." (,browse-url-xterm-program . browse-url-text-xterm)) "*Alist of \(executable . function\) to try to find a suitable url browser.") -(defun* helm-generic-browser (url name &rest args) +(cl-defun helm-generic-browser (url name &rest args) "Browse URL with NAME browser." (let ((proc (concat name " " url))) (message "Starting %s..." name) @@ -300,7 +300,7 @@ Return an alist with elements like (data . number_results)." (defun helm-browse-url-default-browser (url &rest args) "Find the first available browser and ask it to load URL." (let ((default-browser-fn - (loop for (exe . fn) in helm-browse-url-default-browser-alist + (cl-loop for (exe . fn) in helm-browse-url-default-browser-alist thereis (and exe (executable-find exe) (and (fboundp fn) fn))))) (if default-browser-fn diff --git a/helm-plugin.el b/helm-plugin.el index f87771d5..2c2bac95 100644 --- a/helm-plugin.el +++ b/helm-plugin.el @@ -29,7 +29,7 @@ ;;; Plug-in: `info-index' ;; ;; -(defun* helm-info-init (&optional (file (helm-attr 'info-file))) +(cl-defun helm-info-init (&optional (file (helm-attr 'info-file))) ;; Allow reinit candidate buffer when using edebug. (helm-aif (and debug-on-error (helm-candidate-buffer)) @@ -42,7 +42,7 @@ (infobuf (current-buffer)) s e (nodes (or (helm-attr 'index-nodes) (Info-index-nodes)))) - (dolist (node nodes) + (cl-dolist (node nodes) (Info-goto-node node) (goto-char (point-min)) (while (search-forward "\n* " nil t) @@ -115,7 +115,7 @@ (add-to-list 'helm-compile-source-functions 'helm-compile-source--candidates-file) (defun helm-p-candidates-file-init () - (destructuring-bind (file &optional updating) + (cl-destructuring-bind (file &optional updating) (helm-mklist (helm-attr 'candidates-file)) (setq file (helm-interpret-value file)) (with-current-buffer (helm-candidate-buffer 'global) @@ -194,8 +194,8 @@ (arrange #'(lambda (headlines) (unless (null headlines) ; FIX headlines empty bug! - (loop with curhead = (make-vector - (1+ (loop for (_ . hierarchy) in headlines + (cl-loop with curhead = (make-vector + (1+ (cl-loop for (_ . hierarchy) in headlines maximize hierarchy)) "") for ((str . pt) . hierarchy) in headlines @@ -204,27 +204,27 @@ (cons (format "H%d:%s" (1+ hierarchy) (mapconcat 'identity - (loop for i from 0 to hierarchy + (cl-loop for i from 0 to hierarchy collecting (aref curhead i)) " / ")) pt)))))) (if (listp regexp) (funcall arrange (sort - (loop for re in regexp + (cl-loop for re in regexp for hierarchy from 0 do (goto-char (point-min)) appending - (loop + (cl-loop while (re-search-forward re nil t) collect (cons (funcall matched) hierarchy))) (lambda (a b) (> (cdar b) (cdar a))))) - (loop while (re-search-forward regexp nil t) + (cl-loop while (re-search-forward regexp nil t) collect (funcall matched))))))) (defun helm-headline-make-candidate-buffer (regexp subexp) (with-current-buffer (helm-candidate-buffer 'local) - (loop for (content . pos) in (helm-headline-get-candidates regexp subexp) + (cl-loop for (content . pos) in (helm-headline-get-candidates regexp subexp) do (insert (format "%5d:%s\n" (with-helm-current-buffer diff --git a/helm-regexp.el b/helm-regexp.el index e6c12b37..0170c4bb 100644 --- a/helm-regexp.el +++ b/helm-regexp.el @@ -51,7 +51,7 @@ This setting apply also to `helm-source-occur'." (defvar helm-moccur-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "M-<down>") 'helm-goto-next-file) (define-key map (kbd "M-<up>") 'helm-goto-precedent-file) @@ -124,7 +124,7 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b." (let ((matches (match-data)) (line (buffer-substring s e))) (propertize - (loop with ln = (format "%5d: %s" (line-number-at-pos (1- s)) line) + (cl-loop with ln = (format "%5d: %s" (line-number-at-pos (1- s)) line) for i from 0 to (1- (/ (length matches) 2)) concat (format "\n %s'%s'" (format "Group %d: " i) (match-string i)) into ln1 @@ -173,7 +173,7 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b." helm-multi-occur-buffer-list)) (helm-init-candidates-in-buffer 'global - (loop for buf in helm-multi-occur-buffer-list + (cl-loop for buf in helm-multi-occur-buffer-list for bufstr = (with-current-buffer buf (buffer-string)) do (add-text-properties 0 (length bufstr) @@ -193,7 +193,7 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b." (line-number-at-pos beg)) (buffer-substring beg end))) -(defun* helm-m-occur-action (candidate +(cl-defun helm-m-occur-action (candidate &optional (method (quote buffer)) mark) "Jump to CANDIDATE with METHOD. arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame." @@ -204,13 +204,13 @@ arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame." (split-pat (if helm-occur-match-plugin-mode (helm-mp-split-pattern helm-pattern) (list helm-pattern)))) - (case method + (cl-case method (buffer (switch-to-buffer buf)) (buffer-other-window (switch-to-buffer-other-window buf)) (buffer-other-frame (switch-to-buffer-other-frame buf))) (helm-goto-line lineno) ;; Move point to the nearest matching regexp from bol. - (loop for reg in split-pat + (cl-loop for reg in split-pat when (save-excursion (re-search-forward reg (point-at-eol) t)) collect (match-beginning 0) into pos-ls @@ -307,7 +307,7 @@ Same as `helm-m-occur-goto-line' but go in new frame." (defun helm-m-occur-transformer (candidates _source) "Transformer function for `helm-source-moccur'." (require 'helm-grep) - (loop for i in candidates + (cl-loop for i in candidates for split = (helm-grep-split-line i) for buf = (car split) for lineno = (nth 1 split) diff --git a/helm-ring.el b/helm-ring.el index d23a1402..c931ece8 100644 --- a/helm-ring.el +++ b/helm-ring.el @@ -56,7 +56,7 @@ If nil or zero (disabled), don't truncate candidate, show all." ;; ;; (defvar helm-kill-ring-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "M-y") 'helm-next-line) (define-key map (kbd "M-u") 'helm-previous-line) @@ -70,7 +70,7 @@ If nil or zero (disabled), don't truncate candidate, show all." (filtered-candidate-transformer helm-kill-ring-transformer) (action . (("Yank" . helm-kill-ring-action) ("Delete" . (lambda (candidate) - (loop for cand in (helm-marked-candidates) + (cl-loop for cand in (helm-marked-candidates) do (setq kill-ring (delete cand kill-ring))))))) (keymap . ,helm-kill-ring-map) @@ -80,14 +80,14 @@ If nil or zero (disabled), don't truncate candidate, show all." "Source for browse and insert contents of kill-ring.") (defun helm-kill-ring-candidates () - (loop for kill in (helm-fast-remove-dups kill-ring :test 'equal) + (cl-loop for kill in (helm-fast-remove-dups kill-ring :test 'equal) unless (or (< (length kill) helm-kill-ring-threshold) (string-match "\\`[\n[:blank:]]+\\'" kill)) collect kill)) (defun helm-kill-ring-transformer (candidates _source) "Display only the `helm-kill-ring-max-lines-number' lines of candidate." - (loop for i in candidates + (cl-loop for i in candidates for nlines = (with-temp-buffer (insert i) (count-lines (point-min) (point-max))) if (and helm-kill-ring-max-lines-number (> nlines helm-kill-ring-max-lines-number)) @@ -151,7 +151,7 @@ replace with STR as yanked string." (defun helm-mark-ring-get-candidates () (with-helm-current-buffer - (loop with marks = (if (mark t) (cons (mark-marker) mark-ring) mark-ring) + (cl-loop with marks = (if (mark t) (cons (mark-marker) mark-ring) mark-ring) with recip = nil for i in marks for m = (helm-mark-ring-get-marks i) @@ -178,11 +178,11 @@ replace with STR as yanked string." (action . (("Goto line" . (lambda (candidate) (let ((items (split-string candidate ":"))) - (helm-switch-to-buffer (second items)) + (helm-switch-to-buffer (cl-second items)) (helm-goto-line (string-to-number (car items)))))))) (persistent-action . (lambda (candidate) (let ((items (split-string candidate ":"))) - (helm-switch-to-buffer (second items)) + (helm-switch-to-buffer (cl-second items)) (helm-goto-line (string-to-number (car items))) (helm-match-line-color-current-line)))) (persistent-help . "Show this line"))) @@ -202,7 +202,7 @@ replace with STR as yanked string." (defun helm-global-mark-ring-get-candidates () (let ((marks global-mark-ring)) (when marks - (loop with recip = nil + (cl-loop with recip = nil for i in marks for gm = (unless (or (string-match "^ " (format "%s" (marker-buffer i))) @@ -225,7 +225,7 @@ replace with STR as yanked string." (defun helm-register-candidates () "Collecting register contents and appropriate commands." - (loop for (char . val) in register-alist + (cl-loop for (char . val) in register-alist for key = (single-key-description char) for string-actions = (cond @@ -290,7 +290,7 @@ replace with STR as yanked string." (defun helm-register-action-transformer (actions register-and-functions) "Decide actions by the contents of register." - (loop with func-actions = + (cl-loop with func-actions = '((insert-register "Insert Register" . (lambda (c) (insert-register (car c)))) diff --git a/helm-semantic.el b/helm-semantic.el index 76473062..db1ad621 100644 --- a/helm-semantic.el +++ b/helm-semantic.el @@ -30,9 +30,9 @@ (defun helm-semantic-init-candidates (tags depth) "Write the contents of TAGS to the current buffer." - (dolist (tag tags) + (cl-dolist (tag tags) (when (listp tag) - (case (semantic-tag-class tag) + (cl-case (semantic-tag-class tag) ((function variable type) (insert diff --git a/helm-sys.el b/helm-sys.el index 679ebf07..aa52eb12 100644 --- a/helm-sys.el +++ b/helm-sys.el @@ -38,7 +38,7 @@ A format string where %s will be replaced with `frame-width'." ;; (defvar helm-top-sort-fn nil) (defvar helm-top-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "C-c ?") 'helm-top-help) (define-key map (kbd "M-P") 'helm-top-run-sort-by-cpu) @@ -64,7 +64,7 @@ A format string where %s will be replaced with `frame-width'." (defun helm-top-transformer (candidates _source) "Transformer for `helm-top'. Return empty string for non--valid candidates." - (loop for disp in candidates collect + (cl-loop for disp in candidates collect (if (string-match "^ *[0-9]+" disp) disp (cons disp "")))) (defun helm-top-action-transformer (actions candidate) @@ -109,7 +109,7 @@ Show actions only on line starting by a PID." (defun helm-top-sort-transformer (candidates source) (helm-top-transformer (if helm-top-sort-fn - (loop for c in candidates + (cl-loop for c in candidates if (string-match "^ *[0-9]+" c) collect c into pid-cands else collect c into header-cands finally return (append (butlast header-cands) @@ -202,7 +202,7 @@ Show actions only on line starting by a PID." (call-process "xrandr" nil (current-buffer) nil "--screen" (helm-xrandr-screen) "-q") (goto-char 1) - (loop with modes = nil + (cl-loop with modes = nil while (re-search-forward " \\([0-9]+x[0-9]+\\)" nil t) for mode = (match-string 1) unless (member mode modes) diff --git a/helm-tags.el b/helm-tags.el index 030daa87..609f5759 100644 --- a/helm-tags.el +++ b/helm-tags.el @@ -38,7 +38,7 @@ Don't search tag file deeply if outside this value." (defvar helm-etags-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map helm-map) (define-key map (kbd "M-<down>") 'helm-goto-next-file) (define-key map (kbd "M-<up>") 'helm-goto-precedent-file) @@ -70,7 +70,7 @@ Don't search tag file deeply if outside this value." (goto-char (point-min)) (forward-line 2) (delete-region (point-min) (point)) - (loop while (and (not (eobp)) (search-forward "\001" (point-at-eol) t)) + (cl-loop while (and (not (eobp)) (search-forward "\001" (point-at-eol) t)) for lineno-start = (point) for lineno = (buffer-substring lineno-start @@ -123,15 +123,15 @@ If not found in CURRENT-DIR search in upper directory." (and (stringp tag-path) (file-regular-p tag-path) (file-readable-p tag-path)))))) - (loop with count = 0 + (cl-loop with count = 0 until (funcall file-exists? current-dir) ;; Return nil if outside the value of ;; `helm-etags-tag-file-search-limit'. if (= count helm-etags-tag-file-search-limit) - do (return nil) + do (cl-return nil) ;; Or search upper directories. else - do (incf count) + do (cl-incf count) (setq current-dir (expand-file-name (concat current-dir "../"))) finally return current-dir))) @@ -151,7 +151,7 @@ If not found in CURRENT-DIR search in upper directory." (setq max (line-number-at-pos (point-max))) (kill-buffer)))) (progress-reporter (make-progress-reporter "Loading tag file..." 0 max))) - (loop + (cl-loop with fname with cand for i in split for count from 0 diff --git a/helm-utils.el b/helm-utils.el index f11fa352..ef4264e9 100644 --- a/helm-utils.el +++ b/helm-utils.el @@ -165,7 +165,7 @@ Return nil if DIR is not an existing directory." (if handler (funcall handler 'file-in-directory-p file dir) (when (file-directory-p dir) - (loop with f1 = (file-truename file) + (cl-loop with f1 = (file-truename file) with f2 = (file-truename dir) with ls1 = (or (split-string f1 "/" t) (list "/")) with ls2 = (or (split-string f2 "/" t) (list "/")) @@ -195,7 +195,7 @@ Return nil if DIR is not an existing directory." (let ((printer-list (with-temp-buffer (call-process "lpstat" nil t nil "-a") (split-string (buffer-string) "\n")))) - (loop for p in printer-list + (cl-loop for p in printer-list for printer = (car (split-string p)) when printer collect printer)))) @@ -206,7 +206,7 @@ Return nil if DIR is not an existing directory." (with-no-warnings (switch-to-buffer buffer-or-name))) -(defun* helm-position (item seq &key (test 'eq) all) +(cl-defun helm-position (item seq &key (test 'eq) all) "A simple and faster replacement of CL `position'. Return position of first occurence of ITEM found in SEQ. Argument SEQ can be a string, in this case ITEM have to be a char. @@ -214,7 +214,7 @@ Argument ALL, if non--nil specify to return a list of positions of all ITEM found in SEQ." (let ((key (if (stringp seq) 'across 'in))) (eval - `(loop for c ,key seq + `(cl-loop for c ,key seq for index from 0 when (funcall test c item) if all collect index into ls @@ -230,12 +230,12 @@ Handle multibyte characters by moving by columns." (move-to-column width) (buffer-substring (point-at-bol) (point)))) -(defun* helm-substring-by-width (str width &optional (endstr "...")) +(cl-defun helm-substring-by-width (str width &optional (endstr "...")) "Truncate string STR to end at column WIDTH. Similar to `truncate-string-to-width'. Add ENDSTR (default \"...\") at end of truncated STR. Add spaces at end if needed to reach WIDTH when STR is shorter than WIDTH." - (loop for ini-str = str + (cl-loop for ini-str = str then (substring ini-str 0 (1- (length ini-str))) for sw = (string-width ini-str) when (<= sw width) return @@ -243,18 +243,18 @@ Add spaces at end if needed to reach WIDTH when STR is shorter than WIDTH." (defun helm-string-multibyte-p (str) "Check if string STR contains multibyte characters." - (loop for c across str + (cl-loop for c across str thereis (> (char-width c) 1))) (defun helm-get-pid-from-process-name (process-name) "Get pid from running process PROCESS-NAME." - (loop with process-list = (list-system-processes) + (cl-loop with process-list = (list-system-processes) for pid in process-list for process = (assoc-default 'comm (process-attributes pid)) when (and process (string-match process-name process)) return pid)) -(defun* helm-current-buffer-narrowed-p (&optional +(cl-defun helm-current-buffer-narrowed-p (&optional (buffer helm-current-buffer)) "Check if BUFFER is narrowed. Default is `helm-current-buffer'." @@ -324,7 +324,7 @@ With a numeric prefix arg show only the ARG number of candidates." "Return the list of sources name for this helm session." (with-current-buffer helm-buffer (goto-char (point-min)) - (loop with pos + (cl-loop with pos while (setq pos (next-single-property-change (point) 'helm-header)) do (goto-char pos) collect (buffer-substring-no-properties (point-at-bol)(point-at-eol)) @@ -349,8 +349,8 @@ even is \" -b\" is specified." (defun helm-skip-entries (seq regexp-list) "Remove entries which matches one of REGEXP-LIST from SEQ." - (loop for i in seq - unless (loop for regexp in regexp-list + (cl-loop for i in seq + unless (cl-loop for regexp in regexp-list thereis (and (stringp i) (string-match regexp i))) collect i)) @@ -358,8 +358,8 @@ even is \" -b\" is specified." (defun helm-shadow-entries (seq regexp-list) "Put shadow property on entries in SEQ matching a regexp in REGEXP-LIST." (let ((face 'italic)) - (loop for i in seq - if (loop for regexp in regexp-list + (cl-loop for i in seq + if (cl-loop for regexp in regexp-list thereis (and (stringp i) (string-match regexp i))) collect (propertize i 'face face) @@ -400,18 +400,18 @@ even is \" -b\" is specified." See `kill-new' for argument REPLACE." (kill-new (helm-stringify candidate) replace)) -(defun* helm-fast-remove-dups (seq &key (test 'eq)) +(cl-defun helm-fast-remove-dups (seq &key (test 'eq)) "Remove duplicates elements in list SEQ. This is same as `remove-duplicates' but with memoisation. It is much faster, especially in large lists. A test function can be provided with TEST argument key. Default is `eq'." - (loop with cont = (make-hash-table :test test) + (cl-loop with cont = (make-hash-table :test test) for elm in seq unless (gethash elm cont) do (puthash elm elm cont) finally return - (loop for i being the hash-values in cont collect i))) + (cl-loop for i being the hash-values in cont collect i))) ;;;###autoload (defun helm-quit-and-find-file () @@ -455,7 +455,7 @@ from its directory." '("SCCS" "RCS" "CVS" "MCVS" ".svn" ".git" ".hg" ".bzr" "_MTN" "_darcs" "{arch}")) -(defun* helm-walk-directory (directory &key path (directories t) match skip-subdirs) +(cl-defun helm-walk-directory (directory &key path (directories t) match skip-subdirs) "Walk through DIRECTORY tree. Argument PATH can be one of basename, relative, or full, default to basename. Argument DIRECTORIES when non--nil (default) return also directories names, @@ -465,7 +465,7 @@ Argument SKIP-SUBDIRS when non--nil will skip `helm-walk-ignore-directories' unless it is given as a list of directories, in this case this list will be used instead of `helm-walk-ignore-directories'." (let* (result - (fn (case path + (fn (cl-case path (basename 'file-name-nondirectory) (relative 'file-relative-name) (full 'identity) @@ -477,7 +477,7 @@ instead of `helm-walk-ignore-directories'." (if (listp skip-subdirs) skip-subdirs helm-walk-ignore-directories))) - (loop with ls = (directory-files + (cl-loop with ls = (directory-files dir t directory-files-no-dot-files-regexp) for f in ls if (file-directory-p f) @@ -511,10 +511,10 @@ that is sorting is done against real value of candidate." (cond ((string-match r1 str) 4) ((and (string-match " " helm-pattern) (string-match (concat "\\_<" (car lst)) str) - (loop for r in (cdr lst) + (cl-loop for r in (cdr lst) always (string-match r str))) 3) ((and (string-match " " helm-pattern) - (loop for r in lst always (string-match r str))) 2) + (cl-loop for r in lst always (string-match r str))) 2) ((string-match r2 str) 1) (t 0)))) (sc1 (funcall score str1 reg1 reg2 split)) @@ -559,16 +559,16 @@ KBSIZE if a floating point number, default value is 1024.0." (G (cons "G" (/ size (expt helm-default-kbsize 3)))) (K (cons "K" (/ size helm-default-kbsize))) (B (cons "B" size))) - (loop with result = B + (cl-loop with result = B for (a . b) in - (loop for (x . y) in (list M G K B) + (cl-loop for (x . y) in (list M G K B) unless (< y 1) collect (cons x y)) when (< b (cdr result)) do (setq result (cons a b)) finally return (if (string= (car result) "B") (format "%s" size) (format "%.1f%s" (cdr result) (car result)))))) -(defun* helm-file-attributes +(cl-defun helm-file-attributes (file &key type links uid gid access-time modif-time status size mode gid-change inode device-num dired human-size mode-type mode-owner mode-group mode-other (string t)) @@ -580,7 +580,7 @@ Availables keys are: - UID: See nth 2 `files-attributes'. - GID: See nth 3 `files-attributes'. - ACCESS-TIME: See nth 4 `files-attributes', however format time - when STRING is non--nil (the default). + when STRING is non--nil (cl-the default). - MODIF-TIME: See nth 5 `files-attributes', same as above. - STATUS: See nth 6 `files-attributes', same as above. - SIZE: See nth 7 `files-attributes'. @@ -598,7 +598,7 @@ If you want the same behavior as `files-attributes' , \(but with return values in proplist\) use a nil value for STRING. However when STRING is non--nil, time and type value are different from what you have in `file-attributes'." - (let* ((all (destructuring-bind + (let* ((all (cl-destructuring-bind (type links uid gid access-time modif-time status size mode gid-change inode device-num) (file-attributes file string) @@ -627,40 +627,40 @@ you have in `file-attributes'." :gid-change gid-change :inode inode :device-num device-num))) - (modes (helm-split-mode-file-attributes (getf all :mode)))) - (cond (type (getf all :type)) - (links (getf all :links)) - (uid (getf all :uid)) - (gid (getf all :gid)) - (access-time (getf all :access-time)) - (modif-time (getf all :modif-time)) - (status (getf all :status)) - (size (getf all :size)) - (mode (getf all :mode)) - (gid-change (getf all :gid-change)) - (inode (getf all :inode)) - (device-num (getf all :device-num)) + (modes (helm-split-mode-file-attributes (cl-getf all :mode)))) + (cond (type (cl-getf all :type)) + (links (cl-getf all :links)) + (uid (cl-getf all :uid)) + (gid (cl-getf all :gid)) + (access-time (cl-getf all :access-time)) + (modif-time (cl-getf all :modif-time)) + (status (cl-getf all :status)) + (size (cl-getf all :size)) + (mode (cl-getf all :mode)) + (gid-change (cl-getf all :gid-change)) + (inode (cl-getf all :inode)) + (device-num (cl-getf all :device-num)) (dired (concat - (helm-split-mode-file-attributes (getf all :mode) t) " " - (number-to-string (getf all :links)) " " - (getf all :uid) ":" - (getf all :gid) " " + (helm-split-mode-file-attributes (cl-getf all :mode) t) " " + (number-to-string (cl-getf all :links)) " " + (cl-getf all :uid) ":" + (cl-getf all :gid) " " (if human-size - (helm-file-human-size (getf all :size)) - (int-to-string (getf all :size))) " " - (getf all :modif-time))) - (human-size (helm-file-human-size (getf all :size))) - (mode-type (getf modes :mode-type)) - (mode-owner (getf modes :user)) - (mode-group (getf modes :group)) - (mode-other (getf modes :other)) + (helm-file-human-size (cl-getf all :size)) + (int-to-string (cl-getf all :size))) " " + (cl-getf all :modif-time))) + (human-size (helm-file-human-size (cl-getf all :size))) + (mode-type (cl-getf modes :mode-type)) + (mode-owner (cl-getf modes :user)) + (mode-group (cl-getf modes :group)) + (mode-other (cl-getf modes :other)) (t (append all modes))))) (defun helm-split-mode-file-attributes (str &optional string) "Split mode file attributes STR into a proplist. If STRING is non--nil return instead a space separated string." - (loop with type = (substring str 0 1) + (cl-loop with type = (substring str 0 1) with cdr = (substring str 1) for i across cdr for count from 1 @@ -760,7 +760,7 @@ directory, open this directory." 'find-file-other-window 'find-file))))) -(defun* helm-action-file-line-goto (file-line-content +(cl-defun helm-action-file-line-goto (file-line-content &optional (find-file-function #'find-file)) (apply #'helm-goto-file-line @@ -795,7 +795,7 @@ directory, open this directory." (buffer-local-value 'default-directory (helm-candidate-buffer)))))))))) -(defun* helm-goto-file-line (lineno &optional content file (find-file-function #'find-file)) +(cl-defun helm-goto-file-line (lineno &optional content file (find-file-function #'find-file)) (helm-aif (helm-attr 'before-jump-hook) (funcall it)) (when file (funcall find-file-function file)) diff --git a/helm-w3m.el b/helm-w3m.el index 9e4eff23..8e9f11a0 100644 --- a/helm-w3m.el +++ b/helm-w3m.el @@ -92,7 +92,7 @@ http://emacs-w3m.namazu.org/") (funcall fn (helm-w3m-bookmarks-get-value elm) arg))) (defun helm-highlight-w3m-bookmarks (bookmarks source) - (loop for i in bookmarks + (cl-loop for i in bookmarks collect (propertize i 'face 'helm-w3m-bookmarks 'help-echo (helm-w3m-bookmarks-get-value i)))) diff --git a/helm-yaoddmuse.el b/helm-yaoddmuse.el index c3bc70f6..c4e28b2f 100644 --- a/helm-yaoddmuse.el +++ b/helm-yaoddmuse.el @@ -30,7 +30,7 @@ (defvar helm-yaoddmuse-ew-cache nil) (defun helm-yaoddmuse-get-candidates () - (declare (special yaoddmuse-pages-hash)) + (cl-declare (special yaoddmuse-pages-hash)) (if helm-yaoddmuse-use-cache-file (ignore-errors (unless helm-yaoddmuse-ew-cache @@ -114,13 +114,13 @@ http://www.emacswiki.org/emacs/download/yaoddmuse.el") "Fetch the list of files on emacswiki and create cache file. If load is non--nil load the file and feed `yaoddmuse-pages-hash'." (interactive) - (declare (special yaoddmuse-pages-hash)) + (cl-declare (special yaoddmuse-pages-hash)) (yaoddmuse-update-pagename) (save-excursion (find-file helm-yaoddmuse-cache-file) (erase-buffer) (insert "(puthash \"EmacsWiki\" '(") - (loop for i in (gethash "EmacsWiki" yaoddmuse-pages-hash) + (cl-loop for i in (gethash "EmacsWiki" yaoddmuse-pages-hash) do (insert (concat "(\"" (car i) "\") "))) (insert ") yaoddmuse-pages-hash)\n") @@ -136,7 +136,7 @@ If load is non--nil load the file and feed `yaoddmuse-pages-hash'." (library-list (yaoddmuse-get-library-list))) (with-current-buffer helm-buffer ;; Insert library name. - (dolist (library library-list) + (cl-dolist (library library-list) (insert (format "%s\n" library))) ;; Sort lines. (sort-lines nil (point-min) (point-max))))) @@ -59,7 +59,7 @@ More than 2 seconds, next hit will run again the first function and so on." "Define NAME as a multi-key command running FUNS. After DELAY seconds the FUNS list is reinitialised. See `helm-define-multi-key'." - (declare (indent 2)) + (cl-declare (indent 2)) (setq docstring (if docstring (concat docstring "\n\n") "This is a helmish multi-key command.")) `(defalias (quote ,name) (helm-make-multi-command ,funs ,delay) ,docstring)) @@ -67,16 +67,16 @@ See `helm-define-multi-key'." (defun helm-make-multi-command (functions &optional delay) "Return an anonymous multi-key command running FUNCTIONS. Run each function of FUNCTIONS list in turn when called within DELAY seconds." - (declare (indent 1)) + (cl-declare (indent 1)) (lexical-let ((funs functions) - (iter (gensym "helm-iter-key")) + (iter (cl-gensym "helm-iter-key")) (timeout delay)) (eval (list 'defvar iter nil)) #'(lambda () (interactive) (helm-run-multi-key-command funs iter timeout)))) (defun helm-run-multi-key-command (functions iterator delay) (let ((fn #'(lambda () - (loop for count from 1 to (length functions) + (cl-loop for count from 1 to (length functions) collect count))) next) (unless (and (symbol-value iterator) @@ -114,7 +114,7 @@ second call within 0.5s run `helm-swap-windows'." ;; ;; (defvar helm-map - (let ((map (make-sparse-keymap))) + (let ((cl-map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-map) (define-key map (kbd "<down>") 'helm-next-line) (define-key map (kbd "<up>") 'helm-previous-line) @@ -183,7 +183,7 @@ second call within 0.5s run `helm-swap-windows'." (define-key map [f1] nil) ; Allow to eval keymap without errors. (define-key map (kbd "C-h C-h") 'undefined) (define-key map (kbd "C-h h") 'undefined) - (dolist (k (where-is-internal 'describe-mode global-map)) + (cl-dolist (k (where-is-internal 'describe-mode global-map)) (define-key map k 'helm-help)) map) "Keymap for helm.") @@ -714,7 +714,7 @@ Use optional arguments ARGS like in `format'." (defun helm-log-eval-internal (exprs) "Eval EXPRS and write results to helm log buffer." - (dolist (expr exprs) + (cl-dolist (expr exprs) (condition-case err ;; Don't eval expression EXPR ;; when debugging is not turned on. @@ -725,9 +725,9 @@ Use optional arguments ARGS like in `format'." (defun helm-log-get-current-function () "Get function name calling `helm-log'. The original idea is from `tramp-debug-message'." - (loop with exclude-func-re = "^helm-\\(?:interpret\\|log\\|.*funcall\\)" + (cl-loop with exclude-func-re = "^helm-\\(?:interpret\\|log\\|.*funcall\\)" for btn from 1 to 40 - for btf = (second (backtrace-frame btn)) + for btf = (cl-second (backtrace-frame btn)) for fn = (if (symbolp btf) (symbol-name btf) "") if (and (string-match "^helm" fn) (not (string-match exclude-func-re fn))) @@ -797,7 +797,7 @@ If `helm-last-log-file' is nil, switch to `helm-debug-buffer' ." (defmacro helm-aif (test-form then-form &rest else-forms) "Like `if' but set the result of TEST-FORM in a temprary variable called `it'. THEN-FORM and ELSE-FORMS are then excuted just like in `if'." - (declare (indent 2) (debug t)) + (cl-declare (indent 2) (debug t)) `(let ((it ,test-form)) (if it ,then-form ,@else-forms))) @@ -812,11 +812,11 @@ Otherwise make a list with one element." "Return the actual command in action. Like `this-command' but return the real command, not `exit-minibuffer' or unwanted functions." - (loop with bl = '(helm-exit-minibuffer + (cl-loop with bl = '(helm-exit-minibuffer exit-minibuffer) for count from 1 to 50 for btf = (backtrace-frame count) - for fn = (second btf) + for fn = (cl-second btf) if (and (commandp fn) (not (memq fn bl))) return fn else if (and (eq fn 'call-interactively) @@ -842,13 +842,13 @@ not `exit-minibuffer' or unwanted functions." (defmacro with-helm-window (&rest body) "Be sure BODY is excuted in the helm window." - (declare (indent 0) (debug t)) + (cl-declare (indent 0) (debug t)) `(with-selected-window (helm-window) ,@body)) (defmacro with-helm-current-buffer (&rest body) "Eval BODY inside `helm-current-buffer'." - (declare (indent 0) (debug t)) + (cl-declare (indent 0) (debug t)) `(with-current-buffer (or (and (buffer-live-p helm-current-buffer) helm-current-buffer) (setq helm-current-buffer @@ -857,23 +857,23 @@ not `exit-minibuffer' or unwanted functions." (defmacro with-helm-buffer (&rest body) "Eval BODY inside `helm-buffer'." - (declare (indent 0) (debug t)) + (cl-declare (indent 0) (debug t)) `(with-current-buffer (helm-buffer-get) ,@body)) (defmacro with-helm-restore-variables(&rest body) "Restore `helm-restored-variables' after executing BODY." - (declare (indent 0) (debug t)) + (cl-declare (indent 0) (debug t)) `(let ((orig-vars (mapcar (lambda (v) (cons v (symbol-value v))) helm-restored-variables))) (unwind-protect (progn ,@body) - (loop for (var . value) in orig-vars + (cl-loop for (var . value) in orig-vars do (set var value)) (helm-log "restore variables")))) (defmacro with-helm-default-directory (directory &rest body) - (declare (indent 2) (debug t)) + (cl-declare (indent 2) (debug t)) `(let ((default-directory (or (and ,directory (file-name-as-directory ,directory)) default-directory))) @@ -885,8 +885,8 @@ not `exit-minibuffer' or unwanted functions." (defmacro with-helm-temp-hook (hook &rest body) "Execute temporarily BODY as a function for HOOK." - (declare (indent 1) (debug t)) - (let ((fun (gensym "helm-hook"))) + (cl-declare (indent 1) (debug t)) + (let ((fun (cl-gensym "helm-hook"))) `(progn (defun ,fun () (unwind-protect @@ -896,10 +896,10 @@ not `exit-minibuffer' or unwanted functions." (defmacro with-helm-after-update-hook (&rest body) "Execute BODY at end of `helm-update'." - (declare (indent 0) (debug t)) + (cl-declare (indent 0) (debug t)) `(with-helm-temp-hook 'helm-after-update-hook ,@body)) -(defun* helm-attr (attribute-name +(cl-defun helm-attr (attribute-name &optional (src (helm-get-current-source)) compute) "Get the value of ATTRIBUTE-NAME of SRC. If SRC is omitted, use current source. @@ -909,13 +909,13 @@ with `helm-interpret-value'." (helm-get-attribute-from-source-type attribute-name src)) (if compute (helm-interpret-value (cdr it)) (cdr it)))) -(defun* helm-attr-defined (attribute-name +(cl-defun helm-attr-defined (attribute-name &optional (src (helm-get-current-source))) "Return non-nil if ATTRIBUTE-NAME of SRC is defined. if SRC is omitted, use current source." (and (helm-attr attribute-name src) t)) -(defun* helm-attrset (attribute-name value +(cl-defun helm-attrset (attribute-name value &optional (src (helm-get-current-source)) alter-type) @@ -962,7 +962,7 @@ arg TYPE is an existing type defined in `helm-type-attributes'." "Append ELM at INDEX in SEQ." (let ((len (length seq))) (when (> index len) (setq index len)) - (loop for i in seq + (cl-loop for i in seq for count from 1 collect i when (= count index) if (listp elm) append elm @@ -997,7 +997,7 @@ associated to name." (assoc action-or-name actions)))) (helm-attrset 'action (delete del-action actions) source))) -(defun* helm-add-action-to-source-if (name fn source predicate +(cl-defun helm-add-action-to-source-if (name fn source predicate &optional (index 4) test-only) "Add new action NAME linked to function FN to SOURCE. Action is added only if current candidate match PREDICATE. @@ -1068,7 +1068,7 @@ Shift+A shows all results: The -my- part is added to avoid collisions with existing Helm function names." (unless (and (listp sources) - (loop for name in sources always (stringp name))) + (cl-loop for name in sources always (stringp name))) (error "Invalid data in `helm-set-source-filter': %S" sources)) (let ((cur-disp-sel (with-current-buffer helm-buffer (helm-get-selection nil t)))) @@ -1111,7 +1111,7 @@ Attributes: helm-sources helm-compile-source-functions)) (helm-log-eval helm-compiled-sources))))) -(defun* helm-get-selection (&optional (buffer nil buffer-s) +(cl-defun helm-get-selection (&optional (buffer nil buffer-s) force-display-part) "Return the currently selected item or nil. if BUFFER is nil or unspecified, use helm-buffer as default value. @@ -1159,7 +1159,7 @@ of \(action-display . function\)." (defun helm-get-current-source () "Return the source for the current selection. Allow also checking if helm-buffer contain candidates." - (declare (special source)) + (cl-declare (special source)) ;; `helm-source-name' let-bounded in some function with value of source. ;; Return source from this function. (e.g `helm-funcall-with-source'). (if (and (boundp 'helm-source-name) @@ -1171,7 +1171,7 @@ Allow also checking if helm-buffer contain candidates." ;; is non--nil and there is candidates in buffer. (get-text-property (point) 'helm-source) ;; Return nil when no--candidates. - (block exit + (cl-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 helm-selection-overlay)) @@ -1180,10 +1180,10 @@ Allow also checking if helm-buffer contain candidates." (source-name (save-excursion (unless header-pos - (return-from exit nil)) + (cl-return-from exit nil)) (goto-char header-pos) (helm-current-line-contents)))) - (loop for source in (helm-get-sources) thereis + (cl-loop for source in (helm-get-sources) thereis (and (equal (assoc-default 'name source) source-name) source)))))))) @@ -1217,7 +1217,7 @@ The action is to call FUNCTION with arguments ARGS." DOC is displayed in `helm-type-attributes' docstring. Use this function is better than setting `helm-type-attributes' directly." - (loop for i in definition do + (cl-loop for i in definition do ;; without `ignore-errors', error at emacs22 (ignore-errors (setf i (delete nil i)))) (helm-add-type-attribute type definition) @@ -1260,7 +1260,7 @@ Otherwise, return VALUE itself." ;; Core: API helper -(defun* helm-empty-buffer-p (&optional (buffer helm-buffer)) +(cl-defun helm-empty-buffer-p (&optional (buffer helm-buffer)) "Check if BUFFER have candidates. Default value for BUFFER is `helm-buffer'." (zerop (buffer-size (and buffer (get-buffer buffer))))) @@ -1304,13 +1304,13 @@ Return the result of last function call." (let ((helm-source-name (assoc-default 'name source)) (funs (if (functionp functions) (list functions) functions))) (helm-log-eval helm-source-name functions args) - (loop with result for fn in funs + (cl-loop with result for fn in funs do (setq result (apply fn args)) finally return result))) (defun helm-funcall-foreach (sym &optional sources) "Call the function SYM for each source if any." (let ((sources (or sources (helm-get-sources)))) - (dolist (source sources) + (cl-dolist (source sources) (helm-aif (assoc-default sym source) (helm-funcall-with-source source it))))) @@ -1339,26 +1339,26 @@ in the source where point is." (let ((count-multi 1)) (if (helm-pos-multiline-p) (save-excursion - (loop while (and (not (if in-current-source + (cl-loop while (and (not (if in-current-source (save-excursion (forward-line 2) (or (helm-pos-header-line-p) (eobp))) (eobp))) (search-forward helm-candidate-separator nil t)) - do (incf count-multi) + do (cl-incf count-multi) finally return count-multi)) (save-excursion - (loop with ln = 0 + (cl-loop with ln = 0 while (not (if in-current-source (or (helm-pos-header-line-p) (eobp)) (eobp))) unless (helm-pos-header-line-p) - do (incf ln) + do (cl-incf ln) do (forward-line 1) finally return ln)))))))) (defmacro with-helm-quittable (&rest body) "If an error occur in execution of BODY, quit helm safely." - (declare (indent 0) (debug t)) + (cl-declare (indent 0) (debug t)) `(let (inhibit-quit) (condition-case v (progn ,@body) @@ -1380,21 +1380,21 @@ filtered-candidate-transformer: \(helm-compose '((1 2 3 4 5 6 7) '((name . \"An helm source\") (candidates . (a b c)))) '((lambda (candidates _source) - (loop for i in candidates - when (oddp i) collect i)) + (cl-loop for i in candidates + when (cl-oddp i) collect i)) (lambda (candidates _source) - (loop for i in candidates collect (1+ i))))) + (cl-loop for i in candidates collect (1+ i))))) =>(2 4 6 8) candidate-transformer: \(helm-compose '((1 2 3 4 5 6 7)) '((lambda (candidates) - (loop for i in candidates - when (oddp i) collect i)) + (cl-loop for i in candidates + when (cl-oddp i) collect i)) (lambda (candidates) - (loop for i in candidates collect (1+ i))))) + (cl-loop for i in candidates collect (1+ i))))) => (2 4 6 8)." - (dolist (func func-lst) + (cl-dolist (func func-lst) (setcar arg-lst (apply func arg-lst))) (car arg-lst)) @@ -1553,7 +1553,7 @@ in source." ;; :buffer "toto" ;; :candidate-number-limit 4)) ;; ==> ((helm-candidate-number-limit . 4)) - (loop for (key value) on keys by #'cddr + (cl-loop for (key value) on keys by #'cddr for symname = (substring (symbol-name key) 1) for sym = (intern (if (string-match "^helm-" symname) symname @@ -1581,7 +1581,7 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'." (non-essential t) (helm-maybe-use-default-as-input (or helm-maybe-use-default-as-input ; it is let-bounded so use it. - (loop for s in (helm-normalize-sources any-sources) + (cl-loop for s in (helm-normalize-sources any-sources) thereis (memq s helm-sources-using-default-as-input))))) (unwind-protect (condition-case v @@ -1636,7 +1636,7 @@ Called from lisp, you can specify a buffer-name as a string with ARG." (setq any-buffer arg) (setq any-buffer (helm-resume-select-buffer))) (setq any-buffer helm-last-buffer)) - (assert any-buffer nil + (cl-assert any-buffer nil "helm-resume: No helm buffers found to resume") ;; Reset `cursor-type' to nil as it have been set to t ;; when quitting previous session. @@ -1709,7 +1709,7 @@ Call `helm' with only ANY-SOURCES and ANY-BUFFER as args." (let (helm-current-position helm-current-buffer helm-pattern - (helm-buffer (or (getf same-as-helm :buffer) + (helm-buffer (or (cl-getf same-as-helm :buffer) (nth 5 same-as-helm) "*Helm*")) helm-sources @@ -1734,7 +1734,7 @@ Call `helm' with only ANY-SOURCES and ANY-BUFFER as args." (defun helm-current-position (save-or-restore) "Restore or save current position in `helm-current-buffer'. Argument SAVE-OR-RESTORE is one of save or restore." - (case save-or-restore + (cl-case save-or-restore (save (helm-log "Save position at %S" (cons (point) (window-start))) (setq helm-current-position (cons (point) (window-start)))) @@ -1756,7 +1756,7 @@ window or frame configuration is saved/restored according to values of (helm-log-eval helm-save-configuration-functions) (let ((window-persistent-parameters (append '((no-other-window . t)) window-persistent-parameters))) - (case save-or-restore + (cl-case save-or-restore (save (setq helm-last-frame-or-window-configuration (funcall (cdr helm-save-configuration-functions)))) (restore (funcall (car helm-save-configuration-functions) @@ -1764,7 +1764,7 @@ window or frame configuration is saved/restored according to values of ;; Restore frame focus. (let ((frame (and (listp helm-last-frame-or-window-configuration) - (caadr helm-last-frame-or-window-configuration)))) + (cl-caadr helm-last-frame-or-window-configuration)))) ;; If `helm-save-configuration-functions' are window functions ;; frame should be nil, use current frame. (unless (framep frame) @@ -1787,7 +1787,7 @@ window or frame configuration is saved/restored according to values of (split-window (selected-window) nil helm-split-window-default-side) ;; If more than one window reuse one of them. - (case helm-split-window-default-side + (cl-case helm-split-window-default-side (left (or (helm-window-in-direction 'left) (helm-window-in-direction 'above) (selected-window))) @@ -1833,7 +1833,7 @@ The function used to display `helm-buffer'." (when helm-prevent-escaping-from-minibuffer (helm-prevent-switching-other-window))))) -(defun* helm-prevent-switching-other-window (&key (enabled t)) +(cl-defun helm-prevent-switching-other-window (&key (enabled t)) "Allow setting `no-other-window' window parameter in all windows. Arg ENABLE-OR-DISABLE will be the value of `no-other-window'." (walk-windows @@ -1931,7 +1931,7 @@ For ANY-RESUME ANY-INPUT ANY-DEFAULT and ANY-SOURCES See `helm'." ;; Call the init function for sources where appropriate (helm-funcall-foreach 'init (and helm-source-filter - (remove-if-not #'(lambda (s) + (cl-remove-if-not #'(lambda (s) (member (assoc-default 'name s) helm-source-filter)) (helm-get-sources)))) @@ -1968,7 +1968,7 @@ For ANY-RESUME ANY-INPUT ANY-DEFAULT and ANY-SOURCES See `helm'." (set (make-local-variable 'helm-marked-candidates) nil) (helm-initialize-persistent-action) (helm-log-eval helm-display-function helm-let-variables) - (loop for (var . val) in helm-let-variables + (cl-loop for (var . val) in helm-let-variables do (set (make-local-variable var) val)) (setq truncate-lines helm-truncate-lines) ; already local. (setq cursor-type nil) @@ -2184,10 +2184,10 @@ See `helm-compile-source-functions'. Helm plug-ins are realized by this function." (mapcar (lambda (source) - (loop with src = (if (listp source) source (symbol-value source)) + (cl-loop with src = (if (listp source) source (symbol-value source)) for f in funcs do (setq src (funcall f src)) - finally (return src))) + finally (cl-return src))) sources)) @@ -2199,7 +2199,7 @@ Helm plug-ins are realized by this function." (helm-aif (assoc-default 'delayed-init source) (with-current-buffer helm-current-buffer (helm-funcall-with-source source it) - (dolist (f (if (functionp it) (list it) it)) + (cl-dolist (f (if (functionp it) (list it) it)) (add-to-list 'helm-delayed-init-executed name))))))) (defun helm-get-candidates (source) @@ -2245,7 +2245,7 @@ Helm plug-ins are realized by this function." (defmacro helm-while-no-input (&rest body) "Same as `while-no-input' but without testing with `input-pending-p'." - (declare (debug t) (indent 0)) + (cl-declare (debug t) (indent 0)) (let ((catch-sym (make-symbol "input"))) `(with-local-quit (catch ',catch-sym @@ -2285,7 +2285,7 @@ ARGS is (cand1 cand2 ...) or ((disp1 . real1) (disp2 . real2) ...) \(helm-transform-mapcar 'upcase '((\"1st\" . \"foo\") (\"2nd\" . \"bar\"))) => ((\"1st\" . \"FOO\") (\"2nd\" . \"BAR\")) " - (loop for arg in args + (cl-loop for arg in args if (consp arg) collect (cons (car arg) (funcall function (cdr arg))) else @@ -2381,15 +2381,15 @@ if ITEM-COUNT reaches LIMIT, exit from inner loop." `(unless (gethash ,cand ,hash) (puthash ,cand t ,hash) (push ,cand ,newmatches) - (incf ,item-count) - (when (= ,item-count ,limit) (return)))) + (cl-incf ,item-count) + (when (= ,item-count ,limit) (cl-return)))) (defun helm-take-first-elements (seq n) "Return the N first element of SEQ if SEQ is longer than N. It is used to narrow down list of candidates to `helm-candidate-number-limit'." - (if (> (length seq) n) (subseq seq 0 n) seq)) + (if (> (length seq) n) (cl-subseq seq 0 n) seq)) -(defun* helm-set-case-fold-search (&optional (pattern helm-pattern)) +(cl-defun helm-set-case-fold-search (&optional (pattern helm-pattern)) "Used to set the value of `case-fold-search' in helm. Return t or nil depending of value of `helm-case-fold-search' and `helm-pattern'." @@ -2409,7 +2409,7 @@ and `helm-pattern'." (helm-set-case-fold-search-1 bn-or-pattern))) (defun helm-set-case-fold-search-1 (pattern) - (case helm-case-fold-search + (cl-case helm-case-fold-search (smart (let ((case-fold-search nil)) (if (string-match "[A-Z]" pattern) nil t))) (t helm-case-fold-search))) @@ -2421,16 +2421,16 @@ and `helm-pattern'." (case-fold-search (helm-set-case-fold-search)) exit) (clrhash helm-match-hash) - (dolist (match matchfns) + (cl-dolist (match matchfns) (let (newmatches) - (dolist (candidate cands) + (cl-dolist (candidate cands) (when (funcall match (helm-candidate-get-display candidate)) (helm-accumulate-candidates-internal candidate newmatches helm-match-hash item-count limit))) (setq matches (append matches (reverse newmatches))) ;; Don't recompute matches already found by this match function ;; with the next match function. - (setq cands (loop for i in cands + (setq cands (cl-loop for i in cands unless (member i matches) collect i))))) (invalid-regexp (setq matches nil)) (error (helm-log-error "helm-match-from-candidates in source `%s': %s %s" @@ -2471,7 +2471,7 @@ and `helm-pattern'." (helm-insert-match m 'insert source)) matches) (let ((start (point)) separate) - (dolist (match matches) + (cl-dolist (match matches) (if separate (helm-insert-candidate-separator) (setq separate t)) @@ -2527,7 +2527,7 @@ is done on whole `helm-buffer' and not on current source." (let (delayed-sources normal-sources) (unwind-protect ; Process normal sources and store delayed one's. - (loop for source in (remove-if-not 'helm-update-source-p + (cl-loop for source in (cl-remove-if-not 'helm-update-source-p (helm-get-sources)) if (helm-delayed-source-p source) collect source into ds @@ -2555,8 +2555,8 @@ is done on whole `helm-buffer' and not on current source." (setq helm-force-updating-p nil))) (when delayed-sources ;; Allow giving a value to `delayed' attr from inside source. - ;; Retain the biggest value (the slower) found in DELAYED-SOURCES. - (let ((helm-idle-delay (loop with delay = helm-idle-delay + ;; Retain the biggest value (cl-the slower) found in DELAYED-SOURCES. + (let ((helm-idle-delay (cl-loop with delay = helm-idle-delay for s in delayed-sources for d = (assoc-default 'delayed s) when d do (setq delay (max delay d)) @@ -2629,7 +2629,7 @@ if specified." (helm-aif (helm-funcall-with-source source 'helm-candidate-buffer) (kill-buffer it)) - (dolist (attr '(update init)) + (cl-dolist (attr '(update init)) (helm-aif (assoc-default attr source) (helm-funcall-with-source source it))) (helm-remove-candidate-cache source)) @@ -2721,7 +2721,7 @@ after the source name by overlay." (helm-output-filter--post-process))) (defun helm-output-filter--process-source (process output-string source limit) - (dolist (candidate (helm-transform-candidates + (cl-dolist (candidate (helm-transform-candidates (helm-output-filter--collect-candidates (split-string output-string "\n") (assoc 'incomplete-line source)) @@ -2732,10 +2732,10 @@ after the source name by overlay." (helm-insert-match candidate 'insert-before-markers source) (put-text-property start (point) 'helm-multiline t)) (helm-insert-match candidate 'insert-before-markers source)) - (incf (cdr (assoc 'item-count source))) + (cl-incf (cdr (assoc 'item-count source))) (when (>= (assoc-default 'item-count source) limit) (helm-kill-async-process process) - (return)))) + (cl-return)))) (defun helm-output-filter--collect-candidates (lines incomplete-line-info) "Collect lines in LINES maybe completing the truncated first and last lines." @@ -2747,7 +2747,7 @@ after the source name by overlay." ;; with an empty string when the source is computed => (incomplete-line . "") (helm-log-eval (cdr incomplete-line-info)) (butlast ; The last line is the incomplete line, remove it. - (loop for line in lines collect + (cl-loop for line in lines collect (if (cdr incomplete-line-info) ; On start it is an empty string. (prog1 (concat (cdr incomplete-line-info) line) @@ -2898,7 +2898,7 @@ If action buffer is selected, back to the helm buffer." (candidates . ,actions) (candidate-transformer . (lambda (candidates) - (loop for (i . j) in candidates + (cl-loop for (i . j) in candidates collect (cons (propertize i 'face 'helm-action) j)))) (candidate-number-limit)))) @@ -2977,7 +2977,7 @@ it is \"Candidate\(s\)\" by default." (or name "Candidate(s)")) 'face 'helm-candidate-number))) -(defun* helm-move-selection-common (&key where direction) +(cl-defun helm-move-selection-common (&key where direction) "Move the selection marker to a new position. Position is determined by WHERE and DIRECTION. Key arg WHERE can be one of: @@ -2989,17 +2989,17 @@ Key arg DIRECTION can be one of: - previous - next - A source or a source name when used with :WHERE 'source." - (let ((move-func (case where - (line (ecase direction + (let ((move-func (cl-case where + (line (cl-ecase direction (previous 'helm-move--previous-line-fn) (next 'helm-move--next-line-fn))) - (page (ecase direction + (page (cl-ecase direction (previous 'helm-move--previous-page-fn) (next 'helm-move--next-page-fn))) - (edge (ecase direction + (edge (cl-ecase direction (previous 'helm-move--beginning-of-buffer-fn) (next 'helm-move--end-of-buffer-fn))) - (source (case direction + (source (cl-case direction (previous 'helm-move--previous-source-fn) (next 'helm-move--next-source-fn) (t (lambda () ; A source is passed as DIRECTION arg. @@ -3250,7 +3250,7 @@ If action buffer is displayed, kill it." (message "Calculating all helm-related values...") (insert "If you debug some variables or forms, set `helm-debug-variables' to a list of forms.\n\n") - (dolist (v (or vars + (cl-dolist (v (or vars helm-debug-variables (apropos-internal "^helm-" 'boundp))) (insert "** " @@ -3262,7 +3262,7 @@ to a list of forms.\n\n") ;; Core: misc (defun helm-kill-buffer-hook () "Remove tick entry from `helm-tick-hash' when killing a buffer." - (loop for key being the hash-keys in helm-tick-hash + (cl-loop for key being the hash-keys in helm-tick-hash if (string-match (format "^%s/" (regexp-quote (buffer-name))) key) do (remhash key helm-tick-hash))) (add-hook 'kill-buffer-hook 'helm-kill-buffer-hook) @@ -3333,7 +3333,7 @@ to a list of forms.\n\n") (defmacro helm-edit-current-selection (&rest forms) "Evaluate FORMS at current selection in the helm buffer. Used generally to modify current selection." - (declare (indent 0) (debug t)) + (cl-declare (indent 0) (debug t)) `(helm-edit-current-selection-internal (lambda () ,@forms))) @@ -3423,7 +3423,7 @@ eg. '((name . \"many files\") (init . (lambda () (with-current-buffer (helm-candidate-buffer 'local) (insert-many-filenames)))) - (search re-search-forward) ; optional + (cl-search re-search-forward) ; optional (candidates-in-buffer) (type . file)) @@ -3477,7 +3477,7 @@ a specific part of candidate. To customize `helm-candidates-in-buffer' behavior, use search, get-line, match-part and search-from-end attributes. See also `helm-sources' docstring." - (declare (special source)) + (cl-declare (special source)) (helm-candidates-in-buffer-1 (helm-candidate-buffer) helm-pattern @@ -3507,7 +3507,7 @@ See also `helm-sources' docstring." (when buffer (with-current-buffer buffer (let ((start-point (if search-from-end (point-max) (point-min))) - (endp (if search-from-end #'bobp #'eobp)) + (cl-endp (if search-from-end #'bobp #'eobp)) (inhibit-point-motion-hooks t)) (goto-char (1- start-point)) (if (string= pattern "") @@ -3532,10 +3532,10 @@ See also `helm-sources' docstring." (helm-search-from-candidate-buffer-internal (lambda () (clrhash helm-cib-hash) - (dolist (searcher search-fns) + (cl-dolist (searcher search-fns) (goto-char start-point) (setq newmatches nil) - (loop with item-count = 0 + (cl-loop with item-count = 0 while (funcall searcher pattern) for cand = (funcall get-line-fn (point-at-bol) (point-at-eol)) when (or @@ -3560,14 +3560,14 @@ See also `helm-sources' docstring." "Match PATTERN only on part of CANDIDATE returned by MATCH-PART-FN." (let ((part (funcall match-part-fn candidate))) (if (string-match " " pattern) - (loop for i in (split-string pattern " " t) + (cl-loop for i in (split-string pattern " " t) always (string-match i part)) (string-match pattern part)))) -(defun helm-initial-candidates-from-candidate-buffer (endp +(defun helm-initial-candidates-from-candidate-buffer (cl-endp get-line-fn limit search-from-end) - (delq nil (loop with next-line-fn = + (delq nil (cl-loop with next-line-fn = (if search-from-end (lambda (x) (goto-char (max (1- (point-at-bol)) 1))) #'forward-line) @@ -3618,7 +3618,7 @@ Acceptable values of CREATE-OR-BUFFER: helm-candidate-buffer-alist) helm-candidate-buffer-alist))))) (kill-buffers-func #'(lambda () - (loop for b in (buffer-list) + (cl-loop for b in (buffer-list) if (string-match (format "^%s" (regexp-quote global-bname)) (buffer-name b)) do (kill-buffer b)))) @@ -3656,7 +3656,7 @@ Arg DATA can be either a list or a plain string." (with-current-buffer buf (erase-buffer) (if (listp data) - (loop for i in data do (insert (concat i "\n"))) + (cl-loop for i in data do (insert (concat i "\n"))) (and (stringp data) (insert data))))) buffer) @@ -3773,7 +3773,7 @@ If N is positive enlarge, if negative narrow." "Return the position of `helm-window' from `helm-current-buffer'. Possible values are 'left 'right 'below or 'above." (let ((side-list '(left right below above))) - (loop for side in side-list + (cl-loop for side in side-list thereis (and (equal (helm-window) (window-in-direction side (get-buffer-window helm-current-buffer t) @@ -3838,7 +3838,7 @@ Otherwise goto the end of minibuffer." (defmacro with-helm-display-same-window (&rest body) "Execute BODY in the window used for persistent action. Make `pop-to-buffer' and `display-buffer' display in the same window." - (declare (indent 0) (debug t)) + (cl-declare (indent 0) (debug t)) `(let ((display-buffer-function 'helm-persistent-action-display-buffer)) ,@body)) @@ -3846,7 +3846,7 @@ Make `pop-to-buffer' and `display-buffer' display in the same window." (set (make-local-variable 'helm-persistent-action-display-window) nil)) ;;;###autoload -(defun* helm-execute-persistent-action +(cl-defun helm-execute-persistent-action (&optional (attr 'persistent-action) split-onewindow) "Perform the associated action ATTR without quitting helm. ATTR default is 'persistent-action', but it can be anything else. @@ -3935,7 +3935,7 @@ Argument ACTION if present will be used as second argument of `display-buffer'." (or (member name (mapcar (lambda (x) (or (car-safe x) x)) special-display-buffer-names)) - (loop for x in special-display-regexps + (cl-loop for x in special-display-regexps thereis (string-match (or (car-safe x) x) name)))) '(".")))) @@ -3993,7 +3993,7 @@ Argument ACTION if present will be used as second argument of `display-buffer'." (set (make-local-variable 'helm-visible-mark-overlays) nil))) (defun helm-this-visible-mark () - (loop for o in helm-visible-mark-overlays + (cl-loop for o in helm-visible-mark-overlays when (equal (point-at-bol) (overlay-start o)) return o)) @@ -4103,7 +4103,7 @@ Only useful for debugging." (helm-run-after-quit (lambda () (with-output-to-temp-buffer "*helm visible marks*" - (dolist (o overlays) (princ (overlay-get o 'string))))))))) + (cl-dolist (o overlays) (princ (overlay-get o 'string))))))))) (defun helm-marked-candidates () "Return marked candidates of current source if any. @@ -4113,7 +4113,7 @@ It is analogous to `dired-get-marked-files'." (with-current-buffer (helm-buffer-get) (let ((cands (if helm-marked-candidates - (loop with current-src = (helm-get-current-source) + (cl-loop with current-src = (helm-get-current-source) for (source . real) in (reverse helm-marked-candidates) when (equal current-src source) collect (helm-coerce-selection real source)) @@ -4129,7 +4129,7 @@ It is analogous to `dired-get-marked-files'." (defun helm-revive-visible-mark () "Restore marked candidates when helm update display." (with-current-buffer helm-buffer - (dolist (o helm-visible-mark-overlays) + (cl-dolist (o helm-visible-mark-overlays) (goto-char (point-min)) (while (and (search-forward (overlay-get o 'string) nil t) (helm-current-source-name= (overlay-get o 'source))) @@ -4156,10 +4156,10 @@ It is analogous to `dired-get-marked-files'." (nth 0 points)) (t (nth (if prev - (loop for pt in points + (cl-loop for pt in points for i from 0 if (<= curpos pt) return (1- i)) - (loop for pt in points + (cl-loop for pt in points for i from 0 if (< curpos pt) return i)) points)))) @@ -4233,7 +4233,7 @@ This will enable `helm-follow-mode' automatically in `helm-source-buffers-list'. (with-current-buffer helm-buffer (let* ((src (helm-get-current-source)) (name (assoc-default 'name src)) - (sym (loop for s in helm-sources + (sym (cl-loop for s in helm-sources for sname = (and (symbolp s) (assoc-default 'name (symbol-value s))) |