From e6c3ff112066f64777407256518e7ebb590a03c9 Mon Sep 17 00:00:00 2001 From: Thierry Volpiatto Date: Fri, 25 Apr 2014 11:40:04 +0200 Subject: [PATCH] Reindent all files again. * helm-elisp-package.el: Use with instead of let. --- helm-adaptative.el | 16 +- helm-aliases.el | 28 +- helm-apt.el | 46 +-- helm-bbdb.el | 74 ++--- helm-bookmark.el | 208 ++++++------- helm-buffers.el | 252 ++++++++-------- helm-command.el | 96 +++--- helm-config.el | 8 +- helm-dabbrev.el | 92 +++--- helm-elisp-package.el | 128 ++++---- helm-elisp.el | 150 +++++----- helm-elscreen.el | 20 +- helm-emms.el | 70 ++--- helm-eshell.el | 96 +++--- helm-eval.el | 6 +- helm-external.el | 26 +- helm-files.el | 350 +++++++++++----------- helm-firefox.el | 6 +- helm-font.el | 38 +-- helm-gentoo.el | 28 +- helm-grep.el | 190 ++++++------ helm-help.el | 32 +- helm-imenu.el | 42 +-- helm-info.el | 22 +- helm-locate.el | 4 +- helm-man.el | 4 +- helm-match-plugin.el | 68 ++--- helm-misc.el | 54 ++-- helm-mode.el | 412 +++++++++++++------------- helm-net.el | 130 ++++---- helm-plugin.el | 52 ++-- helm-regexp.el | 44 +-- helm-ring.el | 240 +++++++-------- helm-sys.el | 24 +- helm-tags.el | 84 +++--- helm-utils.el | 186 ++++++------ helm-w3m.el | 6 +- helm-yaoddmuse.el | 4 +- helm.el | 672 +++++++++++++++++++++--------------------- 39 files changed, 2004 insertions(+), 2004 deletions(-) diff --git a/helm-adaptative.el b/helm-adaptative.el index 35aaa7b56..936b1b06a 100644 --- a/helm-adaptative.el +++ b/helm-adaptative.el @@ -53,7 +53,7 @@ Format: ((SOURCE-NAME (SELECTED-CANDIDATE (PATTERN . NUMBER-OF-USE) ...) ...) .. (setq helm-adaptive-done nil)) (define-minor-mode helm-adaptative-mode - "Toggle adaptative sorting in all sources." + "Toggle adaptative sorting in all sources." :group 'helm-adapt :require 'helm-adaptative :global t @@ -201,13 +201,13 @@ This is a filtered candidate transformer you can use with the ;; put those candidates first which have the highest usage count (cl-loop for (info . _freq) in usage - for member = (cl-member info candidates - :test 'helm-adaptive-compare) - when member collect (car member) into sorted - and do - (setq candidates (cl-remove info candidates - :test 'helm-adaptive-compare)) - finally return (append sorted candidates))) + for member = (cl-member info candidates + :test 'helm-adaptive-compare) + when member collect (car member) into sorted + and do + (setq candidates (cl-remove info candidates + :test 'helm-adaptive-compare)) + finally return (append sorted candidates))) (message "Your `%s' is maybe corrupted or too old, \ you should reinitialize it with `helm-reset-adaptative-history'" helm-adaptive-history-file) diff --git a/helm-aliases.el b/helm-aliases.el index 644d861ff..bb6c5b027 100644 --- a/helm-aliases.el +++ b/helm-aliases.el @@ -32,32 +32,32 @@ (defun helm-check-conflicting-prefixes () (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)) + 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 () (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)) + for sym = (intern s) + when (and (not (helm-alias-p sym)) (fboundp sym)) + collect s)) (defun helm-collect-vars-with-bad-prefix () (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)) + for sym = (intern s) + when (and (not (helm-alias-p sym)) (boundp sym)) + collect s)) (defun helm-insert-fn-aliases () (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)))) + 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 () (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)))) + 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)))) ;;; Alias old functions prefixed with "helm-c-" diff --git a/helm-apt.el b/helm-apt.el index bd9bd1b2a..5a6b08b36 100644 --- a/helm-apt.el +++ b/helm-apt.el @@ -41,12 +41,12 @@ If nil default `helm-apt-cache-show-1' will be used." :group 'helm-apt) (defface helm-apt-installed - '((t (:foreground "green"))) + '((t (:foreground "green"))) "Face used for apt installed candidates." :group 'helm-apt) (defface helm-apt-deinstalled - '((t (:foreground "DimGray"))) + '((t (:foreground "DimGray"))) "Face used for apt deinstalled candidates." :group 'helm-apt) @@ -100,23 +100,23 @@ If nil default `helm-apt-cache-show-1' will be used." (defun helm-apt-candidate-transformer (candidates) "Show installed CANDIDATES and the ones to deinstall in a different color." (cl-loop for cand in candidates - for name = (helm-apt-display-to-real cand) - for deinstall = (string= - (assoc-default name helm-apt-installed-packages) - "deinstall") - for install = (string= - (assoc-default name helm-apt-installed-packages) - "install") - for show = (cond ((and deinstall - (memq helm-apt-show-only '(all deinstalled))) - (propertize cand 'face 'helm-apt-deinstalled)) - ((and install - (memq helm-apt-show-only '(all installed))) - (propertize cand 'face 'helm-apt-installed)) - ((and (eq helm-apt-show-only 'noinstalled) - (not install)) cand) - ((eq helm-apt-show-only 'all) cand)) - when show collect show)) + for name = (helm-apt-display-to-real cand) + for deinstall = (string= + (assoc-default name helm-apt-installed-packages) + "deinstall") + for install = (string= + (assoc-default name helm-apt-installed-packages) + "install") + for show = (cond ((and deinstall + (memq helm-apt-show-only '(all deinstalled))) + (propertize cand 'face 'helm-apt-deinstalled)) + ((and install + (memq helm-apt-show-only '(all installed))) + (propertize cand 'face 'helm-apt-installed)) + ((and (eq helm-apt-show-only 'noinstalled) + (not install)) cand) + ((eq helm-apt-show-only 'all) cand)) + when show collect show)) (defun helm-apt-show-only-installed () (interactive) @@ -154,8 +154,8 @@ If nil default `helm-apt-cache-show-1' will be used." (call-process-shell-command "dpkg --get-selections" nil (current-buffer)) (cl-loop for i in (split-string (buffer-string) "\n" t) - for p = (split-string i) - collect (cons (car p) (cadr p))))) + for p = (split-string i) + collect (cons (car p) (cadr p))))) (helm-init-candidates-in-buffer 'global (setq helm-apt-all-packages @@ -175,8 +175,8 @@ package name - description." (defvar helm-apt-show-current-package nil) (define-derived-mode helm-apt-show-mode - special-mode "helm-apt-show" - "Mode to display infos on apt packages.") + special-mode "helm-apt-show" + "Mode to display infos on apt packages.") (defun helm-apt-cache-show (package) "Show information on apt package PACKAGE." diff --git a/helm-bbdb.el b/helm-bbdb.el index 01207d133..f6365f5ef 100644 --- a/helm-bbdb.el +++ b/helm-bbdb.el @@ -52,53 +52,53 @@ The format is \"Firstname Lastname\"." See docstring of `bbdb-create-internal' for more info on address entries." (cl-loop with loc-list = (cons "[Exit when no more]" (bbdb-label-completion-list "phones")) - with loc ; Defer count - do (setq loc (helm-comp-read (format "Phone location[%s]: " count) - loc-list - :must-match 'confirm - :default "")) - while (not (string= loc "[Exit when no more]")) - for count from 1 - for phone-number = (read-string (format "Phone number (%s): " loc)) - collect (vector loc phone-number) into phone-list - do (setq loc-list (remove loc loc-list)) - finally return phone-list)) + with loc ; Defer count + do (setq loc (helm-comp-read (format "Phone location[%s]: " count) + loc-list + :must-match 'confirm + :default "")) + while (not (string= loc "[Exit when no more]")) + for count from 1 + for phone-number = (read-string (format "Phone number (%s): " loc)) + collect (vector loc phone-number) into phone-list + do (setq loc-list (remove loc loc-list)) + finally return phone-list)) ;; TODO move this to helm-utils when finish (defun helm-read-repeat-string (bbdb--prompt &optional count) "Prompt as many time PROMPT is not empty. If COUNT is non--nil add a number after each prompt." (cl-loop with elm - while (not (string= elm "")) - for n from 1 - do (when count - (setq bbdb--prompt (concat bbdb--prompt (int-to-string n) ": "))) - collect (setq elm (read-string bbdb--prompt)) into lis - finally return (remove "" lis))) + while (not (string= elm "")) + for n from 1 + do (when count + (setq bbdb--prompt (concat bbdb--prompt (int-to-string n) ": "))) + collect (setq elm (read-string bbdb--prompt)) into lis + finally return (remove "" lis))) (defun helm-bbdb-read-address () "Return a list of vector address objects. See docstring of `bbdb-create-internal' for more info on address entries." (cl-loop with loc-list = (cons "[Exit when no more]" (bbdb-label-completion-list "addresses")) - with loc ; Defer count - do (setq loc (helm-comp-read - (format "Address description[%s]: " - (int-to-string count)) - loc-list - :must-match 'confirm - :default "")) - while (not (string= loc "[Exit when no more]")) - for count from 1 - ;; Create vector - for lines = (helm-read-repeat-string "Line" t) - for city = (read-string "City: ") - for state = (read-string "State: ") - for zip = (read-string "ZipCode: ") - for country = (read-string "Country: ") - collect (vector loc lines city state zip country) into address-list - do (setq loc-list (remove loc loc-list)) - finally return address-list)) + with loc ; Defer count + do (setq loc (helm-comp-read + (format "Address description[%s]: " + (int-to-string count)) + loc-list + :must-match 'confirm + :default "")) + while (not (string= loc "[Exit when no more]")) + for count from 1 + ;; Create vector + for lines = (helm-read-repeat-string "Line" t) + for city = (read-string "City: ") + for state = (read-string "State: ") + for zip = (read-string "ZipCode: ") + for country = (read-string "Country: ") + collect (vector loc lines city state zip country) into address-list + do (setq loc-list (remove loc loc-list)) + finally return address-list)) (defun helm-bbdb-create-contact (actions candidate) "Action transformer for `helm-source-bbdb'. @@ -154,8 +154,8 @@ http://bbdb.sourceforge.net/") "Return a list of all mail addresses of records in bbdb buffer." (with-current-buffer bbdb-buffer-name (cl-loop for i in bbdb-records - if (bbdb-record-net (car i)) - collect (bbdb-dwim-net-address (car i))))) + if (bbdb-record-net (car i)) + collect (bbdb-dwim-net-address (car i))))) (defun helm-bbdb-compose-mail (candidate) "Compose a mail with all records of bbdb buffer." diff --git a/helm-bookmark.el b/helm-bookmark.el index 0261a7731..3d08c681c 100644 --- a/helm-bookmark.el +++ b/helm-bookmark.el @@ -35,37 +35,37 @@ (defface helm-bookmark-info - '((t (:foreground "green"))) + '((t (:foreground "green"))) "Face used for W3m Emacs bookmarks (not w3m bookmarks)." :group 'helm-bookmark) (defface helm-bookmark-w3m - '((t (:foreground "yellow"))) + '((t (:foreground "yellow"))) "Face used for W3m Emacs bookmarks (not w3m bookmarks)." :group 'helm-bookmark) (defface helm-bookmark-gnus - '((t (:foreground "magenta"))) + '((t (:foreground "magenta"))) "Face used for Gnus bookmarks." :group 'helm-bookmark) (defface helm-bookmark-man - '((t (:foreground "Orange4"))) + '((t (:foreground "Orange4"))) "Face used for Woman/man bookmarks." :group 'helm-bookmark) (defface helm-bookmark-file - '((t (:foreground "Deepskyblue2"))) + '((t (:foreground "Deepskyblue2"))) "Face used for file bookmarks." :group 'helm-bookmark) (defface helm-bookmark-directory - '((t (:inherit helm-ff-directory))) + '((t (:inherit helm-ff-directory))) "Face used for file bookmarks." :group 'helm-bookmark) (defface helm-bookmark-addressbook - '((t (:foreground "tomato"))) + '((t (:foreground "tomato"))) "Face used for addressbook bookmarks." :group 'helm-bookmark) @@ -104,16 +104,16 @@ (defun helm-bookmark-transformer (candidates _source) (cl-loop for i in candidates - for loc = (bookmark-location i) - for len = (string-width i) - for trunc = (if (> len bookmark-bmenu-file-column) - (helm-substring i bookmark-bmenu-file-column) - i) - for sep = (make-string (- (+ bookmark-bmenu-file-column 2) - (length trunc)) ? ) - if helm-bookmark-show-location - collect (cons (concat trunc sep loc) i) - else collect i)) + for loc = (bookmark-location i) + for len = (string-width i) + for trunc = (if (> len bookmark-bmenu-file-column) + (helm-substring i bookmark-bmenu-file-column) + i) + for sep = (make-string (- (+ bookmark-bmenu-file-column 2) + (length trunc)) ? ) + if helm-bookmark-show-location + collect (cons (concat trunc sep loc) i) + else collect i)) (defun helm-bookmark-match-fn (candidate) "Match function for bookmark sources using `candidates'." @@ -169,7 +169,7 @@ (cadr helm-bookmark-mode-line-string)))) (helm-init-candidates-in-buffer 'global (cl-loop for b in (bookmark-all-names) collect - (propertize b 'location (bookmark-location b)))))) + (propertize b 'location (bookmark-location b)))))) (candidates-in-buffer) (search helm-bookmark-search-fn) (match-part . helm-pp-bookmark-match-fn) @@ -278,10 +278,10 @@ BOOKMARK is a bookmark name or a bookmark record." (defun helm-bookmark-filter-setup-alist (fn) "Return a filtered `bookmark-alist' sorted alphabetically." (cl-loop with alist = (cl-loop for b in bookmark-alist - when (funcall fn b) collect b) - for bmk in alist - for name = (car bmk) - collect (propertize name 'location (bookmark-location name)))) + when (funcall fn b) collect b) + for bmk in alist + for name = (car bmk) + collect (propertize name 'location (bookmark-location name)))) ;;; Bookmark handlers @@ -474,8 +474,8 @@ than `w3m-browse-url' use it." (helm-aif (cdr contacts) (let ((current-prefix-arg '(4))) (cl-loop for bmk in it do - (bookmark-jump - (helm-bookmark-get-bookmark-from-name bmk)))))))) + (bookmark-jump + (helm-bookmark-get-bookmark-from-name bmk)))))))) ("Send Mail" . (lambda (candidate) (let* ((contacts (helm-marked-candidates)) @@ -488,7 +488,7 @@ than `w3m-browse-url' use it." (setq contacts (cdr contacts)) (when contacts (cl-loop for bmk in contacts do - (addressbook-set-mail-buffer1 bmk 'append)))))) + (addressbook-set-mail-buffer1 bmk 'append)))))) ("Edit Bookmark" . (lambda (candidate) (let ((bmk (helm-bookmark-get-bookmark-from-name @@ -556,73 +556,73 @@ than `w3m-browse-url' use it." Work both with standard Emacs bookmarks and bookmark-extensions.el." (let ((non-essential t)) (cl-loop for i in bookmarks - for isfile = (bookmark-get-filename i) - for handlerp = (and (fboundp 'bookmark-get-handler) - (bookmark-get-handler i)) - for isw3m = (and (fboundp 'helm-bookmark-w3m-bookmark-p) - (helm-bookmark-w3m-bookmark-p i)) - for isgnus = (and (fboundp 'helm-bookmark-gnus-bookmark-p) - (helm-bookmark-gnus-bookmark-p i)) - for isman = (and (fboundp 'helm-bookmark-man-bookmark-p) ; Man - (helm-bookmark-man-bookmark-p i)) - for iswoman = (and (fboundp 'helm-bookmark-woman-bookmark-p) ; Woman - (helm-bookmark-woman-bookmark-p i)) - for isannotation = (bookmark-get-annotation i) - for isabook = (string= (bookmark-prop-get i 'type) - "addressbook") - for isinfo = (eq handlerp 'Info-bookmark-jump) - for loc = (bookmark-location i) - for len = (string-width i) - for trunc = (if (and helm-bookmark-show-location - (> len bookmark-bmenu-file-column)) - (helm-substring - i bookmark-bmenu-file-column) - i) - ;; Add a * if bookmark have annotation - if (and isannotation (not (string-equal isannotation ""))) - do (setq trunc (concat "*" (if helm-bookmark-show-location trunc i))) - for sep = (and helm-bookmark-show-location - (make-string (- (+ bookmark-bmenu-file-column 2) - (string-width trunc)) ? )) - for bmk = (cond ( ;; info buffers - isinfo - (propertize trunc 'face 'helm-bookmark-info - 'help-echo isfile)) - ( ;; w3m buffers - isw3m - (propertize trunc 'face 'helm-bookmark-w3m - 'help-echo isfile)) - ( ;; gnus buffers - isgnus - (propertize trunc 'face 'helm-bookmark-gnus - 'help-echo isfile)) - ( ;; Man Woman - (or iswoman isman) - (propertize trunc 'face 'helm-bookmark-man - 'help-echo isfile)) - ( ;; Addressbook - isabook - (propertize trunc 'face 'helm-bookmark-addressbook)) - ( ;; directories - (and isfile - ;; This is needed because `non-essential' - ;; is not working on Emacs-24.2 and the behavior - ;; of tramp seems to have changed since previous - ;; versions (Need to reenter password even if a - ;; first connection have been established, - ;; probably when host is named differently - ;; i.e machine/localhost) - (not (file-remote-p isfile)) - (file-directory-p isfile)) - (propertize trunc 'face 'helm-bookmark-directory - 'help-echo isfile)) - ( ;; regular files - t - (propertize trunc 'face 'helm-bookmark-file - 'help-echo isfile))) - collect (if helm-bookmark-show-location - (cons (concat bmk sep loc) i) - (cons bmk i))))) + for isfile = (bookmark-get-filename i) + for handlerp = (and (fboundp 'bookmark-get-handler) + (bookmark-get-handler i)) + for isw3m = (and (fboundp 'helm-bookmark-w3m-bookmark-p) + (helm-bookmark-w3m-bookmark-p i)) + for isgnus = (and (fboundp 'helm-bookmark-gnus-bookmark-p) + (helm-bookmark-gnus-bookmark-p i)) + for isman = (and (fboundp 'helm-bookmark-man-bookmark-p) ; Man + (helm-bookmark-man-bookmark-p i)) + for iswoman = (and (fboundp 'helm-bookmark-woman-bookmark-p) ; Woman + (helm-bookmark-woman-bookmark-p i)) + for isannotation = (bookmark-get-annotation i) + for isabook = (string= (bookmark-prop-get i 'type) + "addressbook") + for isinfo = (eq handlerp 'Info-bookmark-jump) + for loc = (bookmark-location i) + for len = (string-width i) + for trunc = (if (and helm-bookmark-show-location + (> len bookmark-bmenu-file-column)) + (helm-substring + i bookmark-bmenu-file-column) + i) + ;; Add a * if bookmark have annotation + if (and isannotation (not (string-equal isannotation ""))) + do (setq trunc (concat "*" (if helm-bookmark-show-location trunc i))) + for sep = (and helm-bookmark-show-location + (make-string (- (+ bookmark-bmenu-file-column 2) + (string-width trunc)) ? )) + for bmk = (cond ( ;; info buffers + isinfo + (propertize trunc 'face 'helm-bookmark-info + 'help-echo isfile)) + ( ;; w3m buffers + isw3m + (propertize trunc 'face 'helm-bookmark-w3m + 'help-echo isfile)) + ( ;; gnus buffers + isgnus + (propertize trunc 'face 'helm-bookmark-gnus + 'help-echo isfile)) + ( ;; Man Woman + (or iswoman isman) + (propertize trunc 'face 'helm-bookmark-man + 'help-echo isfile)) + ( ;; Addressbook + isabook + (propertize trunc 'face 'helm-bookmark-addressbook)) + ( ;; directories + (and isfile + ;; This is needed because `non-essential' + ;; is not working on Emacs-24.2 and the behavior + ;; of tramp seems to have changed since previous + ;; versions (Need to reenter password even if a + ;; first connection have been established, + ;; probably when host is named differently + ;; i.e machine/localhost) + (not (file-remote-p isfile)) + (file-directory-p isfile)) + (propertize trunc 'face 'helm-bookmark-directory + 'help-echo isfile)) + ( ;; regular files + t + (propertize trunc 'face 'helm-bookmark-file + 'help-echo isfile))) + collect (if helm-bookmark-show-location + (cons (concat bmk sep loc) i) + (cons bmk i))))) (defun helm-bookmark-edit-bookmark (bookmark-name) "Edit bookmark's name and file name, and maybe save them. @@ -694,18 +694,18 @@ words from the buffer into the new bookmark name." ;;; Bookmarks attributes ;; (define-helm-type-attribute 'bookmark - `((coerce . helm-bookmark-get-bookmark-from-name) - (action - ("Jump to bookmark" . helm-bookmark-jump) - ("Jump to BM other window" . helm-bookmark-jump-other-window) - ("Bookmark edit annotation" . bookmark-edit-annotation) - ("Bookmark show annotation" . bookmark-show-annotation) - ("Delete bookmark(s)" . helm-delete-marked-bookmarks) - ("Edit Bookmark" . helm-bookmark-edit-bookmark) - ("Rename bookmark" . helm-bookmark-rename) - ("Relocate bookmark" . bookmark-relocate)) - (keymap . ,helm-bookmark-map) - (mode-line . helm-bookmark-mode-line-string)) + `((coerce . helm-bookmark-get-bookmark-from-name) + (action + ("Jump to bookmark" . helm-bookmark-jump) + ("Jump to BM other window" . helm-bookmark-jump-other-window) + ("Bookmark edit annotation" . bookmark-edit-annotation) + ("Bookmark show annotation" . bookmark-show-annotation) + ("Delete bookmark(s)" . helm-delete-marked-bookmarks) + ("Edit Bookmark" . helm-bookmark-edit-bookmark) + ("Rename bookmark" . helm-bookmark-rename) + ("Relocate bookmark" . bookmark-relocate)) + (keymap . ,helm-bookmark-map) + (mode-line . helm-bookmark-mode-line-string)) "Bookmark name.") diff --git a/helm-buffers.el b/helm-buffers.el index cad5a4bca..eb82f25bf 100644 --- a/helm-buffers.el +++ b/helm-buffers.el @@ -52,7 +52,7 @@ filtered from the list of candidates if the When disabled (nil) use the longest buffer-name length found." :group 'helm-buffers :type '(choice (const :tag "Disabled" nil) - (integer :tag "Length before truncate"))) + (integer :tag "Length before truncate"))) (defcustom helm-buffer-details-flag t "Always show details in buffer list when non--nil." @@ -64,28 +64,28 @@ When disabled (nil) use the longest buffer-name length found." ;; ;; (defface helm-buffer-saved-out - '((t (:foreground "red" :background "black"))) + '((t (:foreground "red" :background "black"))) "Face used for buffer files modified outside of emacs." :group 'helm-buffers) (defface helm-buffer-not-saved - '((t (:foreground "Indianred2"))) + '((t (:foreground "Indianred2"))) "Face used for buffer files not already saved on disk." :group 'helm-buffers) (defface helm-buffer-size - '((((background dark)) :foreground "RosyBrown") - (((background light)) :foreground "SlateGray")) + '((((background dark)) :foreground "RosyBrown") + (((background light)) :foreground "SlateGray")) "Face used for buffer size." :group 'helm-buffers) (defface helm-buffer-process - '((t (:foreground "Sienna3"))) + '((t (:foreground "Sienna3"))) "Face used for process status in buffer." :group 'helm-buffers) (defface helm-buffer-directory - '((t (:foreground "DarkRed" :background "LightGray"))) + '((t (:foreground "DarkRed" :background "LightGray"))) "Face used for directories in `helm-buffers-list'." :group 'helm-files) @@ -140,11 +140,11 @@ When disabled (nil) use the longest buffer-name length found." ;; Issue #51 Create the list before `helm-buffer' creation. (setq helm-buffers-list-cache (helm-buffer-list)) (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))) - into len-mode - finally return (cons len-buf len-mode)))) + maximize (length b) into len-buf + maximize (length (with-current-buffer b + (symbol-name major-mode))) + into len-mode + finally return (cons len-buf len-mode)))) (unless helm-buffer-max-length (setq helm-buffer-max-length (car result))) (unless helm-buffer-max-len-mode @@ -225,8 +225,8 @@ See `ido-make-buffer-list' for more infos." (position-bytes (point-min))))))) (defun helm-buffer--show-details (buf-name prefix help-echo - size mode dir face1 face2 - proc details) + size mode dir face1 face2 + proc details) (append (list (concat prefix @@ -254,65 +254,65 @@ See `ido-make-buffer-list' for more infos." (name-prefix (when (file-remote-p dir) (propertize "@ " 'face 'helm-ff-prefix)))) (cond - ( ;; A dired buffer. - (rassoc buf dired-buffers) - (helm-buffer--show-details - name name-prefix dir size mode dir - 'helm-buffer-directory 'helm-buffer-process nil details)) - ;; A buffer file modified somewhere outside of emacs.=>red - ((and file-name (file-exists-p file-name) - (not (verify-visited-file-modtime buf))) - (helm-buffer--show-details - name name-prefix file-name size mode dir - 'helm-buffer-saved-out 'helm-buffer-process nil details)) - ;; A new buffer file not already saved on disk.=>indianred2 - ((and file-name (not (verify-visited-file-modtime buf))) - (helm-buffer--show-details - name name-prefix file-name size mode dir - 'helm-buffer-not-saved 'helm-buffer-process nil details)) - ;; A buffer file modified and not saved on disk.=>orange - ((and file-name (buffer-modified-p buf)) - (helm-buffer--show-details - name name-prefix file-name size mode dir - 'helm-ff-symlink 'helm-buffer-process nil details)) - ;; A buffer file not modified and saved on disk.=>green - (file-name - (helm-buffer--show-details - name name-prefix file-name size mode dir - 'font-lock-type-face 'helm-buffer-process nil details)) - ;; Any non--file buffer.=>grey italic - (t - (helm-buffer--show-details - name (and proc name-prefix) dir size mode dir - 'italic 'helm-buffer-process proc details))))) + ( ;; A dired buffer. + (rassoc buf dired-buffers) + (helm-buffer--show-details + name name-prefix dir size mode dir + 'helm-buffer-directory 'helm-buffer-process nil details)) + ;; A buffer file modified somewhere outside of emacs.=>red + ((and file-name (file-exists-p file-name) + (not (verify-visited-file-modtime buf))) + (helm-buffer--show-details + name name-prefix file-name size mode dir + 'helm-buffer-saved-out 'helm-buffer-process nil details)) + ;; A new buffer file not already saved on disk.=>indianred2 + ((and file-name (not (verify-visited-file-modtime buf))) + (helm-buffer--show-details + name name-prefix file-name size mode dir + 'helm-buffer-not-saved 'helm-buffer-process nil details)) + ;; A buffer file modified and not saved on disk.=>orange + ((and file-name (buffer-modified-p buf)) + (helm-buffer--show-details + name name-prefix file-name size mode dir + 'helm-ff-symlink 'helm-buffer-process nil details)) + ;; A buffer file not modified and saved on disk.=>green + (file-name + (helm-buffer--show-details + name name-prefix file-name size mode dir + 'font-lock-type-face 'helm-buffer-process nil details)) + ;; Any non--file buffer.=>grey italic + (t + (helm-buffer--show-details + name (and proc name-prefix) dir size mode dir + 'italic 'helm-buffer-process proc details))))) (defun helm-highlight-buffers (buffers _source) "Transformer function to highlight BUFFERS list. Should be called after others transformers i.e (boring 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)) - for truncbuf = (if (> (string-width name) helm-buffer-max-length) - (helm-substring-by-width - name helm-buffer-max-length) - (concat name (make-string - (- (+ helm-buffer-max-length 3) - (string-width name)) ? ))) - for len = (length mode) - when (> len helm-buffer-max-len-mode) - do (setq helm-buffer-max-len-mode len) - for fmode = (concat (make-string - (- (max helm-buffer-max-len-mode len) len) ? ) - mode) - ;; The max length of a number should be 1023.9X where X is the - ;; units, this is 7 characters. - for formatted-size = (and size (format "%7s" size)) - collect (cons (if helm-buffer-details-flag - (concat truncbuf "\t" formatted-size - " " fmode " " meta) - name) - i))) + for (name size mode meta) = (if helm-buffer-details-flag + (helm-buffer--details i 'details) + (helm-buffer--details i)) + for truncbuf = (if (> (string-width name) helm-buffer-max-length) + (helm-substring-by-width + name helm-buffer-max-length) + (concat name (make-string + (- (+ helm-buffer-max-length 3) + (string-width name)) ? ))) + for len = (length mode) + when (> len helm-buffer-max-len-mode) + do (setq helm-buffer-max-len-mode len) + for fmode = (concat (make-string + (- (max helm-buffer-max-len-mode len) len) ? ) + mode) + ;; The max length of a number should be 1023.9X where X is the + ;; units, this is 7 characters. + for formatted-size = (and size (format "%7s" size)) + collect (cons (if helm-buffer-details-flag + (concat truncbuf "\t" formatted-size + " " fmode " " meta) + name) + i))) (defun helm-buffer--get-preselection (buffer-name) (concat "^" @@ -349,14 +349,14 @@ Should be called after others transformers i.e (boring buffers)." (when (string-match "\\`\\*" pattern) (setq pattern (split-string (substring pattern 1) ",")) (cl-loop for pat in pattern - if (string-match "\\`!" pat) - collect (string-match (substring pat 1) mjm) into neg - else collect (string-match pat mjm) into pos - finally return - (or (and pos (cl-loop for i in pos - thereis (numberp i))) - (and neg (not (cl-loop for i in neg - thereis (numberp i)))))))) + if (string-match "\\`!" pat) + collect (string-match (substring pat 1) mjm) into neg + else collect (string-match pat mjm) into pos + finally return + (or (and pos (cl-loop for i in pos + thereis (numberp i))) + (and neg (not (cl-loop for i in neg + thereis (numberp i)))))))) (defun helm-buffer--match-pattern (pattern candidate) (if (string-match "\\`!" pattern) @@ -391,23 +391,23 @@ with name matching pattern." ((string-match "\\`\\*" helm-pattern) (and (helm-buffer--match-mjm (car split) mjm) (cl-loop for i in (cdr split) always - (helm-buffer--match-pattern i cand)))) + (helm-buffer--match-pattern i cand)))) ((string-match "\\s-" helm-pattern) (cl-loop for i in split always - (helm-buffer--match-pattern i cand))) + (helm-buffer--match-pattern i cand))) (t (or (helm-buffer--match-mjm helm-pattern mjm) (helm-buffer--match-pattern helm-pattern cand))))))))) (defun helm-buffers-match-inside (candidate lst) (cl-loop for i in lst always - (cond ((string-match "\\`[\\]@" i) - (helm-buffer--match-pattern i candidate)) - ((string-match "\\`@\\(.*\\)" i) - (save-excursion - (let ((str (match-string 1 i))) - (goto-char (point-min)) - (re-search-forward str nil t)))) - (t (helm-buffer--match-pattern i candidate))))) + (cond ((string-match "\\`[\\]@" i) + (helm-buffer--match-pattern i candidate)) + ((string-match "\\`@\\(.*\\)" i) + (save-excursion + (let ((str (match-string 1 i))) + (goto-char (point-min)) + (re-search-forward str nil t)))) + (t (helm-buffer--match-pattern i candidate))))) (defun helm-buffer-query-replace-1 (&optional regexp-flag) @@ -417,19 +417,19 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (prompt (if regexp-flag "Query replace regexp" "Query replace")) (bufs (helm-marked-candidates))) (cl-loop with replace = (query-replace-read-from prompt regexp-flag) - with tostring = (unless (consp replace) - (query-replace-read-to - replace prompt regexp-flag)) - for buf in bufs - do - (save-window-excursion - (helm-switch-to-buffer buf) - (save-excursion - (let ((case-fold-search t)) - (goto-char (point-min)) - (if (consp replace) - (apply fn (list (car replace) (cdr replace))) - (apply fn (list replace tostring))))))))) + with tostring = (unless (consp replace) + (query-replace-read-to + replace prompt regexp-flag)) + for buf in bufs + do + (save-window-excursion + (helm-switch-to-buffer buf) + (save-excursion + (let ((case-fold-search t)) + (goto-char (point-min)) + (if (consp replace) + (apply fn (list (car replace) (cdr replace))) + (apply fn (list replace tostring))))))))) (defun helm-buffer-query-replace-regexp (_candidate) (helm-buffer-query-replace-1 'regexp)) @@ -478,8 +478,8 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (preselect (helm-get-selection nil t)) (enable-recursive-minibuffers t)) (cl-loop for buf in marked do - (with-current-buffer (get-buffer buf) - (when (buffer-file-name) (save-buffer)))) + (with-current-buffer (get-buffer buf) + (when (buffer-file-name) (save-buffer)))) (when (> (length marked) 1) (helm-unmark-all)) (helm-force-update (regexp-quote preselect)))) @@ -613,8 +613,8 @@ Can be used by any source that list buffers." helm-moccur-always-search-in-current)) (buffers (helm-marked-candidates)) (input (cl-loop for i in (split-string helm-pattern " " t) - thereis (and (string-match "\\`@\\(.*\\)" i) - (match-string 1 i))))) + thereis (and (string-match "\\`@\\(.*\\)" i) + (match-string 1 i))))) (helm-multi-occur-1 buffers input))) (defun helm-buffers-run-multi-occur () @@ -655,29 +655,29 @@ displayed with the `file-name-shadow' face if available." (define-helm-type-attribute 'buffer - `((action - ("Switch to buffer" . helm-switch-to-buffer) - ,(and (locate-library "popwin") '("Switch to buffer in popup window" . popwin:popup-buffer)) - ("Switch to buffer other window" . switch-to-buffer-other-window) - ("Switch to buffer other frame" . switch-to-buffer-other-frame) - ,(and (locate-library "elscreen") '("Display buffer in Elscreen" . helm-find-buffer-on-elscreen)) - ("Query replace regexp" . helm-buffer-query-replace-regexp) - ("Query replace" . helm-buffer-query-replace) - ("View buffer" . view-buffer) - ("Display buffer" . display-buffer) - ("Grep buffers (C-u grep all buffers)" . helm-zgrep-buffers) - ("Multi occur buffer(s)" . helm-multi-occur-as-action) - ("Revert buffer(s)" . helm-revert-marked-buffers) - ("Insert buffer" . insert-buffer) - ("Kill buffer(s)" . helm-kill-marked-buffers) - ("Diff with file" . diff-buffer-with-file) - ("Ediff Marked buffers" . helm-ediff-marked-buffers) - ("Ediff Merge marked buffers" . (lambda (candidate) - (helm-ediff-marked-buffers candidate t)))) - (persistent-help . "Show this buffer") - (filtered-candidate-transformer helm-skip-boring-buffers - helm-buffers-sort-transformer - helm-highlight-buffers)) + `((action + ("Switch to buffer" . helm-switch-to-buffer) + ,(and (locate-library "popwin") '("Switch to buffer in popup window" . popwin:popup-buffer)) + ("Switch to buffer other window" . switch-to-buffer-other-window) + ("Switch to buffer other frame" . switch-to-buffer-other-frame) + ,(and (locate-library "elscreen") '("Display buffer in Elscreen" . helm-find-buffer-on-elscreen)) + ("Query replace regexp" . helm-buffer-query-replace-regexp) + ("Query replace" . helm-buffer-query-replace) + ("View buffer" . view-buffer) + ("Display buffer" . display-buffer) + ("Grep buffers (C-u grep all buffers)" . helm-zgrep-buffers) + ("Multi occur buffer(s)" . helm-multi-occur-as-action) + ("Revert buffer(s)" . helm-revert-marked-buffers) + ("Insert buffer" . insert-buffer) + ("Kill buffer(s)" . helm-kill-marked-buffers) + ("Diff with file" . diff-buffer-with-file) + ("Ediff Marked buffers" . helm-ediff-marked-buffers) + ("Ediff Merge marked buffers" . (lambda (candidate) + (helm-ediff-marked-buffers candidate t)))) + (persistent-help . "Show this buffer") + (filtered-candidate-transformer helm-skip-boring-buffers + helm-buffers-sort-transformer + helm-highlight-buffers)) "Buffer or buffer name.") ;;;###autoload diff --git a/helm-command.el b/helm-command.el index 0b838e0dc..cdcb91524 100644 --- a/helm-command.el +++ b/helm-command.el @@ -65,9 +65,9 @@ Show all candidates on startup when 0 (default)." (cl-defun helm-M-x-get-major-mode-command-alist (mode-map) "Return alist of MODE-MAP." (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 "" str-key) - unless ismenu collect (cons str-key com))) + for str-key = (key-description key) + for ismenu = (string-match "" str-key) + unless ismenu collect (cons str-key com))) (defun helm-get-mode-map-from-mode (mode) "Guess the mode-map name according to MODE. @@ -75,16 +75,16 @@ 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." (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) - while (not mode-map) - for count downfrom (length mode-name) - ;; Return when no result after parsing entire string. - when (eq count 0) return nil - for sub-name = (substring mode-name 0 count) - do (setq mode-map (intern-soft (format "%s-map" (concat sub-name "-mode")))) - finally return mode-map)) + 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) + while (not mode-map) + for count downfrom (length mode-name) + ;; Return when no result after parsing entire string. + when (eq count 0) return nil + for sub-name = (substring mode-name 0 count) + do (setq mode-map (intern-soft (format "%s-map" (concat sub-name "-mode")))) + finally return mode-map)) (defun helm-M-x-current-mode-map-alist () "Return mode-map alist of current `major-mode'." @@ -98,23 +98,23 @@ Return nil if no mode-map found." Show global bindings and local bindings according to current `major-mode'." (with-helm-current-buffer (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)) - collect - (cons (cond ((and (string-match "^M-x" key) local-key) - (format "%s (%s)" - cand (propertize - local-key - 'face 'helm-M-x-key))) - ((string-match "^M-x" key) cand) - (t (format "%s (%s)" - cand (propertize - key - 'face 'helm-M-x-key)))) - cand) into ls - finally return - (sort ls #'helm-generic-sort-fn)))) + for cand in candidates + for local-key = (car (rassq cand local-map)) + for key = (substitute-command-keys (format "\\[%s]" cand)) + collect + (cons (cond ((and (string-match "^M-x" key) local-key) + (format "%s (%s)" + cand (propertize + local-key + 'face 'helm-M-x-key))) + ((string-match "^M-x" key) cand) + (t (format "%s (%s)" + cand (propertize + key + 'face 'helm-M-x-key)))) + cand) into ls + finally return + (sort ls #'helm-generic-sort-fn)))) (defun helm-M-x--notify-prefix-arg () ;; Notify a prefix-arg set AFTER calling M-x. @@ -133,7 +133,7 @@ the prefix args if needed, are passed AFTER starting `helm-M-x'. You can get help on each command by persistent action." (interactive) (let* ((history (cl-loop for i in extended-command-history - when (commandp (intern i)) collect i)) + when (commandp (intern i)) collect i)) command sym-com in-help help-cand (helm--mode-line-display-prefarg t) (pers-help #'(lambda (candidate) @@ -154,23 +154,23 @@ You can get help on each command by persistent action." (tm (run-at-time 1 0.1 'helm-M-x--notify-prefix-arg))) (setq current-prefix-arg nil) (unwind-protect - (setq command (helm-comp-read - "M-x " obarray - :test 'commandp - :requires-pattern helm-M-x-requires-pattern - :name "Emacs Commands" - :buffer "*helm M-x*" - :persistent-action pers-help - :persistent-help "Describe this command" - :history history - :reverse-history helm-M-x-reverse-history - :del-input nil - :mode-line helm-M-x-mode-line - :must-match t - :nomark t - :keymap helm-M-x-map - :candidates-in-buffer t - :fc-transformer 'helm-M-x-transformer)) + (setq command (helm-comp-read + "M-x " obarray + :test 'commandp + :requires-pattern helm-M-x-requires-pattern + :name "Emacs Commands" + :buffer "*helm M-x*" + :persistent-action pers-help + :persistent-help "Describe this command" + :history history + :reverse-history helm-M-x-reverse-history + :del-input nil + :mode-line helm-M-x-mode-line + :must-match t + :nomark t + :keymap helm-M-x-map + :candidates-in-buffer t + :fc-transformer 'helm-M-x-transformer)) (cancel-timer tm) (setq helm--mode-line-display-prefarg nil)) (setq sym-com (intern command)) diff --git a/helm-config.el b/helm-config.el index 1a8be7035..d37d87175 100644 --- a/helm-config.el +++ b/helm-config.el @@ -37,10 +37,10 @@ (lambda (var key) (when (and (boundp var) (symbol-value var)) (define-key (current-global-map) - (read-kbd-macro (symbol-value var)) nil)) + (read-kbd-macro (symbol-value var)) nil)) (when key (define-key (current-global-map) - (read-kbd-macro key) 'helm-command-prefix)) + (read-kbd-macro key) 'helm-command-prefix)) (set var key))) (defcustom helm-minibuffer-history-key "C-r" @@ -60,10 +60,10 @@ (when (and (boundp map) (keymapp (symbol-value map))) (when (and (boundp var) (symbol-value var)) (define-key (symbol-value map) - (read-kbd-macro (symbol-value var)) nil)) + (read-kbd-macro (symbol-value var)) nil)) (when key (define-key (symbol-value map) - (read-kbd-macro key) 'helm-minibuffer-history)))) + (read-kbd-macro key) 'helm-minibuffer-history)))) (set var key))) ;;; Command Keymap diff --git a/helm-dabbrev.el b/helm-dabbrev.el index 527a19a16..a7135f96f 100644 --- a/helm-dabbrev.el +++ b/helm-dabbrev.el @@ -72,8 +72,8 @@ Note that this is not affecting searching in helm buffer, but the initial search for all candidates in buffer(s)." :group 'helm-dabbrev :type '(choice (const :tag "Ignore case" t) - (const :tag "Respect case" nil) - (other :tag "Smart" 'smart))) + (const :tag "Respect case" nil) + (other :tag "Smart" 'smart))) (defvar helm-dabbrev-map @@ -93,11 +93,11 @@ but the initial search for all candidates in buffer(s)." (defun helm-dabbrev--buffer-list () (cl-loop with lst = (buffer-list) - for buf in (if helm-dabbrev--exclude-current-buffer-flag - (cdr lst) lst) - unless (cl-loop for r in helm-dabbrev-ignored-buffers-regexps - thereis (string-match r (buffer-name buf))) - collect buf)) + for buf in (if helm-dabbrev--exclude-current-buffer-flag + (cdr lst) lst) + unless (cl-loop for r in helm-dabbrev-ignored-buffers-regexps + thereis (string-match r (buffer-name buf))) + collect buf)) (defun helm-dabbrev--same-major-mode-p (start-buffer) ;; START-BUFFER is the current-buffer where we start searching. @@ -164,33 +164,33 @@ but the initial search for all candidates in buffer(s)." (list match-1) (list match-1 match-2)))) (cl-loop for match in lst - unless (or (string= str match) - (member match result)) - do (push match result))))))) + unless (or (string= str match) + (member match result)) + do (push match result))))))) (cl-loop for buf in (if all (helm-dabbrev--buffer-list) (list (current-buffer))) - - do (with-current-buffer buf - (when (or minibuf ; check against all buffers when in minibuffer. - (helm-dabbrev--same-major-mode-p buffer1)) - (save-excursion - ;; Start searching before thing before point. - (goto-char (- (point) (length str))) - ;; Search the last 30 lines before point. - (funcall search-and-store str -2)) ; store pos [1] - (save-excursion - ;; Search the next 30 lines after point. - (funcall search-and-store str 2)) ; store pos [2] - (save-excursion - ;; Search all before point. - (goto-char pos-before) ; start from [1] - (funcall search-and-store str -1)) - (save-excursion - ;; Search all after point. - (goto-char pos-after) ; start from [2] - (funcall search-and-store str 1)))) - when (> (length result) limit) return (nreverse result) - finally return (nreverse result)))) + + do (with-current-buffer buf + (when (or minibuf ; check against all buffers when in minibuffer. + (helm-dabbrev--same-major-mode-p buffer1)) + (save-excursion + ;; Start searching before thing before point. + (goto-char (- (point) (length str))) + ;; Search the last 30 lines before point. + (funcall search-and-store str -2)) ; store pos [1] + (save-excursion + ;; Search the next 30 lines after point. + (funcall search-and-store str 2)) ; store pos [2] + (save-excursion + ;; Search all before point. + (goto-char pos-before) ; start from [1] + (funcall search-and-store str -1)) + (save-excursion + ;; Search all after point. + (goto-char pos-after) ; start from [2] + (funcall search-and-store str 1)))) + when (> (length result) limit) return (nreverse result) + finally return (nreverse result)))) (defun helm-dabbrev--get-candidates (abbrev) (cl-assert abbrev nil "[No Match]") @@ -262,20 +262,20 @@ but the initial search for all candidates in buffer(s)." :iterator (helm-iter-list (cl-loop for i in helm-dabbrev--cache when - (and i (string-match - (concat "^" (regexp-quote dabbrev)) i)) - collect i into selection - when (and selection - (= (length selection) - helm-dabbrev-cycle-thresold)) - ;; When selection len reach - ;; `helm-dabbrev-cycle-thresold' - ;; return selection. - return selection - ;; selection len never reach - ;; `helm-dabbrev-cycle-thresold' - ;; return selection. - finally return selection))))) + (and i (string-match + (concat "^" (regexp-quote dabbrev)) i)) + collect i into selection + when (and selection + (= (length selection) + helm-dabbrev-cycle-thresold)) + ;; When selection len reach + ;; `helm-dabbrev-cycle-thresold' + ;; return selection. + return selection + ;; selection len never reach + ;; `helm-dabbrev-cycle-thresold' + ;; return selection. + finally return selection))))) (let ((iter (and (helm-dabbrev-info-p helm-dabbrev--data) (helm-dabbrev-info-iterator helm-dabbrev--data))) deactivate-mark) diff --git a/helm-elisp-package.el b/helm-elisp-package.el index 0ce3e32ba..67f9f5fe7 100644 --- a/helm-elisp-package.el +++ b/helm-elisp-package.el @@ -43,75 +43,75 @@ (car id))))) (defun helm-el-package-install (_candidate) - (let ((mkd (helm-marked-candidates))) - (cl-loop for p in mkd - for id = (get-text-property 0 'tabulated-list-id p) - do (package-install - (if (fboundp 'package-desc-name) - (package-desc-name id) - (car id))) - and collect (if (fboundp 'package-desc-full-name) - id - (car id)) into installed-list - finally do (if (fboundp 'package-desc-full-name) - (message (format "%d packages installed:\n(%s)" - (length installed-list) - (mapconcat #'package-desc-full-name - installed-list ", "))) - (message (format "%d packages installed:\n(%s)" - (length installed-list) - (mapconcat 'symbol-name installed-list ", "))))))) + (cl-loop with mkd = (helm-marked-candidates) + for p in mkd + for id = (get-text-property 0 'tabulated-list-id p) + do (package-install + (if (fboundp 'package-desc-name) + (package-desc-name id) + (car id))) + and collect (if (fboundp 'package-desc-full-name) + id + (car id)) into installed-list + finally do (if (fboundp 'package-desc-full-name) + (message (format "%d packages installed:\n(%s)" + (length installed-list) + (mapconcat #'package-desc-full-name + installed-list ", "))) + (message (format "%d packages installed:\n(%s)" + (length installed-list) + (mapconcat 'symbol-name installed-list ", ")))))) (defun helm-el-package-uninstall (_candidate) - (let ((mkd (helm-marked-candidates))) - (cl-loop for p in mkd - for id = (get-text-property 0 'tabulated-list-id p) - do - (condition-case-unless-debug err - (with-no-warnings - (if (fboundp 'package-desc-full-name) - ;; emacs 24.4 - (package-delete id) - ;; emacs 24.3 - (package-delete (symbol-name (car id)) - (package-version-join (cdr id))))) - (error (message (cadr err)))) - and collect (if (fboundp 'package-desc-full-name) - id - (cons (symbol-name (car id)) - (package-version-join (cdr id)))) into delete-list - finally do (if (fboundp 'package-desc-full-name) - ;; emacs 24.4 - (message (format "%d packages deleted:\n(%s)" - (length delete-list) - (mapconcat #'package-desc-full-name - delete-list ", "))) - ;; emacs 24.3 - (message (format "%d packages deleted:\n(%s)" - (length delete-list) - (mapconcat (lambda (x) - (concat (car x) "-" (cdr x))) - delete-list ", "))) - ;; emacs 24.3 doesn't update - ;; its `package-alist' after deleting. - (cl-loop for p in package-alist - when (assq (symbol-name (car p)) delete-list) - do (setq package-alist (delete p package-alist))))))) + (cl-loop with mkd = (helm-marked-candidates) + for p in mkd + for id = (get-text-property 0 'tabulated-list-id p) + do + (condition-case-unless-debug err + (with-no-warnings + (if (fboundp 'package-desc-full-name) + ;; emacs 24.4 + (package-delete id) + ;; emacs 24.3 + (package-delete (symbol-name (car id)) + (package-version-join (cdr id))))) + (error (message (cadr err)))) + and collect (if (fboundp 'package-desc-full-name) + id + (cons (symbol-name (car id)) + (package-version-join (cdr id)))) into delete-list + finally do (if (fboundp 'package-desc-full-name) + ;; emacs 24.4 + (message (format "%d packages deleted:\n(%s)" + (length delete-list) + (mapconcat #'package-desc-full-name + delete-list ", "))) + ;; emacs 24.3 + (message (format "%d packages deleted:\n(%s)" + (length delete-list) + (mapconcat (lambda (x) + (concat (car x) "-" (cdr x))) + delete-list ", "))) + ;; emacs 24.3 doesn't update + ;; its `package-alist' after deleting. + (cl-loop for p in package-alist + when (assq (symbol-name (car p)) delete-list) + do (setq package-alist (delete p package-alist)))))) (defun helm-el-package--transformer (candidates _source) (cl-loop for c in candidates - for id = (get-text-property 0 'tabulated-list-id c) - for installed-p = (assq (if (fboundp 'package-desc-name) - (package-desc-name id) - (car id)) - package-alist) - for cand = (cons c (car (split-string c))) - when (or (and installed-p - (eq helm-el-package--show-only 'installed)) - (and (not installed-p) - (eq helm-el-package--show-only 'uninstalled)) - (eq helm-el-package--show-only 'all)) - collect cand)) + for id = (get-text-property 0 'tabulated-list-id c) + for installed-p = (assq (if (fboundp 'package-desc-name) + (package-desc-name id) + (car id)) + package-alist) + for cand = (cons c (car (split-string c))) + when (or (and installed-p + (eq helm-el-package--show-only 'installed)) + (and (not installed-p) + (eq helm-el-package--show-only 'uninstalled)) + (eq helm-el-package--show-only 'all)) + collect cand)) (defun helm-el-package-show-installed () (interactive) diff --git a/helm-elisp.el b/helm-elisp.el index 8aa47305d..c5cf26379 100644 --- a/helm-elisp.el +++ b/helm-elisp.el @@ -48,8 +48,8 @@ This is used in macro `with-helm-show-completion'." (defcustom helm-lisp-quoted-function-list '(funcall apply mapc cl-mapc mapcar cl-mapcar - callf callf2 cl-callf cl-callf2 fset - fboundp fmakunbound symbol-function) + callf callf2 cl-callf cl-callf2 fset + fboundp fmakunbound symbol-function) "List of function where quoted function completion happen. e.g give only function names after \(funcall '." :group 'helm-elisp @@ -67,12 +67,12 @@ e.g give only function names after \(function ." ;; ;; (defface helm-lisp-show-completion - '((t (:background "DarkSlateGray"))) + '((t (:background "DarkSlateGray"))) "Face used for showing candidates in `helm-lisp-completion'." :group 'helm-elisp) (defface helm-lisp-completion-info - '((t (:foreground "red"))) + '((t (:foreground "red"))) "Face used for showing info in `helm-lisp-completion'." :group 'helm-elisp) @@ -130,9 +130,9 @@ If `helm-turn-on-show-completion' is nil just do nothing." 'helm-show-completion-display-function 'helm-default-display-buffer)))) (unwind-protect - (progn - (helm-show-completion-init-overlay ,beg ,end) - ,@body) + (progn + (helm-show-completion-init-overlay ,beg ,end) + ,@body) (when (and helm-turn-on-show-completion helm-show-completion-overlay (overlayp helm-show-completion-overlay)) @@ -240,10 +240,10 @@ Return a cons \(beg . end\)." (member 'helm-compile-source--match-plugin helm-compile-source-functions))) (setq helm-lisp-completion--cache (cl-loop for sym in candidates - for len = (length sym) - when (> len helm-lgst-len) - do (setq helm-lgst-len len) - collect sym)) + for len = (length sym) + when (> len helm-lgst-len) + do (setq helm-lgst-len len) + collect sym)) (if candidates (with-helm-show-completion beg end ;; Overlay is initialized now in helm-current-buffer. @@ -281,15 +281,15 @@ Return a cons \(beg . end\)." (defun helm-lisp-completion-transformer (candidates _source) "Helm candidates transformer for lisp completion." (cl-loop for c in candidates - for sym = (intern c) - for annot = (cl-typecase sym - (command " (Com)") - (fbound " (Fun)") - (bound " (Var)") - (face " (Face)")) - for spaces = (make-string (- helm-lgst-len (length c)) ? ) - collect (cons (concat c spaces annot) c) into lst - finally return (sort lst #'helm-generic-sort-fn))) + for sym = (intern c) + for annot = (cl-typecase sym + (command " (Com)") + (fbound " (Fun)") + (bound " (Var)") + (face " (Face)")) + for spaces = (make-string (- helm-lgst-len (length c)) ? ) + collect (cons (concat c spaces annot) c) into lst + finally return (sort lst #'helm-generic-sort-fn))) (defun helm-get-first-line-documentation (sym) "Return first line documentation of symbol SYM. @@ -388,11 +388,11 @@ First call indent, second complete symbol, third complete fname." (funcall test (intern default))) (insert (concat default "\n"))) (cl-loop with all = (all-completions "" obarray test) - for sym in all - for s = (intern sym) - unless (or (and default (string= sym default)) - (keywordp s)) - do (insert (concat sym "\n"))))) + for sym in all + for s = (intern sym) + unless (or (and default (string= sym default)) + (keywordp s)) + do (insert (concat sym "\n"))))) (defun helm-def-source--emacs-variables (&optional default) `((name . "Variables") @@ -413,7 +413,7 @@ First call indent, second complete symbol, third complete fname." (nomark) (filtered-candidate-transformer . (lambda (candidates _source) (cl-loop for c in candidates - collect (propertize c 'face (intern c))))) + collect (propertize c 'face (intern c))))) (action . (lambda (candidate) (describe-face (intern candidate)))))) @@ -494,18 +494,18 @@ First call indent, second complete symbol, third complete fname." (defun helm-advice-candidates () (cl-loop for (fname) in ad-advised-functions - for function = (intern fname) - append - (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 - "%s %s %s" - (if enabled "Enabled " "Disabled") - (propertize fname 'face 'font-lock-function-name-face) - (ad-make-single-advice-docstring advice class nil)) - (list function class advice)))))) + for function = (intern fname) + append + (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 + "%s %s %s" + (if enabled "Enabled " "Disabled") + (propertize fname 'face 'font-lock-function-name-face) + (ad-make-single-advice-docstring advice class nil)) + (list function class advice)))))) (defun helm-advice-persistent-action (func-class-advice) (if current-prefix-arg @@ -564,10 +564,10 @@ First call indent, second complete symbol, third complete fname." (defun helm-locate-library-scan-list () (cl-loop for dir in load-path - when (file-directory-p dir) - append (directory-files dir t (regexp-opt (get-load-suffixes))) - into lst - finally return (helm-fast-remove-dups lst :test 'equal))) + when (file-directory-p dir) + append (directory-files dir t (regexp-opt (get-load-suffixes))) + into lst + finally return (helm-fast-remove-dups lst :test 'equal))) ;;;###autoload (defun helm-locate-library () @@ -594,26 +594,26 @@ First call indent, second complete symbol, third complete fname." ("Trace function (background)" . trace-function-background) ("Untrace function" . untrace-function)))) (define-helm-type-attribute 'command - `((action ("Call interactively" . helm-call-interactively) - ,@actions) - (coerce . helm-symbolify) - (persistent-action . describe-function)) + `((action ("Call interactively" . helm-call-interactively) + ,@actions) + (coerce . helm-symbolify) + (persistent-action . describe-function)) "Command. (string or symbol)") (define-helm-type-attribute 'function - `((action . ,actions) - (action-transformer helm-transform-function-call-interactively) - (candidate-transformer helm-mark-interactive-functions) - (coerce . helm-symbolify)) + `((action . ,actions) + (action-transformer helm-transform-function-call-interactively) + (candidate-transformer helm-mark-interactive-functions) + (coerce . helm-symbolify)) "Function. (string or symbol)")) (define-helm-type-attribute 'variable - '((action - ("Describe variable" . describe-variable) - ("Add variable to kill ring" . helm-kill-new) - ("Go to variable's definition" . find-variable) - ("Set variable" . helm-set-variable)) - (coerce . helm-symbolify)) + '((action + ("Describe variable" . describe-variable) + ("Add variable to kill ring" . helm-kill-new) + ("Go to variable's definition" . find-variable) + ("Set variable" . helm-set-variable)) + (coerce . helm-symbolify)) "Variable.") (defun helm-sexp-eval (cand) @@ -623,26 +623,26 @@ First call indent, second complete symbol, third complete fname." nil))) (define-helm-type-attribute 'sexp - '((action - ("Eval" . helm-sexp-eval) - ("Edit and eval" . - (lambda (cand) - (let ((minibuffer-setup-hook - (cons (lambda () (insert cand)) minibuffer-setup-hook))) - (call-interactively #'eval-expression))))) - (persistent-action . helm-sexp-eval)) + '((action + ("Eval" . helm-sexp-eval) + ("Edit and eval" . + (lambda (cand) + (let ((minibuffer-setup-hook + (cons (lambda () (insert cand)) minibuffer-setup-hook))) + (call-interactively #'eval-expression))))) + (persistent-action . helm-sexp-eval)) "Sexp.") (define-helm-type-attribute 'timer - '((action - ("Cancel Timer" . (lambda (_timer) - (let ((mkd (helm-marked-candidates))) - (cl-loop for timer in mkd - do (cancel-timer timer))))) - ("Describe Function" . (lambda (tm) (describe-function (timer--function tm)))) - ("Find Function" . (lambda (tm) (find-function (timer--function tm))))) - (persistent-action . (lambda (tm) (describe-function (timer--function tm)))) - (persistent-help . "Describe Function")) + '((action + ("Cancel Timer" . (lambda (_timer) + (let ((mkd (helm-marked-candidates))) + (cl-loop for timer in mkd + do (cancel-timer timer))))) + ("Describe Function" . (lambda (tm) (describe-function (timer--function tm)))) + ("Find Function" . (lambda (tm) (find-function (timer--function tm))))) + (persistent-action . (lambda (tm) (describe-function (timer--function tm)))) + (persistent-help . "Describe Function")) "Timer.") @@ -655,7 +655,7 @@ First call indent, second complete symbol, third complete fname." (filtered-candidate-transformer . (lambda (candidates _source) (cl-loop for timer in candidates - collect (cons (helm-elisp--format-timer timer) timer)))) + collect (cons (helm-elisp--format-timer timer) timer)))) (allow-dups) (volatile) (type . timer))) @@ -668,7 +668,7 @@ First call indent, second complete symbol, third complete fname." (filtered-candidate-transformer . (lambda (candidates _source) (cl-loop for timer in candidates - collect (cons (helm-elisp--format-timer timer) timer)))) + collect (cons (helm-elisp--format-timer timer) timer)))) (type . timer))) (defun helm-elisp--format-timer (timer) diff --git a/helm-elscreen.el b/helm-elscreen.el index 92fa5a747..c13e1ed6b 100644 --- a/helm-elscreen.el +++ b/helm-elscreen.el @@ -46,21 +46,21 @@ (if (cdr (elscreen-get-screen-to-name-alist)) (sort (cl-loop for sname in (elscreen-get-screen-to-name-alist) - append (list (format "[%d] %s" (car sname) (cdr sname)))) + append (list (format "[%d] %s" (car sname) (cdr sname)))) #'(lambda (a b) (compare-strings a nil nil b nil nil)))))) (action . (("Change Screen" . - (lambda (candidate) - (elscreen-goto (- (aref candidate 1) (aref "0" 0))))) + (lambda (candidate) + (elscreen-goto (- (aref candidate 1) (aref "0" 0))))) ("Kill Screen(s)" . - (lambda (candidate) - (cl-dolist (i (helm-marked-candidates)) - (elscreen-goto (- (aref i 1) (aref "0" 0))) - (elscreen-kill)))) + (lambda (candidate) + (cl-dolist (i (helm-marked-candidates)) + (elscreen-goto (- (aref i 1) (aref "0" 0))) + (elscreen-kill)))) ("Only Screen" . - (lambda (candidate) - (elscreen-goto (- (aref candidate 1) (aref "0" 0))) - (elscreen-kill-others))))))) + (lambda (candidate) + (elscreen-goto (- (aref candidate 1) (aref "0" 0))) + (elscreen-kill-others))))))) ;;;###autoload (defun helm-elscreen () diff --git a/helm-emms.el b/helm-emms.el index acb4fcc5f..329292589 100644 --- a/helm-emms.el +++ b/helm-emms.el @@ -36,7 +36,7 @@ :group 'helm) (defface helm-emms-playlist - '((t (:foreground "Springgreen4" :underline t))) + '((t (:foreground "Springgreen4" :underline t))) "Face used for tracks in current emms playlist." :group 'helm-emms) @@ -68,7 +68,7 @@ "Delete emms-streams bookmarks from helm." (let* ((cands (helm-marked-candidates)) (bmks (cl-loop for bm in cands collect - (car (assoc bm emms-stream-list)))) + (car (assoc bm emms-stream-list)))) (bmk-reg (mapconcat 'regexp-quote bmks "\\|^"))) (when (y-or-n-p (format "Really delete radios\n -%s: ? " (mapconcat 'identity bmks "\n -"))) @@ -76,11 +76,11 @@ (emms-streams) (goto-char (point-min)) (cl-loop while (re-search-forward bmk-reg nil t) - do (progn (forward-line 0) - (emms-stream-delete-bookmark)) - finally do (progn - (emms-stream-save-bookmarks-file) - (emms-stream-quit))))))) + do (progn (forward-line 0) + (emms-stream-delete-bookmark)) + finally do (progn + (emms-stream-save-bookmarks-file) + (emms-stream-quit))))))) (defvar helm-source-emms-streams '((name . "Emms Streams") @@ -103,27 +103,27 @@ (candidates . (lambda () (cddr (directory-files emms-source-file-default-directory)))) (action . - (("Play Directory" . (lambda (item) - (emms-play-directory - (expand-file-name - item - emms-source-file-default-directory)))) - ("Open dired in file's directory" . (lambda (item) - (helm-open-dired - (expand-file-name - item - emms-source-file-default-directory)))))) + (("Play Directory" . (lambda (item) + (emms-play-directory + (expand-file-name + item + emms-source-file-default-directory)))) + ("Open dired in file's directory" . (lambda (item) + (helm-open-dired + (expand-file-name + item + emms-source-file-default-directory)))))) (filtered-candidate-transformer . helm-adaptive-sort))) (defvar helm-emms-current-playlist nil) (defun helm-emms-files-modifier (candidates _source) (cl-loop for i in candidates - if (member (cdr i) helm-emms-current-playlist) - collect (cons (propertize (car i) - 'face 'helm-emms-playlist) - (cdr i)) into lis - else collect i into lis - finally return (reverse lis))) + if (member (cdr i) helm-emms-current-playlist) + collect (cons (propertize (car i) + 'face 'helm-emms-playlist) + (cdr i)) into lis + else collect i into lis + finally return (reverse lis))) (defun helm-emms-play-current-playlist () "Play current playlist." @@ -137,20 +137,20 @@ (with-current-emms-playlist (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))))) + for i in cur-list + for name = (assoc-default 'name i) + when name + collect name))))) (candidates . (lambda () (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") - for tracknum = (or (assoc-default 'info-tracknumber v) "unknown") - for song = (or (assoc-default 'info-title v) "unknown") - for info = (concat artist " - " genre " - " tracknum ": " song) - unless (string-match "^\\(http\\|mms\\):" name) - collect (cons info name)))) + for name = (assoc-default 'name v) + for artist = (or (assoc-default 'info-artist v) "unknown") + for genre = (or (assoc-default 'info-genre v) "unknown") + for tracknum = (or (assoc-default 'info-tracknumber v) "unknown") + for song = (or (assoc-default 'info-title v) "unknown") + for info = (concat artist " - " genre " - " tracknum ": " song) + unless (string-match "^\\(http\\|mms\\):" name) + collect (cons info name)))) (filtered-candidate-transformer . helm-emms-files-modifier) (candidate-number-limit . 9999) (action . (("Play file" . emms-play-file) diff --git a/helm-eshell.el b/helm-eshell.el index d79bdeb57..eae44b4d7 100644 --- a/helm-eshell.el +++ b/helm-eshell.el @@ -61,12 +61,12 @@ (filtered-candidate-transformer (lambda (candidates _sources) (cl-loop for i in (sort candidates 'helm-generic-sort-fn) - collect - (cond ((string-match "\\`~/?" helm-ec-target) - (abbreviate-file-name i)) - ((string-match "\\`/" helm-ec-target) i) - (t - (file-relative-name i)))))) + collect + (cond ((string-match "\\`~/?" helm-ec-target) + (abbreviate-file-name i)) + ((string-match "\\`/" helm-ec-target) i) + (t + (file-relative-name i)))))) (action . helm-ec-insert)) "Helm source for Eshell completion.") @@ -103,43 +103,43 @@ The function that call this should set `helm-ec-target' to thing at point." (pcomplete-entries)) helm-pattern))) (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 - (expand-file-name entry default-directory))) - for i in (all-completions pcomplete-stub table) - ;; Transform the related names to abs names. - for file-cand = (and exp-entry - (if (file-remote-p i) i - (expand-file-name - i (file-name-directory entry)))) - ;; Compare them to avoid dups. - for file-entry-p = (and (stringp exp-entry) - (stringp file-cand) - ;; Fix :/tmp/foo/ $ cd foo - (not (file-directory-p file-cand)) - (file-equal-p exp-entry file-cand)) - if (and file-cand (or (file-remote-p file-cand) - (file-exists-p file-cand)) - (not file-entry-p)) - collect file-cand into ls - else - ;; Avoid adding entry here. - unless file-entry-p collect i into ls - finally return - (if (and exp-entry - (file-directory-p exp-entry) - ;; If the car of completion list is - ;; an executable, probably we are in - ;; command completion, so don't add a - ;; possible file related entry here. - (and ls (not (executable-find (car ls)))) - ;; Don't add entry if already in prompt. - (not (file-equal-p exp-entry pcomplete-stub))) - (append (list exp-entry) - ;; Entry should not be here now but double check. - (remove entry ls)) - ls)))))) + with exp-entry = (and (stringp entry) + (not (string= entry "")) + (file-name-as-directory + (expand-file-name entry default-directory))) + for i in (all-completions pcomplete-stub table) + ;; Transform the related names to abs names. + for file-cand = (and exp-entry + (if (file-remote-p i) i + (expand-file-name + i (file-name-directory entry)))) + ;; Compare them to avoid dups. + for file-entry-p = (and (stringp exp-entry) + (stringp file-cand) + ;; Fix :/tmp/foo/ $ cd foo + (not (file-directory-p file-cand)) + (file-equal-p exp-entry file-cand)) + if (and file-cand (or (file-remote-p file-cand) + (file-exists-p file-cand)) + (not file-entry-p)) + collect file-cand into ls + else + ;; Avoid adding entry here. + unless file-entry-p collect i into ls + finally return + (if (and exp-entry + (file-directory-p exp-entry) + ;; If the car of completion list is + ;; an executable, probably we are in + ;; command completion, so don't add a + ;; possible file related entry here. + (and ls (not (executable-find (car ls)))) + ;; Don't add entry if already in prompt. + (not (file-equal-p exp-entry pcomplete-stub))) + (append (list exp-entry) + ;; Entry should not be here now but double check. + (remove entry ls)) + ls)))))) ;;; Eshell history. ;; @@ -216,11 +216,11 @@ The function that call this should set `helm-ec-target' to thing at point." (setq flag-empty t) (setq end (point))) (unwind-protect - (with-helm-show-completion beg end - (helm :sources 'helm-source-eshell-history - :buffer "*helm eshell history*" - :resume 'noresume - :input input)) + (with-helm-show-completion beg end + (helm :sources 'helm-source-eshell-history + :buffer "*helm eshell history*" + :resume 'noresume + :input input)) (when (and flag-empty (looking-back " ")) (delete-char -1))))) diff --git a/helm-eval.el b/helm-eval.el index 9fbf0eee4..98d88877f 100644 --- a/helm-eval.el +++ b/helm-eval.el @@ -153,9 +153,9 @@ Should take one arg: the string to display." eldoc-idle-delay 'repeat 'helm-eldoc-show-in-eval))) (unwind-protect - (minibuffer-with-setup-hook - 'helm-eldoc-store-minibuffer - (call-interactively 'helm-eval-expression)) + (minibuffer-with-setup-hook + 'helm-eldoc-store-minibuffer + (call-interactively 'helm-eval-expression)) (and timer (cancel-timer timer)) (setq helm-eldoc-active-minibuffers-list (cdr helm-eldoc-active-minibuffers-list))))) diff --git a/helm-external.el b/helm-external.el index 69379a6cb..7d19e65cf 100644 --- a/helm-external.el +++ b/helm-external.el @@ -66,17 +66,17 @@ and sets `helm-external-commands-list'." it (setq helm-external-commands-list (cl-loop - for dir in (split-string (getenv "PATH") path-separator) - when (and (file-exists-p dir) (file-accessible-directory-p dir)) - 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)) - (file-executable-p i)) - collect bn) - append lsdir into completions - finally return - (if sort (sort completions 'string-lessp) completions))))) + for dir in (split-string (getenv "PATH") path-separator) + when (and (file-exists-p dir) (file-accessible-directory-p dir)) + 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)) + (file-executable-p i)) + collect bn) + append lsdir into completions + finally return + (if sort (sort completions 'string-lessp) completions))))) (defun helm-run-or-raise (exe &optional file) "Generic command that run asynchronously EXE. @@ -181,7 +181,7 @@ If not found or a prefix arg is given query the user which tool to use." (cons real-prog-name (delete real-prog-name (cl-loop for i in helm-external-command-history - when (executable-find i) collect i)))))) + when (executable-find i) collect i)))))) ;;;###autoload (defun helm-run-external-command (program) @@ -201,7 +201,7 @@ You can set your own list of commands with (setq helm-external-command-history (cons program (delete program (cl-loop for i in helm-external-command-history - when (executable-find i) collect i))))) + when (executable-find i) collect i))))) (provide 'helm-external) diff --git a/helm-files.el b/helm-files.el index e68b7ee83..bcc46e39e 100644 --- a/helm-files.el +++ b/helm-files.el @@ -53,32 +53,32 @@ ;; ;; (define-helm-type-attribute 'file - `((action - ("Find file" . helm-find-many-files) - ("Find file as root" . helm-find-file-as-root) - ("Find file other window" . find-file-other-window) - ("Find file other frame" . find-file-other-frame) - ("Open dired in file's directory" . helm-open-dired) - ("Grep File(s) `C-u recurse'" . helm-find-files-grep) - ("Zgrep File(s) `C-u Recurse'" . helm-ff-zgrep) - ("Pdfgrep File(s)" . helm-ff-pdfgrep) - ("Insert as org link" . helm-files-insert-as-org-link) - ("Checksum File" . helm-ff-checksum) - ("Ediff File" . helm-find-files-ediff-files) - ("Ediff Merge File" . helm-find-files-ediff-merge-files) - ("Etags `M-., C-u tap, C-u C-u reload tag file'" . helm-ff-etags-select) - ("View file" . view-file) - ("Insert file" . insert-file) - ("Delete file(s)" . helm-delete-marked-files) - ("Open file externally (C-u to choose)" . helm-open-file-externally) - ("Open file with default tool" . helm-open-file-with-default-tool) - ("Find file in hex dump" . hexl-find-file)) - (persistent-help . "Show this file") - (action-transformer helm-transform-file-load-el - helm-transform-file-browse-url) - (candidate-transformer helm-skip-boring-files - helm-highlight-files - helm-w32-pathname-transformer)) + `((action + ("Find file" . helm-find-many-files) + ("Find file as root" . helm-find-file-as-root) + ("Find file other window" . find-file-other-window) + ("Find file other frame" . find-file-other-frame) + ("Open dired in file's directory" . helm-open-dired) + ("Grep File(s) `C-u recurse'" . helm-find-files-grep) + ("Zgrep File(s) `C-u Recurse'" . helm-ff-zgrep) + ("Pdfgrep File(s)" . helm-ff-pdfgrep) + ("Insert as org link" . helm-files-insert-as-org-link) + ("Checksum File" . helm-ff-checksum) + ("Ediff File" . helm-find-files-ediff-files) + ("Ediff Merge File" . helm-find-files-ediff-merge-files) + ("Etags `M-., C-u tap, C-u C-u reload tag file'" . helm-ff-etags-select) + ("View file" . view-file) + ("Insert file" . insert-file) + ("Delete file(s)" . helm-delete-marked-files) + ("Open file externally (C-u to choose)" . helm-open-file-externally) + ("Open file with default tool" . helm-open-file-with-default-tool) + ("Find file in hex dump" . hexl-find-file)) + (persistent-help . "Show this file") + (action-transformer helm-transform-file-load-el + helm-transform-file-browse-url) + (candidate-transformer helm-skip-boring-files + helm-highlight-files + helm-w32-pathname-transformer)) "File name.") @@ -236,42 +236,42 @@ WARNING: Setting this to nil is unsafe and can cause deletion of a whole tree." ;; ;; (defface helm-ff-prefix - '((t (:background "yellow" :foreground "black"))) + '((t (:background "yellow" :foreground "black"))) "Face used to prefix new file or url paths in `helm-find-files'." :group 'helm-files) (defface helm-ff-executable - '((t (:foreground "green"))) + '((t (:foreground "green"))) "Face used for executable files in `helm-find-files'." :group 'helm-files) (defface helm-ff-directory - '((t (:foreground "DarkRed" :background "LightGray"))) + '((t (:foreground "DarkRed" :background "LightGray"))) "Face used for directories in `helm-find-files'." :group 'helm-files) (defface helm-ff-symlink - '((t (:foreground "DarkOrange"))) + '((t (:foreground "DarkOrange"))) "Face used for symlinks in `helm-find-files'." :group 'helm-files) (defface helm-ff-invalid-symlink - '((t (:foreground "black" :background "red"))) + '((t (:foreground "black" :background "red"))) "Face used for invalid symlinks in `helm-find-files'." :group 'helm-files) (defface helm-ff-file - '((t (:inherit font-lock-builtin-face))) + '((t (:inherit font-lock-builtin-face))) "Face used for file names in `helm-find-files'." :group 'helm-files) (defface helm-history-deleted - '((t (:inherit helm-ff-invalid-symlink))) + '((t (:inherit helm-ff-invalid-symlink))) "Face used for deleted files in `file-name-history'." :group 'helm-files) (defface helm-history-remote - '((t (:foreground "Indianred1"))) + '((t (:foreground "Indianred1"))) "Face used for remote files in `file-name-history'." :group 'helm-files) @@ -517,13 +517,13 @@ ACTION must be an action supported by `helm-dired-action'." (let ((files (helm-marked-candidates :with-wildcard t)) (parg helm-current-prefix-arg)) (cl-loop for fname in files - do (byte-compile-file fname parg)))) + 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 :with-wildcard t))) (cl-loop for fname in files - do (load fname)))) + do (load fname)))) (defun helm-find-files-ediff-files-1 (candidate &optional merge) "Generic function to ediff/merge files in `helm-find-files'." @@ -565,9 +565,9 @@ 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 (cl-loop for file in (helm-marked-candidates :with-wildcard t) - if (or (string= (file-name-extension file) "pdf") - (string= (file-name-extension file) "PDF")) - collect file)) + if (or (string= (file-name-extension file) "pdf") + (string= (file-name-extension file) "PDF")) + collect file)) (helm-pdfgrep-default-function 'helm-pdfgrep-init)) (when cands (helm-do-pdfgrep-1 cands)))) @@ -628,9 +628,9 @@ will not be loaded first time you use this." (command (helm-comp-read "Command: " (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<)) + when (string-match "\\(\\$1\\|\\$\\*\\)$" (car c)) + collect (propertize a 'help-echo (car c)) into ls + finally return (sort ls 'string<)) :buffer "*helm eshell on file*" :name "Eshell command" :keymap helm-esh-on-file-map @@ -673,13 +673,13 @@ will not be loaded first time you use this." ;; Run eshell-command on EACH marked files. (cl-loop for i in cand-list - for files = (format "'%s'" i) - for com = (if (string-match "'%s'\\|\"%s\"\\|%s" command) - ;; [1] This allow to enter other args AFTER filename - ;; i.e - (format command files) - (format "%s %s" command files)) - do (eshell-command com)))))) + for files = (format "'%s'" i) + for com = (if (string-match "'%s'\\|\"%s\"\\|%s" command) + ;; [1] This allow to enter other args AFTER filename + ;; i.e + (format command files) + (format "%s %s" command files)) + do (eshell-command com)))))) (defun helm-find-files-eshell-command-on-file (_candidate) "Run `eshell-command' on CANDIDATE or marked candidates. @@ -766,30 +766,30 @@ Default METHOD is rename." (t (error "Error: Unknown method %s" method))))) (make-directory tmp-dir) (unwind-protect - (progn - ;; Rename all files to tmp-dir with new-name. - ;; If files are not from start directory, use method - ;; to move files to tmp-dir. - (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) - (if (not (string= extension "")) - (format ".%s" (replace-regexp-in-string - "[.]" "" extension)) - (file-name-extension i 'dot))) - do (if (helm-ff-member-directory-p i directory) - (rename-file i nname) - (funcall fn i nname))) - ;; Now move all from tmp-dir to destination. - (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) - (make-symbolic-link (file-truename f) - (concat (file-name-as-directory directory) - (helm-basename f))) - (rename-file f directory)))) + (progn + ;; Rename all files to tmp-dir with new-name. + ;; If files are not from start directory, use method + ;; to move files to tmp-dir. + (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) + (if (not (string= extension "")) + (format ".%s" (replace-regexp-in-string + "[.]" "" extension)) + (file-name-extension i 'dot))) + do (if (helm-ff-member-directory-p i directory) + (rename-file i nname) + (funcall fn i nname))) + ;; Now move all from tmp-dir to destination. + (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) + (make-symbolic-link (file-truename f) + (concat (file-name-as-directory directory) + (helm-basename f))) + (rename-file f directory)))) (delete-directory tmp-dir t)))) (defun helm-ff-serial-rename (_candidate) @@ -1055,7 +1055,7 @@ The checksum is copied to kill-ring." (helm-comp-read "Algorithm: " '(md5 sha1 sha224 - sha256 sha384 sha512)))))) + sha256 sha384 sha512)))))) (kill-new (if algo (with-temp-buffer @@ -1118,7 +1118,7 @@ You should not modify this yourself unless you know what you do.") (or (with-helm-buffer helm-in-file-completion-p) (let ((cur-source (cdr (assoc 'name (helm-get-current-source))))) (cl-loop for i in helm-file-completion-sources - thereis (string= cur-source i))))) + thereis (string= cur-source i))))) (defun helm-find-files-down-one-level (arg) "Go down one level like unix command `cd ..'. @@ -1289,7 +1289,7 @@ On windows system substitute from start up to \"/[a-z]:/\"." "Build filename for `helm-pattern' like /su:: or /sudo::." (apply #'tramp-make-tramp-file-name (cl-loop with v = (tramp-dissect-file-name fname) - for i across v collect i))) + for i across v collect i))) (cl-defun helm-ff-tramp-hostnames (&optional (pattern helm-pattern)) "Get a list of hosts for tramp method found in `helm-pattern'. @@ -1301,10 +1301,10 @@ purpose." (all-methods (mapcar 'car tramp-methods))) (helm-fast-remove-dups (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))) + 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))) :test 'equal)))) (defun helm-ff-before-action-hook-fn () @@ -1464,10 +1464,10 @@ systems." (defun helm-ff-handle-backslash (fname) ;; Allow creation of filenames containing a backslash. (cl-loop with bad = '((92 . "")) - for i across fname - for isbad = (assq i bad) - if isbad concat (cdr isbad) - else concat (string i))) + for i across fname + for isbad = (assq i bad) + if isbad concat (cdr isbad) + else concat (string i))) (defun helm-ff-smart-completion-p () (and helm-ff-smart-completion @@ -1488,7 +1488,7 @@ If FNAME is a valid directory name,return FNAME unchanged." (bd (or (helm-basedir fname) "")) (dir-p (file-directory-p fname)) (tramp-p (cl-loop for (m . f) in tramp-methods - thereis (string-match m fname)))) + thereis (string-match m fname)))) ;; Always regexp-quote base directory name to handle ;; crap dirnames such e.g bookmark+ (cond (dir-p (regexp-quote fname)) @@ -1550,15 +1550,15 @@ Note that only directories are saved here." (let ((mkd (helm-marked-candidates)) (history-delete-duplicates t)) (cl-loop for sel in mkd - when (and sel - (file-exists-p sel) - (not (file-directory-p sel))) - do - ;; we use `abbreviate-file-name' here because - ;; other parts of Emacs seems to, - ;; and we don't want to introduce duplicates. - (add-to-history 'file-name-history - (abbreviate-file-name sel))))))) + when (and sel + (file-exists-p sel) + (not (file-directory-p sel))) + do + ;; we use `abbreviate-file-name' here because + ;; other parts of Emacs seems to, + ;; and we don't want to introduce duplicates. + (add-to-history 'file-name-history + (abbreviate-file-name sel))))))) (add-hook 'helm-exit-minibuffer-hook 'helm-files-save-file-name-history) (defun helm-ff-valid-symlink-p (file) @@ -1567,7 +1567,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 (cl-loop for (r . m) in auto-mode-alist - thereis (and (string-match r filename) m)))) + thereis (and (string-match r filename) m)))) (or (and (symbolp mode) mode) "Fundamental"))) (defun helm-ff-properties (candidate) @@ -1635,14 +1635,14 @@ Note that only directories are saved here." (let ((marked (helm-marked-candidates))) (save-selected-window (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)) - (when (y-or-n-p (format "Really Delete file `%s'? " c)) - (helm-delete-file c helm-ff-signal-error-on-dot-files - 'synchro) - (helm-delete-current-selection) - (message nil))))) + (progn (helm-preselect (if (and helm-ff-transformer-show-only-basename + (not (helm-ff-dot-file-p c))) + (helm-basename c) c)) + (when (y-or-n-p (format "Really Delete file `%s'? " c)) + (helm-delete-file c helm-ff-signal-error-on-dot-files + 'synchro) + (helm-delete-current-selection) + (message nil))))) (with-helm-buffer (setq helm-marked-candidates nil helm-visible-mark-overlays nil)) @@ -1738,7 +1738,7 @@ Return candidates prefixed with basename of `helm-input' first." ;; Handle boring files (unless (and helm-ff-skip-boring-files (cl-loop for r in helm-boring-file-regexp-list - thereis (string-match r file))) + thereis (string-match r file))) ;; Handle tramp files. (if (and (string-match helm-tramp-file-name-regexp helm-pattern) helm-ff-tramp-not-fancy) @@ -2068,7 +2068,7 @@ Use it for non--interactive calls of `helm-find-files'." (when (and (stringp he) (string-match "^LINK: " he)) (setq he (replace-match "" t t he))) (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)))) + thereis (and (stringp i) ffap-url-regexp (string-match ffap-url-regexp i) i)))) (defun helm-find-library-at-point () "Try to find library path at point. @@ -2144,16 +2144,16 @@ Argument FOLLOW when non--nil specify to follow FILES to destination." (when (and follow (not (get-buffer dired-log-buffer))) (let ((target (directory-file-name candidate))) (unwind-protect - (progn - (setq helm-ff-cand-to-mark - (helm-get-dest-fnames-from-list files candidate dirflag)) - (with-helm-after-update-hook (helm-ff-maybe-mark-candidates)) - (if (and dirflag (eq action 'rename)) - (helm-find-files-1 (file-name-directory target) - (if helm-ff-transformer-show-only-basename - (helm-basename target) target)) - (helm-find-files-1 (file-name-as-directory - (expand-file-name candidate))))) + (progn + (setq helm-ff-cand-to-mark + (helm-get-dest-fnames-from-list files candidate dirflag)) + (with-helm-after-update-hook (helm-ff-maybe-mark-candidates)) + (if (and dirflag (eq action 'rename)) + (helm-find-files-1 (file-name-directory target) + (if helm-ff-transformer-show-only-basename + (helm-basename target) target)) + (helm-find-files-1 (file-name-as-directory + (expand-file-name candidate))))) (setq helm-ff-cand-to-mark nil)))))) (defun helm-get-dest-fnames-from-list (flist dest-cand rename-dir-flag) @@ -2163,16 +2163,16 @@ members of FLIST." ;; At this point files have been renamed/copied at destination. ;; That's mean DEST-CAND exists. (cl-loop - with dest = (expand-file-name dest-cand) - for src in flist - for basename-src = (helm-basename src) - for fname = (cond (rename-dir-flag (directory-file-name dest)) - ((file-directory-p dest) - (concat (file-name-as-directory dest) basename-src)) - (t dest)) - when (file-exists-p fname) - collect fname into tmp-list - finally return (sort tmp-list 'string<))) + with dest = (expand-file-name dest-cand) + for src in flist + for basename-src = (helm-basename src) + for fname = (cond (rename-dir-flag (directory-file-name dest)) + ((file-directory-p dest) + (concat (file-name-as-directory dest) basename-src)) + (t dest)) + when (file-exists-p fname) + collect fname into tmp-list + finally return (sort tmp-list 'string<))) (defun helm-ff-maybe-mark-candidates () "Mark all candidates of list `helm-ff-cand-to-mark'. @@ -2199,10 +2199,10 @@ following files to destination." (defun helm-file-buffers (filename) "Returns a list of buffer names corresponding to FILENAME." (cl-loop with name = (expand-file-name filename) - for buf in (buffer-list) - for bfn = (buffer-file-name buf) - when (and bfn (string= name bfn)) - collect (buffer-name buf))) + for buf in (buffer-list) + for bfn = (buffer-file-name buf) + when (and bfn (string= name bfn)) + collect (buffer-name buf))) (defun helm-delete-file (file &optional error-if-dot-file-p synchro) "Delete the given file after querying the user. @@ -2337,10 +2337,10 @@ Else return ACTIONS unmodified." (defun helm-files-in-all-dired-candidates () (save-excursion (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) - (directory-files f t dired-re-no-dot)))))) + when (buffer-live-p b) + append (let ((dir (with-current-buffer b dired-directory))) + (if (listp dir) (cdr dir) + (directory-files f t dired-re-no-dot)))))) ;; (dired '("~/" "~/.emacs.d/.emacs-custom.el" "~/.emacs.d/.emacs.bmk")) @@ -2364,9 +2364,9 @@ Else return ACTIONS unmodified." (unless helm-file-cache-initialized-p (setq helm-file-cache-files (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))))) + (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))) (setq helm-file-cache-initialized-p t)))) @@ -2415,11 +2415,11 @@ Don't use it in your own code unless you know what you are doing.") (defun helm-file-name-history-transformer (candidates _source) (cl-loop for c in candidates collect - (cond ((file-remote-p c) - (cons (propertize c 'face 'helm-history-remote) c)) - ((file-exists-p c) - (cons (propertize c 'face 'helm-ff-file) c)) - (t (cons (propertize c 'face 'helm-history-deleted) c))))) + (cond ((file-remote-p c) + (cons (propertize c 'face 'helm-history-remote) c)) + ((file-exists-p c) + (cons (propertize c 'face 'helm-ff-file) c)) + (t (cons (propertize c 'face 'helm-history-deleted) c))))) (defun helm-ff-file-name-history () "Switch to `file-name-history' without quitting `helm-find-files'." @@ -2442,9 +2442,9 @@ Don't use it in your own code unless you know what you are doing.") (match . helm-files-match-only-basename) (filtered-candidate-transformer . (lambda (candidates _source) (cl-loop for i in candidates - if helm-ff-transformer-show-only-basename - collect (cons (helm-basename i) i) - else collect i))) + if helm-ff-transformer-show-only-basename + collect (cons (helm-basename i) i) + else collect i))) (keymap . ,helm-generic-files-map) (help-message . helm-generic-file-help-message) (mode-line . helm-generic-file-mode-line-string) @@ -2515,31 +2515,31 @@ and "A basic transformer for helm files sources. Colorize only symlinks, directories and 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 - (string-match ffap-url-regexp i))) - (not (string-match helm-ff-url-regexp i))) - (helm-basename i) i) - for type = (car (file-attributes i)) - collect - (cond ((and helm-ff-tramp-not-fancy - (string-match helm-tramp-file-name-regexp i)) - (cons disp i)) - ((stringp type) - (cons (propertize disp - 'face 'helm-ff-symlink - 'help-echo (expand-file-name i)) - i)) - ((eq type t) - (cons (propertize disp - 'face 'helm-ff-directory - 'help-echo (expand-file-name i)) - i)) - (t (cons (propertize disp - 'face 'helm-ff-file - 'help-echo (expand-file-name i)) - i))))) + for disp = (if (and helm-ff-transformer-show-only-basename + (not (helm-dir-is-dot i)) + (not (and ffap-url-regexp + (string-match ffap-url-regexp i))) + (not (string-match helm-ff-url-regexp i))) + (helm-basename i) i) + for type = (car (file-attributes i)) + collect + (cond ((and helm-ff-tramp-not-fancy + (string-match helm-tramp-file-name-regexp i)) + (cons disp i)) + ((stringp type) + (cons (propertize disp + 'face 'helm-ff-symlink + 'help-echo (expand-file-name i)) + i)) + ((eq type t) + (cons (propertize disp + 'face 'helm-ff-directory + 'help-echo (expand-file-name i)) + i)) + (t (cons (propertize disp + 'face 'helm-ff-file + 'help-echo (expand-file-name i)) + i))))) (defvar helm-source-files-in-current-dir `((name . "Files from Current Directory") @@ -2567,7 +2567,7 @@ Colorize only symlinks, directories and files." helm-pattern))) (filtered-candidate-transformer . (lambda (candidates _source) (cl-loop for cand in (cdr candidates) - collect (ansi-color-apply cand)))) + collect (ansi-color-apply cand)))) (action . ,(cdr (helm-get-attribute-from-type 'action 'file))) (action-transformer helm-transform-file-load-el @@ -2615,11 +2615,11 @@ utility mdfind.") (defun helm-findutils-transformer (candidates _source) (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))) - (helm-basename i) abs) - collect (cons (propertize disp 'face 'helm-ff-file) abs))) + 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))) + (helm-basename i) abs) + collect (cons (propertize disp 'face 'helm-ff-file) abs))) (defun helm-find-shell-command-fn () "Asynchronously fetch candidates for `helm-find'." diff --git a/helm-firefox.el b/helm-firefox.el index 4db715e5b..869a1c58b 100644 --- a/helm-firefox.el +++ b/helm-firefox.el @@ -89,9 +89,9 @@ (defun helm-highlight-firefox-bookmarks (bookmarks _source) (cl-loop for i in bookmarks - collect (propertize - i 'face '((:foreground "YellowGreen")) - 'help-echo (helm-firefox-bookmarks-get-value i)))) + collect (propertize + i 'face '((:foreground "YellowGreen")) + 'help-echo (helm-firefox-bookmarks-get-value i)))) ;;;###autoload (defun helm-firefox-bookmarks () diff --git a/helm-font.el b/helm-font.el index 446880e01..aaf455cc6 100644 --- a/helm-font.el +++ b/helm-font.el @@ -40,7 +40,7 @@ (let ((current-font (cdr (assoc 'font (frame-parameters)))) (default-font elm)) (unwind-protect - (progn (set-frame-font default-font 'keep-size) (sit-for 2)) + (progn (set-frame-font default-font 'keep-size) (sit-for 2)) (set-frame-font current-font)))) (defvar helm-xfonts-cache nil) @@ -67,11 +67,11 @@ (defun helm-calculate-ucs-max-len () "Calculate the length of longest `ucs-names' candidate." (cl-loop with count = 0 - for (n . v) in (ucs-names) - for len = (length n) - if (> len count) - do (setq count len) - finally return count)) + for (n . v) in (ucs-names) + for len = (length n) + if (> len count) + do (setq count len) + finally return count)) (defun helm-ucs-init () "Initialize an helm buffer with ucs symbols. @@ -84,19 +84,19 @@ Only math* symbols are collected." ;; `ucs-names' fn will not run again, data is cached in ;; var `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) - do (progn (insert (concat - n ":" - (make-string - diff ? ))) - (if (fboundp 'ucs-insert) - (ucs-insert v) - ;; call `insert-char' with nil nil - ;; to shutup byte compiler in 24.1. - (insert-char v nil nil)) - (insert "\n"))))) + for len = (length n) + for diff = (+ (- helm-ucs-max-len len) 2) + unless (string= "" n) + do (progn (insert (concat + n ":" + (make-string + diff ? ))) + (if (fboundp 'ucs-insert) + (ucs-insert v) + ;; call `insert-char' with nil nil + ;; to shutup byte compiler in 24.1. + (insert-char v nil nil)) + (insert "\n"))))) (defun helm-ucs-forward-char (_candidate) (with-helm-current-buffer diff --git a/helm-gentoo.el b/helm-gentoo.el index 075ea8c17..766ccb3e7 100644 --- a/helm-gentoo.el +++ b/helm-gentoo.el @@ -200,12 +200,12 @@ (call-process "eix" nil t nil elm "--format" "\n") (buffer-string))) - for i in url-list - when (and (string-match "^http://.*" i) - all - (not (member i all))) - collect i into all - finally return all)) + for i in url-list + when (and (string-match "^http://.*" i) + all + (not (member i all))) + collect i into all + finally return all)) (defun helm-gentoo-get-world () "Return list of all installed package on your system." @@ -225,18 +225,18 @@ (defun helm-highlight-world (eix) "Highlight all installed package." (cl-loop for i in eix - if (member i helm-cache-world) - collect (propertize i 'face 'helm-gentoo-match) - else - collect i)) + if (member i helm-cache-world) + collect (propertize i 'face 'helm-gentoo-match) + else + collect i)) (defun helm-highlight-local-use (use-flags) (let ((local-uses (helm-gentoo-get-local-use))) (cl-loop for i in use-flags - if (member i local-uses) - collect (propertize i 'face 'helm-gentoo-match) - else - collect i))) + if (member i local-uses) + collect (propertize i 'face 'helm-gentoo-match) + else + collect i))) ;;;###autoload (defun helm-gentoo () diff --git a/helm-grep.el b/helm-grep.el index ae6192fbe..8e20729c6 100644 --- a/helm-grep.el +++ b/helm-grep.el @@ -141,33 +141,33 @@ If set to nil `doc-view-mode' will be used instead of an external command." ;; ;; (defface helm-grep-match - '((t (:inherit match))) + '((t (:inherit match))) "Face used to highlight grep matches." :group 'helm-grep) (defface helm-grep-file - '((t (:foreground "BlueViolet" - :underline t))) + '((t (:foreground "BlueViolet" + :underline t))) "Face used to highlight grep results filenames." :group 'helm-grep) (defface helm-grep-lineno - '((t (:foreground "Darkorange1"))) + '((t (:foreground "Darkorange1"))) "Face used to highlight grep number lines." :group 'helm-grep) (defface helm-grep-running - '((t (:foreground "Red"))) + '((t (:foreground "Red"))) "Face used in mode line when grep is running." :group 'helm-grep) (defface helm-grep-finish - '((t (:foreground "Green"))) + '((t (:foreground "Green"))) "Face used in mode line when grep is finish." :group 'helm-grep) (defface helm-grep-cmd-line - '((t (:inherit diff-added))) + '((t (:inherit diff-added))) "Face used to highlight grep command line when no results." :group 'helm-grep) @@ -260,37 +260,37 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") ;; level recursion with ack-grep. ;; So I leave it as it is, considering it is a feature. [1] (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 or ack. - ((and (file-directory-p i) - (or helm-grep-in-recurse - ;; ack-grep accept directory [1]. - (helm-grep-use-ack-p))) - (list (expand-file-name i))) - ;; Grep doesn't support directory only when not in recurse. - ((file-directory-p i) - (file-expand-wildcards - (concat (file-name-as-directory (expand-file-name i)) "*") t)) - ;; Candidate is a file or wildcard and we use recursion, use the - ;; current directory instead of candidate. - ((and (or (file-exists-p i) (string-match "[*]" i)) - helm-grep-in-recurse) - (list (expand-file-name - (directory-file-name ; Needed for windoze. - (file-name-directory (directory-file-name i)))))) - ;; Else should be one or more file/directory - ;; possibly marked. - ;; When real is a normal filename without wildcard - ;; file-expand-wildcards returns a list of one file. - ;; wildcards should have been already handled by - ;; helm-read-file-name or helm-find-files but do it from - ;; here too in case we are called from elsewhere. - (t (file-expand-wildcards i t))) into all-files ; [1] - finally return - (if (string-match "^git" helm-grep-default-command) - (mapconcat 'identity all-files " ") - (mapconcat 'shell-quote-argument all-files " "))))) + (cond ((string-match "^git" helm-grep-default-command) + (list i)) + ;; Candidate is a directory and we use recursion or ack. + ((and (file-directory-p i) + (or helm-grep-in-recurse + ;; ack-grep accept directory [1]. + (helm-grep-use-ack-p))) + (list (expand-file-name i))) + ;; Grep doesn't support directory only when not in recurse. + ((file-directory-p i) + (file-expand-wildcards + (concat (file-name-as-directory (expand-file-name i)) "*") t)) + ;; Candidate is a file or wildcard and we use recursion, use the + ;; current directory instead of candidate. + ((and (or (file-exists-p i) (string-match "[*]" i)) + helm-grep-in-recurse) + (list (expand-file-name + (directory-file-name ; Needed for windoze. + (file-name-directory (directory-file-name i)))))) + ;; Else should be one or more file/directory + ;; possibly marked. + ;; When real is a normal filename without wildcard + ;; file-expand-wildcards returns a list of one file. + ;; wildcards should have been already handled by + ;; helm-read-file-name or helm-find-files but do it from + ;; here too in case we are called from elsewhere. + (t (file-expand-wildcards i t))) into all-files ; [1] + finally return + (if (string-match "^git" helm-grep-default-command) + (mapconcat 'identity all-files " ") + (mapconcat 'shell-quote-argument all-files " "))))) (defun helm-grep-command (&optional recursive) (let ((com (car (split-string (if recursive @@ -600,11 +600,11 @@ If N is positive go forward otherwise go backward." (when (get-buffer buf) (setq new-buf (read-string "GrepBufferName: " buf)) (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? " - new-buf)))) - do (setq new-buf (read-string "GrepBufferName: " "*hgrep "))) + when (and (string= new-buf b) + (not (y-or-n-p + (format "Buffer `%s' already exists overwrite? " + new-buf)))) + do (setq new-buf (read-string "GrepBufferName: " "*hgrep "))) (setq buf new-buf)) (with-current-buffer (get-buffer-create buf) (setq buffer-read-only t) @@ -621,8 +621,8 @@ If N is positive go forward otherwise go backward." ;;;###autoload (define-derived-mode helm-grep-mode - text-mode "helm-grep" - "Major mode to provide actions in helm grep saved buffer. + text-mode "helm-grep" + "Major mode to provide actions in helm grep saved buffer. Special commands: \\{helm-grep-mode-map}") @@ -691,19 +691,19 @@ Special commands: (goto-char (point-min)) (cl-loop while (re-search-forward "^ *--\\(\\[no\\]\\)\\([^. ]+\\) *\\(.*\\)" nil t) - collect (cons (concat (match-string 2) - " [" (match-string 3) "]") - (match-string 2)) - collect (cons (concat "no" (match-string 2) - " [" (match-string 3) "]") - (concat "no" (match-string 2)))))) + collect (cons (concat (match-string 2) + " [" (match-string 3) "]") + (match-string 2)) + collect (cons (concat "no" (match-string 2) + " [" (match-string 3) "]") + (concat "no" (match-string 2)))))) (defun helm-grep-ack-types-transformer (candidates _source) (cl-loop for i in candidates - if (stringp i) - collect (rassoc i helm-grep-ack-types-cache) - else - collect i)) + if (stringp i) + collect (rassoc i helm-grep-ack-types-cache) + else + collect i)) (defvar helm-grep-ack-types-cache nil) (defun helm-grep-read-ack-type () @@ -729,21 +729,21 @@ Special commands: "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." (cl-loop with ext-list = (list helm-grep-preferred-ext "*") - with lst = (if (file-directory-p (car files)) - (directory-files - (car files) nil - directory-files-no-dot-files-regexp) - files) - for i in lst - for ext = (file-name-extension i 'dot) - for glob = (and ext (not (string= ext "")) - (concat "*" ext)) - unless (or (not glob) - (and glob-list (member glob glob-list)) - (and glob-list (member glob ext-list)) - (and glob-list (member glob grep-find-ignored-files))) - collect glob into glob-list - finally return (delq nil (append ext-list glob-list)))) + with lst = (if (file-directory-p (car files)) + (directory-files + (car files) nil + directory-files-no-dot-files-regexp) + files) + for i in lst + for ext = (file-name-extension i 'dot) + for glob = (and ext (not (string= ext "")) + (concat "*" ext)) + unless (or (not glob) + (and glob-list (member glob glob-list)) + (and glob-list (member glob ext-list)) + (and glob-list (member glob grep-find-ignored-files))) + collect glob into glob-list + finally return (delq nil (append ext-list glob-list)))) (defun helm-grep-get-file-extensions (files) "Try to return a list of file extensions to pass to include arg of grep." @@ -760,7 +760,7 @@ These extensions will be added to command line with --include arg of grep." ;; split this string to pass it later to mapconcat. ;; e.g '("*.el *.py") (cl-loop for i in extensions - append (split-string-and-unquote i " ")) + append (split-string-and-unquote i " ")) (list "*")))) @@ -876,20 +876,20 @@ in recurse, search being made on `helm-zgrep-file-extension-regexp'." ;; (defun helm-ff-zgrep-1 (flist recursive) (unwind-protect - (let* ((def-dir (or helm-ff-default-directory - default-directory)) - (only (if recursive - (or (gethash def-dir helm-rzgrep-cache) - (puthash + (let* ((def-dir (or helm-ff-default-directory + default-directory)) + (only (if recursive + (or (gethash def-dir helm-rzgrep-cache) + (puthash + def-dir + (helm-walk-directory def-dir - (helm-walk-directory - def-dir - :directories nil - :path 'full - :match helm-zgrep-file-extension-regexp) - helm-rzgrep-cache)) - flist))) - (helm-do-grep-1 only recursive 'zgrep)) + :directories nil + :path 'full + :match helm-zgrep-file-extension-regexp) + helm-rzgrep-cache)) + flist))) + (helm-do-grep-1 only recursive 'zgrep)) (setq helm-zgrep-recurse-flag nil))) @@ -944,15 +944,15 @@ in recurse, search being made on `helm-zgrep-file-extension-regexp'." (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) + unless (string-match "\\`!" r) + collect r) (list helm-pattern)) - do - (while (and (re-search-forward reg nil t) - (> (- (setq end (match-end 0)) - (setq beg (match-beginning 0))) 0)) - (add-text-properties beg end '(face helm-grep-match))) - do (goto-char (point-min))) + do + (while (and (re-search-forward reg nil t) + (> (- (setq end (match-end 0)) + (setq beg (match-beginning 0))) 0)) + (add-text-properties beg end '(face helm-grep-match))) + do (goto-char (point-min))) (buffer-string)) (error nil)))) @@ -979,9 +979,9 @@ If a prefix arg is given run grep on all buffers ignoring non--file-buffers." (win-conf (current-window-configuration)) ;; Non--fname and remote buffers are ignored. (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)))) + for fname = (buffer-file-name (get-buffer buf)) + when (and fname (not (file-remote-p fname))) + collect (expand-file-name fname)))) (if bufs (if zgrep (helm-do-grep-1 bufs nil 'zgrep) diff --git a/helm-help.el b/helm-help.el index 52134b9b1..626ee8890 100644 --- a/helm-help.el +++ b/helm-help.el @@ -23,7 +23,7 @@ :group 'helm) (defface helm-helper - '((t :inherit helm-header)) + '((t :inherit helm-header)) "Face for helm help string in minibuffer." :group 'helm-help) @@ -108,15 +108,15 @@ INSERT-CONTENT-FN is the function that insert text to be displayed in BUFNAME." (let ((winconf (current-frame-configuration))) (unwind-protect - (progn - (setq helm-suspend-update-flag t) - (switch-to-buffer (get-buffer-create bufname)) - (delete-other-windows) - (erase-buffer) - (funcall insert-content-fn) - (setq cursor-type nil) - (goto-char 1) - (helm-help-event-loop)) + (progn + (setq helm-suspend-update-flag t) + (switch-to-buffer (get-buffer-create bufname)) + (delete-other-windows) + (erase-buffer) + (funcall insert-content-fn) + (setq cursor-type nil) + (goto-char 1) + (helm-help-event-loop)) (setq helm-suspend-update-flag nil) (set-frame-configuration winconf)))) @@ -127,12 +127,12 @@ text to be displayed in BUFNAME." (scroll-error-top-bottom t)) (condition-case _err (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 (cl-return)))) + (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 (cl-return)))) (beginning-of-buffer (message "Beginning of buffer")) (end-of-buffer (message "End of Buffer"))))) diff --git a/helm-imenu.el b/helm-imenu.el index c4c27b5c8..5d5deaabe 100644 --- a/helm-imenu.el +++ b/helm-imenu.el @@ -108,14 +108,14 @@ (defun helm-imenu--candidates-1 (alist) (cl-loop for elm in alist - append (if (imenu--subalist-p elm) - (helm-imenu--candidates-1 - (cl-loop for (e . v) in (cdr elm) collect - (cons (propertize - e 'helm-imenu-type (car elm)) - v))) - (and (cdr elm) ; bug in imenu, should not be needed. - (list elm))))) + append (if (imenu--subalist-p elm) + (helm-imenu--candidates-1 + (cl-loop for (e . v) in (cdr elm) collect + (cons (propertize + e 'helm-imenu-type (car elm)) + v))) + (and (cdr elm) ; bug in imenu, should not be needed. + (list elm))))) (defun helm-imenu--get-prop (item) ;; property value of ITEM can have itself @@ -132,19 +132,19 @@ (defun helm-imenu-transformer (candidates) (cl-loop for (k . v) in candidates - for types = (or (helm-imenu--get-prop k) - (list "Function" k)) - collect - (cons (mapconcat (lambda (x) - (propertize - x 'face (cond ((string= x "Variables") - 'font-lock-variable-name-face) - ((string= x "Function") - 'font-lock-function-name-face) - ((string= x "Types") - 'font-lock-type-face)))) - types helm-imenu-delimiter) - (cons k v)))) + for types = (or (helm-imenu--get-prop k) + (list "Function" k)) + collect + (cons (mapconcat (lambda (x) + (propertize + x 'face (cond ((string= x "Variables") + 'font-lock-variable-name-face) + ((string= x "Function") + 'font-lock-function-name-face) + ((string= x "Types") + 'font-lock-type-face)))) + types helm-imenu-delimiter) + (cons k v)))) ;;;###autoload (defun helm-imenu () diff --git a/helm-info.el b/helm-info.el index f7a956e4c..0169bfe6a 100644 --- a/helm-info.el +++ b/helm-info.el @@ -51,17 +51,17 @@ Sources are generated for all entries of `helm-default-info-index-list'. If COMMANDS arg is non--nil build also commands named `helm-info'. Where NAME is one of `helm-default-info-index-list'." (cl-loop with symbols = (cl-loop for str in var-value - collect - (intern (concat "helm-source-info-" str))) - for sym in symbols - for str in var-value - do (set sym (list (cons 'name (format "Info index: %s" str)) - (cons 'info-index str))) - when commands - do (let ((com (intern (concat "helm-info-" str)))) - (helm-build-info-index-command - com (format "Predefined helm for %s info." str) - sym (format "*helm info %s*" str))))) + collect + (intern (concat "helm-source-info-" str))) + for sym in symbols + for str in var-value + do (set sym (list (cons 'name (format "Info index: %s" str)) + (cons 'info-index str))) + when commands + do (let ((com (intern (concat "helm-info-" str)))) + (helm-build-info-index-command + com (format "Predefined helm for %s info." str) + sym (format "*helm info %s*" str))))) (defun helm-info-index-set (var value) (set var value) diff --git a/helm-locate.el b/helm-locate.el index e97da4f8d..e45f5993f 100644 --- a/helm-locate.el +++ b/helm-locate.el @@ -199,8 +199,8 @@ See also `helm-locate'." ;; Remove eventually ;; marked directories by error. (cl-loop for i in db - unless (file-directory-p i) - collect i) ":")) + unless (file-directory-p i) + collect i) ":")) helm-locate-command) helm-locate-command))) (setq helm-file-name-history (mapcar 'helm-basename file-name-history)) diff --git a/helm-man.el b/helm-man.el index e0692e322..e87775b02 100644 --- a/helm-man.el +++ b/helm-man.el @@ -32,8 +32,8 @@ "Default command to display a man page." :group 'helm-man :type '(radio :tag "Preferred command to display a man page" - (const :tag "Man" Man-getpage-in-background) - (const :tag "Woman" woman))) + (const :tag "Man" Man-getpage-in-background) + (const :tag "Woman" woman))) ;; Internal (defvar helm-man-pages nil diff --git a/helm-match-plugin.el b/helm-match-plugin.el index 60d2ce290..ec35d0e04 100644 --- a/helm-match-plugin.el +++ b/helm-match-plugin.el @@ -81,15 +81,15 @@ Here are the possible value of this symbol and their meaning: - multi3p: Same but prefix must match. Default is multi3." :type '(radio :tag "Matching methods for helm" - (const :tag "Multiple regexp 1 ordered with prefix match" multi1) - (const :tag "Multiple regexp 2 ordered with partial match" multi2) - (const :tag "Multiple regexp 3 matching no order, partial, best." multi3) - (const :tag "Multiple regexp 3p matching with prefix match" multi3p)) + (const :tag "Multiple regexp 1 ordered with prefix match" multi1) + (const :tag "Multiple regexp 2 ordered with partial match" multi2) + (const :tag "Multiple regexp 3 matching no order, partial, best." multi3) + (const :tag "Multiple regexp 3p matching with prefix match" multi3p)) :set 'helm-mp-set-matching-method :group 'helm-match-plugin) (defface helm-match - '((t (:inherit match))) + '((t (:inherit match))) "Face used to highlight matches." :group 'helm-match-plugin) @@ -107,7 +107,7 @@ The smaller this value is, the slower highlight is." ;;;###autoload (define-minor-mode helm-match-plugin-mode - "Add more flexible regexp matching for helm. + "Add more flexible regexp matching for helm. See `helm-mp-matching-method' for the behavior of each method." :group 'helm-match-plugin :require 'helm-match-plugin @@ -139,7 +139,7 @@ but \"foo\ bar\"=> (\"foobar\")." (replace-regexp-in-string helm-mp-space-regexp "\000\000" pattern) " " t) - collect (replace-regexp-in-string "\000\000" " " s)))) + collect (replace-regexp-in-string "\000\000" " " s)))) (defun helm-mp-1-make-regexp (pattern) "Replace spaces in PATTERN with \"\.*\"." @@ -269,9 +269,9 @@ This is done only if `helm-mp-3-pattern-str' is same as PATTERN." e.g ((identity . \"foo\") (identity . \"bar\"))." (unless (string= 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))))) + collect (if (string= "!" (substring pat 0 1)) + (cons 'not (substring pat 1)) + (cons 'identity pat))))) (defun helm-mp-3-match (str &optional pattern) "Check if PATTERN match STR. @@ -286,7 +286,7 @@ 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)))) (cl-loop for (predicate . regexp) in pat - always (funcall predicate (string-match regexp str))))) + always (funcall predicate (string-match regexp str))))) (defun helm-mp-3-search-base (pattern searchfn1 searchfn2) "Try to find PATTERN in `helm-buffer' with SEARCHFN1 and SEARCHFN2. @@ -297,15 +297,15 @@ i.e (identity (re-search-forward \"foo\" (point-at-eol) t)) => t." (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 (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 - else do (goto-char eol) - finally return nil)) + while (funcall searchfn1 (or (cdar pat) "") nil t) + for bol = (point-at-bol) + for eol = (point-at-eol) + 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 + else do (goto-char eol) + finally return nil)) (defun helm-mp-3-search (pattern &rest _ignore) (when (stringp pattern) @@ -332,7 +332,7 @@ e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to (first (car pat))) (and (funcall (car first) (helm-mp-prefix-match str (cdr first))) (cl-loop for (predicate . regexp) in (cdr pat) - always (funcall predicate (string-match regexp str)))))) + always (funcall predicate (string-match regexp str)))))) (defun helm-mp-3p-search (pattern &rest _ignore) (when (stringp pattern) @@ -366,17 +366,17 @@ e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to (helm-mklist it))) (matchfns (cond (defmatch-strict) (defmatch - (append helm-mp-default-match-functions defmatch)) + (append helm-mp-default-match-functions defmatch)) (t helm-mp-default-match-functions))) (searchfns (cond (defsearch-strict) (defsearch - (append searchers defsearch)) + (append searchers defsearch)) (t searchers)))) `(,(if (or (assoc 'candidates-in-buffer source) (equal '(identity) matchfns)) '(match identity) `(match ,@matchfns)) - (search ,@searchfns) - ,@source)))) + (search ,@searchfns) + ,@source)))) ;;; Highlight matches. @@ -409,15 +409,15 @@ e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to (when helm-alive-p (set-buffer helm-buffer) (let ((requote (cl-loop for (pred . re) in - (helm-mp-3-get-patterns helm-pattern) - when (and (eq pred 'identity) - (>= (length re) - helm-mp-highlight-threshold)) - collect re into re-list - finally return - (if (and re-list (>= (length re-list) 1)) - (mapconcat 'identity re-list "\\|") - (regexp-quote helm-pattern))))) + (helm-mp-3-get-patterns helm-pattern) + when (and (eq pred 'identity) + (>= (length re) + helm-mp-highlight-threshold)) + collect re into re-list + finally return + (if (and re-list (>= (length re-list) 1)) + (mapconcat 'identity re-list "\\|") + (regexp-quote helm-pattern))))) (when (>= (length requote) helm-mp-highlight-threshold) (helm-mp-highlight-region (point-min) end requote 'helm-match))))) diff --git a/helm-misc.el b/helm-misc.el index 043a0462a..816b36f5c 100644 --- a/helm-misc.el +++ b/helm-misc.el @@ -37,12 +37,12 @@ :type '(repeat (choice symbol))) (defface helm-time-zone-current - '((t (:foreground "green"))) + '((t (:foreground "green"))) "Face used to colorize current time in `helm-world-time'." :group 'helm-misc) (defface helm-time-zone-home - '((t (:foreground "red"))) + '((t (:foreground "red"))) "Face used to colorize home time in `helm-world-time'." :group 'helm-misc) @@ -52,9 +52,9 @@ (defun helm-latex-math-candidates () "Collect candidates for latex math completion." (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)) + for elm = (cl-loop for s in i when (vectorp s) + collect (cons (aref s 0) (aref s 1))) + append elm)) (defvar helm-source-latex-math '((name . "Latex Math Menu") @@ -89,7 +89,7 @@ http://en.wikipedia.org/wiki/Ruby_Document_format") (defvar helm-source-oddmuse-headline '((name . "Oddmuse HeadLine") (headline "^= \\(.+\\) =$" "^== \\(.+\\) ==$" - "^=== \\(.+\\) ===$" "^==== \\(.+\\) ====$") + "^=== \\(.+\\) ===$" "^==== \\(.+\\) ====$") (condition . (memq major-mode '(oddmuse-mode yaoddmuse-mode))) (migemo) (subexp . 1)) @@ -99,7 +99,7 @@ http://en.wikipedia.org/wiki/Ruby_Document_format") '((name . "Emacs Source DEFUN") (headline . "DEFUN\\|DEFVAR") (condition . (string-match "/emacs2[0-9].+/src/.+c$" - (or buffer-file-name "")))) + (or buffer-file-name "")))) "Show DEFUN/DEFVAR in Emacs C source file.") (defvar helm-source-emacs-lisp-expectations @@ -129,13 +129,13 @@ http://www.emacswiki.org/cgi-bin/wiki/download/linkd.el") (ignore-errors (with-helm-current-buffer (cl-loop initially (goto-char (point-min)) - while (re-search-forward - (format ee-anchor-format "\\([^\.].+\\)") nil t) - for anchor = (match-string-no-properties 1) - collect (cons (format "%5d:%s" - (line-number-at-pos (match-beginning 0)) - (format ee-anchor-format anchor)) - anchor)))))) + while (re-search-forward + (format ee-anchor-format "\\([^\.].+\\)") nil t) + for anchor = (match-string-no-properties 1) + collect (cons (format "%5d:%s" + (line-number-at-pos (match-beginning 0)) + (format ee-anchor-format anchor)) + anchor)))))) (persistent-action . (lambda (item) (ee-to item) (helm-highlight-current-line))) @@ -147,11 +147,11 @@ http://www.emacswiki.org/cgi-bin/wiki/download/linkd.el") "List online Jabber contacts." (with-no-warnings (cl-loop for item in (jabber-concat-rosters) - when (get item 'connected) - collect - (if (get item 'name) - (cons (get item 'name) item) - (cons (symbol-name item) item))))) + when (get item 'connected) + collect + (if (get item 'name) + (cons (get item 'name) item) + (cons (symbol-name item) item))))) (defvar helm-source-jabber-contacts '((name . "Jabber Contacts") @@ -167,12 +167,12 @@ http://www.emacswiki.org/cgi-bin/wiki/download/linkd.el") ;; (defun helm-time-zone-transformer (candidates _source) (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)) - ((string-match helm-time-zone-home-location i) - (propertize i 'face 'helm-time-zone-home)) - (t i)))) + collect + (cond ((string-match (format-time-string "%H:%M" (current-time)) i) + (propertize i 'face 'helm-time-zone-current)) + ((string-match helm-time-zone-home-location i) + (propertize i 'face 'helm-time-zone-home)) + (t i)))) (defvar helm-source-time-world '((name . "Time World List") @@ -247,8 +247,8 @@ It is added to `extended-command-history'. (candidates . (lambda () (let ((history (cl-loop for i in - (symbol-value minibuffer-history-variable) - unless (string= "" i) collect i))) + (symbol-value minibuffer-history-variable) + unless (string= "" i) collect i))) (if (consp (car history)) (mapcar 'prin1-to-string history) history)))) diff --git a/helm-mode.el b/helm-mode.el index e58f6baf5..ac60961f4 100644 --- a/helm-mode.el +++ b/helm-mode.el @@ -182,47 +182,47 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." (defun helm-cr-default-transformer (candidates _source) "Default filter candidate function for `helm-comp-read'." (cl-loop 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-unknown-pattern-flag) - collect - (cons (concat (propertize - " " 'display - (propertize "[?]" 'face 'helm-ff-prefix)) - cand) - cand) into lst - else collect cand into lst - finally return (helm-fast-remove-dups lst :test 'equal))) + 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-unknown-pattern-flag) + collect + (cons (concat (propertize + " " 'display + (propertize "[?]" 'face 'helm-ff-prefix)) + cand) + cand) into lst + else collect cand into lst + finally return (helm-fast-remove-dups lst :test 'equal))) ;;;###autoload (cl-defun helm-comp-read (prompt collection - &key - test - initial-input - default - preselect - (buffer "*Helm Completions*") - must-match - reverse-history - (requires-pattern 0) - history - input-history - (case-fold helm-comp-read-case-fold-search) - (del-input t) - (persistent-action nil) - (persistent-help "DoNothing") - (mode-line helm-comp-read-mode-line) - (keymap helm-comp-read-map) - (name "Helm Completions") - candidates-in-buffer - exec-when-only-one - quit-when-no-cand - (volatile t) - sort - (fc-transformer 'helm-cr-default-transformer) - marked-candidates - nomark - (alistp t)) + &key + test + initial-input + default + preselect + (buffer "*Helm Completions*") + must-match + reverse-history + (requires-pattern 0) + history + input-history + (case-fold helm-comp-read-case-fold-search) + (del-input t) + (persistent-action nil) + (persistent-help "DoNothing") + (mode-line helm-comp-read-mode-line) + (keymap helm-comp-read-map) + (name "Helm Completions") + candidates-in-buffer + exec-when-only-one + quit-when-no-cand + (volatile t) + sort + (fc-transformer 'helm-cr-default-transformer) + marked-candidates + nomark + (alistp t)) "Read a string in the minibuffer, with helm completion. It is helm `completing-read' equivalent. @@ -358,11 +358,11 @@ that use `helm-comp-read' See `helm-M-x' for example." (filtered-candidate-transformer . (lambda (candidates sources) (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) - do (set-text-properties 0 (length cand) nil cand) - collect cand))) + ;; 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) + do (set-text-properties 0 (length cand) nil cand) + collect cand))) (persistent-action . ,persistent-action) (persistent-help . ,persistent-help) (keymap . ,loc-map) @@ -400,7 +400,7 @@ that use `helm-comp-read' See `helm-M-x' for example." result) (when nomark (setq src-list (cl-loop for src in src-list - collect (cons '(nomark) src)))) + collect (cons '(nomark) src)))) (when reverse-history (setq src-list (nreverse src-list))) (setq result (helm :sources src-list @@ -462,7 +462,7 @@ that use `helm-comp-read' See `helm-M-x' for example." ;; (defun helm-completing-read-symbols (prompt _collection test _require-match init - hist default _inherit-input-method name buffer) + hist default _inherit-input-method name buffer) "Specialized function for fast symbols completion in `helm-mode'." (or (helm @@ -478,10 +478,10 @@ that use `helm-comp-read' See `helm-M-x' for example." (not (string= ,default ""))) (insert (concat ,default "\n"))) (cl-loop for sym in (all-completions "" obarray ',test) - for s = (intern sym) - unless (or (and ,default (string= sym ,default)) - (keywordp s)) - do (insert (concat sym "\n")))))) + for s = (intern sym) + unless (or (and ,default (string= sym ,default)) + (keywordp s)) + do (insert (concat sym "\n")))))) (persistent-action . helm-lisp-completion-persistent-action) (persistent-help . "Show brief doc in mode-line") (candidates-in-buffer) @@ -500,8 +500,8 @@ that use `helm-comp-read' See `helm-M-x' for example." ;; (defun helm-completing-read-default-1 (prompt collection test require-match - init hist default _inherit-input-method - name buffer &optional cands-in-buffer exec-when-only-one) + init hist default _inherit-input-method + name buffer &optional cands-in-buffer exec-when-only-one) "Call `helm-comp-read' with same args as `completing-read'. Extra optional arg CANDS-IN-BUFFER mean use `candidates-in-buffer' method which is faster. @@ -543,8 +543,8 @@ It should be used when candidate list don't need to rebuild dynamically." (defun helm-completing-read-with-cands-in-buffer (prompt collection test require-match - init hist default inherit-input-method - name buffer) + init hist default inherit-input-method + name buffer) "Same as `helm-completing-read-default-1' but use candidates-in-buffer." ;; Some commands like find-tag may use `read-file-name' from inside ;; the calculation of collection. in this case it clash with @@ -557,9 +557,9 @@ It should be used when candidate list don't need to rebuild dynamically." (cl-defun helm--completing-read-default (prompt collection &optional - predicate require-match - initial-input hist def - inherit-input-method) + predicate require-match + initial-input hist def + inherit-input-method) "An helm replacement of `completing-read'. This function should be used only as a `completing-read-function'. @@ -603,9 +603,9 @@ See documentation of `completing-read' and `all-completions' for details." ;; `helm-mode' will be restored on exit. (cl-return-from helm--completing-read-default (unwind-protect - (progn - (helm-mode -1) - (apply completing-read-function def-args)) + (progn + (helm-mode -1) + (apply completing-read-function def-args)) (helm-mode 1)))) ;; If we use now `completing-read' we MUST turn off `helm-mode' ;; to avoid infinite recursion and CRASH. It will be reenabled on exit. @@ -615,25 +615,25 @@ See documentation of `completing-read' and `all-completions' for details." (not (string-match "^helm" str-defcom)))) (helm-mode -1)) (unwind-protect - (cond (;; An helm specialized function exists, run it. - (and def-com helm-mode) - (apply def-com any-args)) - (;; Try to handle `ido-completing-read' everywhere. - (and def-com (eq def-com 'ido-completing-read)) - (setcar (memq collection def-args) - (all-completions "" collection predicate)) - (apply def-com def-args)) - (;; User set explicitely `completing-read' or something similar - ;; in *read-handlers-alist, use this with exactly the same - ;; args as in `completing-read'. - ;; If we are here `helm-mode' is now disabled. - def-com - (apply def-com def-args)) - (t ; Fall back to classic `helm-comp-read'. - (helm-completing-read-default-1 - prompt collection predicate require-match - initial-input hist def inherit-input-method - str-command buf-name))) + (cond (;; An helm specialized function exists, run it. + (and def-com helm-mode) + (apply def-com any-args)) + (;; Try to handle `ido-completing-read' everywhere. + (and def-com (eq def-com 'ido-completing-read)) + (setcar (memq collection def-args) + (all-completions "" collection predicate)) + (apply def-com def-args)) + (;; User set explicitely `completing-read' or something similar + ;; in *read-handlers-alist, use this with exactly the same + ;; args as in `completing-read'. + ;; If we are here `helm-mode' is now disabled. + def-com + (apply def-com def-args)) + (t ; Fall back to classic `helm-comp-read'. + (helm-completing-read-default-1 + prompt collection predicate require-match + initial-input hist def inherit-input-method + str-command buf-name))) (helm-mode 1) ;; When exiting minibuffer, `this-command' is set to ;; `helm-exit-minibuffer', which is unwanted when starting @@ -647,21 +647,21 @@ See documentation of `completing-read' and `all-completions' for details." (cl-defun helm-read-file-name (prompt &key - (name "Read File Name") - (initial-input (expand-file-name default-directory)) - (buffer "*Helm file completions*") - test - (case-fold helm-file-name-case-fold-search) - preselect - history - must-match - default - marked-candidates - nomark - (alistp t) - (persistent-action 'helm-find-files-persistent-action) - (persistent-help "Hit1 Expand Candidate, Hit2 or (C-u) Find file") - (mode-line helm-read-file-name-mode-line-string)) + (name "Read File Name") + (initial-input (expand-file-name default-directory)) + (buffer "*Helm file completions*") + test + (case-fold helm-file-name-case-fold-search) + preselect + history + must-match + default + marked-candidates + nomark + (alistp t) + (persistent-action 'helm-find-files-persistent-action) + (persistent-help "Hit1 Expand Candidate, Hit2 or (C-u) Find file") + (mode-line helm-read-file-name-mode-line-string)) "Read a file name with helm completion. It is helm `read-file-name' emulation. @@ -757,11 +757,11 @@ Keys description: (list helm-pattern)) (if ',test (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 - (funcall ',test i)) ; Test ok - collect i) + for i in (helm-find-files-get-candidates + ',must-match) + when (or (member i hn) ; A tramp host + (funcall ',test i)) ; Test ok + collect i) (helm-find-files-get-candidates ',must-match))))) (filtered-candidate-transformer . helm-ff-sort-candidates) (filter-one-by-one . helm-ff-filter-candidate-one-by-one) @@ -774,7 +774,7 @@ Keys description: (result (helm :sources (if nomark (cl-loop for src in src-list - collect (cons '(nomark) src)) + collect (cons '(nomark) src)) src-list) :input initial-input :prompt prompt @@ -838,9 +838,9 @@ Don't use it directly, use instead `helm-read-file-name' in your programs." (unless (or (not entry) def-com) (cl-return-from helm--generic-read-file-name (unwind-protect - (progn - (helm-mode -1) - (apply read-file-name-function def-args)) + (progn + (helm-mode -1) + (apply read-file-name-function def-args)) (helm-mode 1)))) ;; If we use now `read-file-name' we MUST turn off `helm-mode' ;; to avoid infinite recursion and CRASH. It will be reenabled on exit. @@ -850,32 +850,32 @@ Don't use it directly, use instead `helm-read-file-name' in your programs." (not (string-match "^helm" str-defcom)))) (helm-mode -1)) (unwind-protect - (setq fname - (cond (;; A specialized function exists, run it - ;; with the two extra args specific to helm.. - (and def-com helm-mode - (not (eq def-com 'ido-read-file-name)) - (not (eq def-com 'incompatible))) - (apply def-com any-args)) - (;; Def-com value is `ido-read-file-name' - ;; run it with default args. - (and def-com (eq def-com 'ido-read-file-name)) - (ido-mode 1) - (apply def-com def-args)) - (;; Def-com value is `read-file-name' - ;; run it with default args. - (eq def-com 'read-file-name) - (apply def-com def-args)) - (t ; Fall back to classic `helm-read-file-name'. - (helm-read-file-name - prompt - :name str-command - :buffer buf-name - :default default-filename - :initial-input (expand-file-name init dir) - :alistp nil - :must-match mustmatch - :test predicate)))) + (setq fname + (cond (;; A specialized function exists, run it + ;; with the two extra args specific to helm.. + (and def-com helm-mode + (not (eq def-com 'ido-read-file-name)) + (not (eq def-com 'incompatible))) + (apply def-com any-args)) + (;; Def-com value is `ido-read-file-name' + ;; run it with default args. + (and def-com (eq def-com 'ido-read-file-name)) + (ido-mode 1) + (apply def-com def-args)) + (;; Def-com value is `read-file-name' + ;; run it with default args. + (eq def-com 'read-file-name) + (apply def-com def-args)) + (t ; Fall back to classic `helm-read-file-name'. + (helm-read-file-name + prompt + :name str-command + :buffer buf-name + :default default-filename + :initial-input (expand-file-name init dir) + :alistp nil + :must-match mustmatch + :test predicate)))) (helm-mode 1) (ido-mode (if ido-state 1 -1)) ;; Same comment as in `helm--completing-read-default'. @@ -894,84 +894,84 @@ Can be used as value for `completion-in-region-function'." 'lisp--local-variables :around #'helm-mode--advice-lisp--local-variables) (unwind-protect - (let* ((enable-recursive-minibuffers t) - (input (buffer-substring-no-properties start end)) - (current-command (or (helm-this-command) this-command)) - (str-command (symbol-name current-command)) - (buf-name (format "*helm-mode-%s*" str-command)) - (require-match (or (and (boundp 'require-match) require-match) - minibuffer-completion-confirm - ;; If prompt have not been propagated here, that's - ;; probably mean we have no prompt and we are in - ;; completion-at-point or friend, so use a non--nil - ;; value for require-match. - (not (boundp 'prompt)))) - ;; `completion-extra-properties' is let-bounded in `completion-at-point'. - ;; `afun' is a closure to call against each string in `data'. - ;; it provide the annotation info for each string. - ;; e.g "foo" => "foo " where foo is a function. - ;; See Issue #407. - (afun (plist-get completion-extra-properties :annotation-function)) - (data (all-completions input collection predicate)) - (file-comp-p (helm-mode--in-file-completion-p input (car data))) - ;; Completion-at-point and friends have no prompt. - (result (helm-comp-read - (or (and (boundp 'prompt) prompt) "Pattern: ") - (if file-comp-p - (cl-loop for f in data unless - (string-match "\\`\\.\\{1,2\\}/\\'" f) - collect f) - (if afun - (mapcar (lambda (s) - (let ((ann (funcall afun s))) - (if ann - (cons - (concat - s + (let* ((enable-recursive-minibuffers t) + (input (buffer-substring-no-properties start end)) + (current-command (or (helm-this-command) this-command)) + (str-command (symbol-name current-command)) + (buf-name (format "*helm-mode-%s*" str-command)) + (require-match (or (and (boundp 'require-match) require-match) + minibuffer-completion-confirm + ;; If prompt have not been propagated here, that's + ;; probably mean we have no prompt and we are in + ;; completion-at-point or friend, so use a non--nil + ;; value for require-match. + (not (boundp 'prompt)))) + ;; `completion-extra-properties' is let-bounded in `completion-at-point'. + ;; `afun' is a closure to call against each string in `data'. + ;; it provide the annotation info for each string. + ;; e.g "foo" => "foo " where foo is a function. + ;; See Issue #407. + (afun (plist-get completion-extra-properties :annotation-function)) + (data (all-completions input collection predicate)) + (file-comp-p (helm-mode--in-file-completion-p input (car data))) + ;; Completion-at-point and friends have no prompt. + (result (helm-comp-read + (or (and (boundp 'prompt) prompt) "Pattern: ") + (if file-comp-p + (cl-loop for f in data unless + (string-match "\\`\\.\\{1,2\\}/\\'" f) + collect f) + (if afun + (mapcar (lambda (s) + (let ((ann (funcall afun s))) + (if ann + (cons + (concat + s + (propertize + " " 'display (propertize - " " 'display - (propertize - ann - 'face 'completions-annotations))) - s) - s))) - data) - data)) - :name str-command - :nomark t - :initial-input - (cond ((and file-comp-p - (not (string-match "/\\'" input))) - (concat (helm-basename input) - (unless (string= input "") " "))) - ((string-match "/\\'" input) nil) - ((or (null require-match) - (stringp require-match)) - input) - (t (concat input " "))) - :buffer buf-name - :fc-transformer (append (list 'helm-cr-default-transformer) - (list (lambda (candidates _source) - (sort candidates 'helm-generic-sort-fn)))) - :exec-when-only-one t - :quit-when-no-cand - #'(lambda () - ;; Delay message to overwrite "Quit". - (run-with-timer - 0.01 nil - #'(lambda () - (message "[No matches]"))) - t) ; exit minibuffer immediately. - :must-match require-match))) - (when result - (delete-region (if (and file-comp-p - (save-excursion - (re-search-backward "~?/" start t))) - (match-end 0) start) - end) - (insert (if file-comp-p - (shell-quote-argument result) - result)))) + ann + 'face 'completions-annotations))) + s) + s))) + data) + data)) + :name str-command + :nomark t + :initial-input + (cond ((and file-comp-p + (not (string-match "/\\'" input))) + (concat (helm-basename input) + (unless (string= input "") " "))) + ((string-match "/\\'" input) nil) + ((or (null require-match) + (stringp require-match)) + input) + (t (concat input " "))) + :buffer buf-name + :fc-transformer (append (list 'helm-cr-default-transformer) + (list (lambda (candidates _source) + (sort candidates 'helm-generic-sort-fn)))) + :exec-when-only-one t + :quit-when-no-cand + #'(lambda () + ;; Delay message to overwrite "Quit". + (run-with-timer + 0.01 nil + #'(lambda () + (message "[No matches]"))) + t) ; exit minibuffer immediately. + :must-match require-match))) + (when result + (delete-region (if (and file-comp-p + (save-excursion + (re-search-backward "~?/" start t))) + (match-end 0) start) + end) + (insert (if file-comp-p + (shell-quote-argument result) + result)))) (advice-remove 'lisp--local-variables #'helm-mode--advice-lisp--local-variables))) @@ -990,7 +990,7 @@ Can be used as value for `completion-in-region-function'." ;;;###autoload (define-minor-mode helm-mode - "Toggle generic helm completion. + "Toggle generic helm completion. All functions in Emacs that use `completing-read' or `read-file-name' and friends will use helm interface diff --git a/helm-net.el b/helm-net.el index 08e2c8bb1..5ff69d0e7 100644 --- a/helm-net.el +++ b/helm-net.el @@ -187,24 +187,24 @@ Return an alist with elements like (data . number_results)." (url-hexify-string input))) (fetch #'(lambda () (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 (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) - do - (progn - (when (> ldata helm-ggs-max-length-real-flag) - (setq helm-ggs-max-length-real-flag ldata)) - (when (> lqueries helm-ggs-max-length-num-flag) - (setq helm-ggs-max-length-num-flag lqueries))) - collect (cons data nqueries) into cont - finally return cont)))) + with result-alist = (xml-get-children + (car (xml-parse-region + (point-min) (point-max))) + 'CompleteSuggestion) + for i in result-alist + 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) + do + (progn + (when (> ldata helm-ggs-max-length-real-flag) + (setq helm-ggs-max-length-real-flag ldata)) + (when (> lqueries helm-ggs-max-length-num-flag) + (setq helm-ggs-max-length-num-flag lqueries))) + collect (cons data nqueries) into cont + finally return cont)))) (if helm-google-suggest-use-curl-p (with-temp-buffer (call-process "curl" nil t nil request) @@ -221,31 +221,31 @@ Return an alist with elements like (data . number_results)." (concat request-prefix " " helm-pattern)) helm-pattern)) - for (real . numresult) in suggested-results - ;; Prepare number of results with "," - for fnumresult = (helm-ggs-set-number-result numresult) - ;; Calculate number of spaces to add before fnumresult - ;; if it is smaller than longest result - ;; `helm-ggs-max-length-num-flag'. - ;; e.g 1,234,567 - ;; 345,678 - ;; To be sure it is aligned properly. - for nspaces = (if (< (length fnumresult) - helm-ggs-max-length-num-flag) - (- helm-ggs-max-length-num-flag - (length fnumresult)) - 0) - ;; Add now the spaces before fnumresult. - for align-fnumresult = (concat (make-string nspaces ? ) - fnumresult) - for interval = (- helm-ggs-max-length-real-flag - (length real)) - for spaces = (make-string (+ 2 interval) ? ) - for display = (format "%s%s(%s results)" - real spaces align-fnumresult) - collect (cons display real)))) + for (real . numresult) in suggested-results + ;; Prepare number of results with "," + for fnumresult = (helm-ggs-set-number-result numresult) + ;; Calculate number of spaces to add before fnumresult + ;; if it is smaller than longest result + ;; `helm-ggs-max-length-num-flag'. + ;; e.g 1,234,567 + ;; 345,678 + ;; To be sure it is aligned properly. + for nspaces = (if (< (length fnumresult) + helm-ggs-max-length-num-flag) + (- helm-ggs-max-length-num-flag + (length fnumresult)) + 0) + ;; Add now the spaces before fnumresult. + for align-fnumresult = (concat (make-string nspaces ? ) + fnumresult) + for interval = (- helm-ggs-max-length-real-flag + (length real)) + for spaces = (make-string (+ 2 interval) ? ) + for display = (format "%s%s(%s results)" + real spaces align-fnumresult) + collect (cons display real)))) (if (cl-loop for (_disp . dat) in suggestions - thereis (equal dat helm-pattern)) + thereis (equal dat helm-pattern)) suggestions ;; if there is no suggestion exactly matching the input then ;; prepend a Search on Google item to the list @@ -259,14 +259,14 @@ Return an alist with elements like (data . number_results)." (progn (and (numberp num) (setq num (number-to-string num))) (cl-loop for i in (reverse (split-string num "" t)) - for count from 1 - append (list i) into C - when (= count 3) - append (list ",") into C - and do (setq count 0) - finally return - (replace-regexp-in-string - "^," "" (mapconcat 'identity (reverse C) "")))) + for count from 1 + append (list i) into C + when (= count 3) + append (list ",") into C + and do (setq count 0) + finally return + (replace-regexp-in-string + "^," "" (mapconcat 'identity (reverse C) "")))) "?")) (defun helm-google-suggest-action (candidate) @@ -307,12 +307,12 @@ Return an alist with elements like (data . number_results)." (with-current-buffer (url-retrieve-synchronously request) (cl-loop with result-alist = - (xml-get-children - (car (xml-parse-region - (point-min) (point-max))) - 'Result) - for i in result-alist - collect (cl-caddr i))))) + (xml-get-children + (car (xml-parse-region + (point-min) (point-max))) + 'Result) + for i in result-alist + collect (cl-caddr i))))) (defun helm-yahoo-suggest-set-candidates () "Set candidates with Yahoo results found." @@ -357,13 +357,13 @@ Return an alist with elements like (data . number_results)." (goto-char (point-min)) (when (re-search-forward "^\\[.+\\[\\(.*\\)\\]\\]" nil t) (cl-loop for i across (aref (json-read-from-string (match-string 0)) 1) - collect i into result - finally return (or result - (append - result - (list (cons (format "Search for '%s' on wikipedia" - helm-pattern) - helm-pattern))))))) + collect i into result + finally return (or result + (append + result + (list (cons (format "Search for '%s' on wikipedia" + helm-pattern) + helm-pattern))))))) (defvar helm-wikipedia--summary-cache (make-hash-table :test 'equal)) (defun helm-wikipedia-persistent-action (candidate) @@ -507,8 +507,8 @@ 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 - (cl-loop for (exe . fn) in helm-browse-url-default-browser-alist - thereis (and exe (executable-find exe) (fboundp fn) fn)))) + (cl-loop for (exe . fn) in helm-browse-url-default-browser-alist + thereis (and exe (executable-find exe) (fboundp fn) fn)))) (if default-browser-fn (apply default-browser-fn url args) (error "No usable browser found")))) diff --git a/helm-plugin.el b/helm-plugin.el index b1d51331b..95888fca4 100644 --- a/helm-plugin.el +++ b/helm-plugin.el @@ -107,9 +107,9 @@ (if (assoc-default 'candidates-file source) `((init helm-p-candidates-file-init ,@(let ((orig-init (assoc-default 'init source))) - (cond ((null orig-init) nil) - ((functionp orig-init) (list orig-init)) - (t orig-init)))) + (cond ((null orig-init) nil) + ((functionp orig-init) (list orig-init)) + (t orig-init)))) (candidates-in-buffer) ,@source) source)) @@ -197,40 +197,40 @@ (unless (null headlines) ; FIX headlines empty bug! (cl-loop with curhead = (make-vector (1+ (cl-loop for (_ . hierarchy) in headlines - maximize hierarchy)) + maximize hierarchy)) "") - for ((str . pt) . hierarchy) in headlines - do (aset curhead hierarchy str) - collecting - (cons - (format "H%d:%s" (1+ hierarchy) - (mapconcat 'identity - (cl-loop for i from 0 to hierarchy - collecting (aref curhead i)) - " / ")) - pt)))))) + for ((str . pt) . hierarchy) in headlines + do (aset curhead hierarchy str) + collecting + (cons + (format "H%d:%s" (1+ hierarchy) + (mapconcat 'identity + (cl-loop for i from 0 to hierarchy + collecting (aref curhead i)) + " / ")) + pt)))))) (if (listp regexp) (funcall arrange (sort (cl-loop for re in regexp - for hierarchy from 0 - do (goto-char (point-min)) - appending - (cl-loop - while (re-search-forward re nil t) - collect (cons (funcall matched) hierarchy))) + for hierarchy from 0 + do (goto-char (point-min)) + appending + (cl-loop + while (re-search-forward re nil t) + collect (cons (funcall matched) hierarchy))) (lambda (a b) (> (cdar b) (cdar a))))) (cl-loop while (re-search-forward regexp nil t) - collect (funcall matched))))))) + collect (funcall matched))))))) (defun helm-headline-make-candidate-buffer (regexp subexp) (with-current-buffer (helm-candidate-buffer 'local) (cl-loop for (content . pos) in (helm-headline-get-candidates regexp subexp) - do (insert - (format "%5d:%s\n" - (with-helm-current-buffer - (line-number-at-pos pos)) - content))))) + do (insert + (format "%5d:%s\n" + (with-helm-current-buffer + (line-number-at-pos pos)) + content))))) (defun helm-headline-goto-position (pos recenter) (goto-char pos) diff --git a/helm-regexp.el b/helm-regexp.el index 184d39a86..1b8e1dbff 100644 --- a/helm-regexp.el +++ b/helm-regexp.el @@ -38,7 +38,7 @@ (defface helm-moccur-buffer - '((t (:foreground "DarkTurquoise" :underline t))) + '((t (:foreground "DarkTurquoise" :underline t))) "Face used to highlight moccur buffer names." :group 'helm-regexp) @@ -118,10 +118,10 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b." (line (buffer-substring s e))) (propertize (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 - finally return (concat ln ln1)) + for i from 0 to (1- (/ (length matches) 2)) + concat (format "\n %s'%s'" (format "Group %d: " i) + (match-string i)) into ln1 + finally return (concat ln ln1)) ;; match beginning ;; KLUDGE: point of helm-candidate-buffer is +1 than that of helm-current-buffer. ;; It is implementation problem of candidates-in-buffer. @@ -167,12 +167,12 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b." (helm-init-candidates-in-buffer 'global (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) - `(buffer-name ,(buffer-name (get-buffer buf))) - bufstr) - concat bufstr))) + for bufstr = (with-current-buffer buf (buffer-string)) + do (add-text-properties + 0 (length bufstr) + `(buffer-name ,(buffer-name (get-buffer buf))) + bufstr) + concat bufstr))) (defun helm-moccur-get-line (beg end) "Format line for `helm-source-moccur'." @@ -187,7 +187,7 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b." (buffer-substring beg end))) (cl-defun helm-moccur-action (candidate - &optional (method (quote buffer)) mark) + &optional (method (quote buffer)) mark) "Jump to CANDIDATE with METHOD. arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame." (require 'helm-grep) @@ -204,10 +204,10 @@ arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame." (helm-goto-line lineno) ;; Move point to the nearest matching regexp from bol. (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 - finally (goto-char (apply #'min pos-ls))) + when (save-excursion + (re-search-forward reg (point-at-eol) t)) + collect (match-beginning 0) into pos-ls + finally (goto-char (apply #'min pos-ls))) (when mark (set-marker (mark-marker) (point)) (push-mark (point) 'nomsg)))) @@ -262,7 +262,7 @@ Same as `helm-moccur-goto-line' but go in new frame." ;;;###autoload (define-minor-mode helm-occur-match-plugin-mode - "Turn On/Off `helm-match-plugin-mode' only for `helm-m/occur'." + "Turn On/Off `helm-match-plugin-mode' only for `helm-m/occur'." :global t :init-value t (if helm-occur-match-plugin-mode @@ -339,8 +339,8 @@ It is used with type attribute 'line'." ;; ;; (define-helm-type-attribute 'line - '((display-to-real . helm-display-to-real-numbered-line) - (action ("Go to Line" . helm-action-line-goto))) + '((display-to-real . helm-display-to-real-numbered-line) + (action ("Go to Line" . helm-action-line-goto))) "LINENO:CONTENT string, eg. \" 16:foo\". Optional `target-file' attribute is a name of target file. @@ -358,9 +358,9 @@ If `recenter' attribute is specified, the line is displayed at the center of window, otherwise at the top of window.") (define-helm-type-attribute 'file-line - `((filtered-candidate-transformer helm-filtered-candidate-transformer-file-line) - (multiline) - (action ("Go to" . helm-action-file-line-goto))) + `((filtered-candidate-transformer helm-filtered-candidate-transformer-file-line) + (multiline) + (action ("Go to" . helm-action-file-line-goto))) "FILENAME:LINENO:CONTENT string, eg. \"~/.emacs:16:;; comment\". Optional `default-directory' attribute is a default-directory diff --git a/helm-ring.el b/helm-ring.el index fc1f64cec..22d0f0844 100644 --- a/helm-ring.el +++ b/helm-ring.el @@ -38,7 +38,7 @@ "Max number of lines displayed per candidate in kill-ring browser. If nil or zero (disabled), don't truncate candidate, show all." :type '(choice (const :tag "Disabled" nil) - (integer :tag "Max number of lines")) + (integer :tag "Max number of lines")) :group 'helm-ring) (defcustom helm-kill-ring-show-completion t @@ -71,8 +71,8 @@ If nil or zero (disabled), don't truncate candidate, show all." (action . (("Yank" . helm-kill-ring-action) ("Delete" . (lambda (candidate) (cl-loop for cand in (helm-marked-candidates) - do (setq kill-ring - (delete cand kill-ring))))))) + do (setq kill-ring + (delete cand kill-ring))))))) (keymap . ,helm-kill-ring-map) (last-command) (migemo) @@ -81,28 +81,28 @@ If nil or zero (disabled), don't truncate candidate, show all." (defun helm-kill-ring-candidates () (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)) + 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." (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)) - collect (cons - (with-temp-buffer - (insert i) - (goto-char (point-min)) - (concat - (buffer-substring - (point-min) - (save-excursion - (forward-line helm-kill-ring-max-lines-number) - (point))) - "[...]")) i) - else collect i)) + 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)) + collect (cons + (with-temp-buffer + (insert i) + (goto-char (point-min)) + (concat + (buffer-substring + (point-min) + (save-excursion + (forward-line helm-kill-ring-max-lines-number) + (point))) + "[...]")) i) + else collect i)) (defun helm-kill-ring-action (str) "Insert STR in `kill-ring' and set STR to the head. @@ -152,11 +152,11 @@ replace with STR as yanked string." (defun helm-mark-ring-get-candidates () (with-helm-current-buffer (cl-loop with marks = (if (mark t) (cons (mark-marker) mark-ring) mark-ring) - for i in marks - for m = (helm-mark-ring-get-marks i) - unless (and recip (member m recip)) - collect m into recip - finally return recip))) + for i in marks + for m = (helm-mark-ring-get-marks i) + unless (and recip (member m recip)) + collect m into recip + finally return recip))) (defvar helm-source-mark-ring '((name . "mark-ring") @@ -202,13 +202,13 @@ replace with STR as yanked string." (let ((marks global-mark-ring)) (when marks (cl-loop for i in marks - for gm = (unless (or (string-match - "^ " (format "%s" (marker-buffer i))) - (null (marker-buffer i))) - (helm-global-mark-ring-format-buffer i)) - when (and gm (not (member gm recip))) - collect gm into recip - finally return recip)))) + for gm = (unless (or (string-match + "^ " (format "%s" (marker-buffer i))) + (null (marker-buffer i))) + (helm-global-mark-ring-format-buffer i)) + when (and gm (not (member gm recip))) + collect gm into recip + finally return recip)))) ;;;; @@ -224,97 +224,97 @@ replace with STR as yanked string." (defun helm-register-candidates () "Collecting register contents and appropriate commands." (cl-loop for (char . val) in register-alist - for key = (single-key-description char) - for string-actions = - (cond - ((numberp val) - (list (int-to-string val) - 'insert-register - 'increment-register)) - ((markerp val) - (let ((buf (marker-buffer val))) - (if (null buf) - (list "a marker in no buffer") - (list (concat - "a buffer position:" - (buffer-name buf) - ", position " - (int-to-string (marker-position val))) - 'jump-to-register - 'insert-register)))) - ((and (consp val) (window-configuration-p (car val))) - (list "window configuration." - 'jump-to-register)) - ((and (consp val) (frame-configuration-p (car val))) - (list "frame configuration." - 'jump-to-register)) - ((and (consp val) (eq (car val) 'file)) - (list (concat "file:" - (prin1-to-string (cdr val)) - ".") - 'jump-to-register)) - ((and (consp val) (eq (car val) 'file-query)) - (list (concat "file:a file-query reference: file " - (car (cdr val)) - ", position " - (int-to-string (car (cdr (cdr val)))) - ".") - 'jump-to-register)) - ((consp val) - (let ((lines (format "%4d" (length val)))) - (list (format "%s: %s\n" lines - (truncate-string-to-width - (mapconcat 'identity (list (car val)) - "^J") (- (window-width) 15))) - 'insert-register))) - ((stringp val) - (list - ;; without properties - (concat (substring-no-properties - val 0 (min (length val) helm-register-max-offset)) - (if (> (length val) helm-register-max-offset) - "[...]" "")) - 'insert-register - 'append-to-register - 'prepend-to-register)) - ((vectorp val) - (list - "Undo-tree entry." - 'undo-tree-restore-state-from-register)) - (t - "GARBAGE!")) - collect (cons (format "Register %3s:\n %s" key (car string-actions)) - (cons char (cdr string-actions))))) + for key = (single-key-description char) + for string-actions = + (cond + ((numberp val) + (list (int-to-string val) + 'insert-register + 'increment-register)) + ((markerp val) + (let ((buf (marker-buffer val))) + (if (null buf) + (list "a marker in no buffer") + (list (concat + "a buffer position:" + (buffer-name buf) + ", position " + (int-to-string (marker-position val))) + 'jump-to-register + 'insert-register)))) + ((and (consp val) (window-configuration-p (car val))) + (list "window configuration." + 'jump-to-register)) + ((and (consp val) (frame-configuration-p (car val))) + (list "frame configuration." + 'jump-to-register)) + ((and (consp val) (eq (car val) 'file)) + (list (concat "file:" + (prin1-to-string (cdr val)) + ".") + 'jump-to-register)) + ((and (consp val) (eq (car val) 'file-query)) + (list (concat "file:a file-query reference: file " + (car (cdr val)) + ", position " + (int-to-string (car (cdr (cdr val)))) + ".") + 'jump-to-register)) + ((consp val) + (let ((lines (format "%4d" (length val)))) + (list (format "%s: %s\n" lines + (truncate-string-to-width + (mapconcat 'identity (list (car val)) + "^J") (- (window-width) 15))) + 'insert-register))) + ((stringp val) + (list + ;; without properties + (concat (substring-no-properties + val 0 (min (length val) helm-register-max-offset)) + (if (> (length val) helm-register-max-offset) + "[...]" "")) + 'insert-register + 'append-to-register + 'prepend-to-register)) + ((vectorp val) + (list + "Undo-tree entry." + 'undo-tree-restore-state-from-register)) + (t + "GARBAGE!")) + collect (cons (format "Register %3s:\n %s" key (car string-actions)) + (cons char (cdr string-actions))))) (defun helm-register-action-transformer (_actions register-and-functions) "Decide actions by the contents of register." (cl-loop with func-actions = - '((insert-register - "Insert Register" . - (lambda (c) (insert-register (car c)))) - (jump-to-register - "Jump to Register" . - (lambda (c) (jump-to-register (car c)))) - (append-to-register - "Append Region to Register" . - (lambda (c) (append-to-register - (car c) (region-beginning) (region-end)))) - (prepend-to-register - "Prepend Region to Register" . - (lambda (c) (prepend-to-register - (car c) (region-beginning) (region-end)))) - (increment-register - "Increment Prefix Arg to Register" . - (lambda (c) (increment-register - helm-current-prefix-arg (car c)))) - (undo-tree-restore-state-from-register - "Restore Undo-tree register" - (lambda (c) (and (fboundp 'undo-tree-restore-state-from-register) - (undo-tree-restore-state-from-register (car c)))))) - for func in (cdr register-and-functions) - for cell = (assq func func-actions) - when cell - collect (cdr cell))) + '((insert-register + "Insert Register" . + (lambda (c) (insert-register (car c)))) + (jump-to-register + "Jump to Register" . + (lambda (c) (jump-to-register (car c)))) + (append-to-register + "Append Region to Register" . + (lambda (c) (append-to-register + (car c) (region-beginning) (region-end)))) + (prepend-to-register + "Prepend Region to Register" . + (lambda (c) (prepend-to-register + (car c) (region-beginning) (region-end)))) + (increment-register + "Increment Prefix Arg to Register" . + (lambda (c) (increment-register + helm-current-prefix-arg (car c)))) + (undo-tree-restore-state-from-register + "Restore Undo-tree register" + (lambda (c) (and (fboundp 'undo-tree-restore-state-from-register) + (undo-tree-restore-state-from-register (car c)))))) + for func in (cdr register-and-functions) + for cell = (assq func func-actions) + when cell + collect (cdr cell))) ;;;###autoload (defun helm-mark-ring () diff --git a/helm-sys.el b/helm-sys.el index a1ec822bf..17ab3930a 100644 --- a/helm-sys.el +++ b/helm-sys.el @@ -80,7 +80,7 @@ A format string where %s will be replaced with `frame-width'." "Transformer for `helm-top'. Return empty string for non--valid candidates." (cl-loop for disp in candidates collect - (if (string-match "^ *[0-9]+" disp) disp (cons disp "")))) + (if (string-match "^ *[0-9]+" disp) disp (cons disp "")))) (defun helm-top-action-transformer (actions _candidate) "Action transformer for `top'. @@ -137,12 +137,12 @@ Show actions only on line starting by a PID." (helm-top-transformer (if helm-top-sort-fn (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 (if (cdr header-cands) - (butlast header-cands) - header-cands) - (sort pid-cands helm-top-sort-fn))) + if (string-match "^ *[0-9]+" c) collect c into pid-cands + else collect c into header-cands + finally return (append (if (cdr header-cands) + (butlast header-cands) + header-cands) + (sort pid-cands helm-top-sort-fn))) candidates) source)) @@ -232,11 +232,11 @@ Show actions only on line starting by a PID." "--screen" (helm-xrandr-screen) "-q") (goto-char 1) (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) - collect mode into modes - finally return modes)))) + while (re-search-forward " \\([0-9]+x[0-9]+\\)" nil t) + for mode = (match-string 1) + unless (member mode modes) + collect mode into modes + finally return modes)))) (action ("Change Resolution" . (lambda (mode) diff --git a/helm-tags.el b/helm-tags.el index c2047027c..2b2d21aac 100644 --- a/helm-tags.el +++ b/helm-tags.el @@ -83,8 +83,8 @@ one match." ;; (defvar helm-ctags-modes '( c-mode c++-mode awk-mode csharp-mode java-mode javascript-mode lua-mode - makefile-mode pascal-mode perl-mode cperl-mode php-mode python-mode - scheme-mode sh-mode slang-mode sql-mode tcl-mode )) + makefile-mode pascal-mode perl-mode cperl-mode php-mode python-mode + scheme-mode sh-mode slang-mode sql-mode tcl-mode )) (defun helm-ctags-init () (when (and buffer-file-name @@ -101,16 +101,16 @@ one match." (forward-line 2) (delete-region (point-min) (point)) (cl-loop while (and (not (eobp)) (search-forward "\001" (point-at-eol) t)) - for lineno-start = (point) - for lineno = (buffer-substring - lineno-start - (1- (search-forward "," (point-at-eol) t))) - do - (forward-line 0) - (insert (format "%5s:" lineno)) - (search-forward "\177" (point-at-eol) t) - (delete-region (1- (point)) (point-at-eol)) - (forward-line 1))))) + for lineno-start = (point) + for lineno = (buffer-substring + lineno-start + (1- (search-forward "," (point-at-eol) t))) + do + (forward-line 0) + (insert (format "%5s:" lineno)) + (search-forward "\177" (point-at-eol) t) + (delete-region (1- (point)) (point-at-eol)) + (forward-line 1))))) (defvar helm-source-ctags '((name . "Exuberant ctags") @@ -164,16 +164,16 @@ If not found in CURRENT-DIR search in upper directory." (file-regular-p tag-path) (file-readable-p tag-path)))))) (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 (cl-return nil) - ;; Or search upper directories. - else - do (cl-incf count) - (setq current-dir (expand-file-name (concat current-dir "../"))) - finally return current-dir))) + 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 (cl-return nil) + ;; Or search upper directories. + else + do (cl-incf count) + (setq current-dir (expand-file-name (concat current-dir "../"))) + finally return current-dir))) (defun helm-etags-get-header-name (_x) "Create header name for this helm etags session." @@ -192,20 +192,20 @@ If not found in CURRENT-DIR search in upper directory." (kill-buffer)))) (progress-reporter (make-progress-reporter "Loading tag file..." 0 max))) (cl-loop - with fname - with cand - for i in split for count from 0 - for elm = (unless (string-match "^\x0c" i) - (helm-aif (string-match "\177" i) - (substring i 0 it) - i)) - do (cond ((and elm (string-match "^\\([^,]+\\),[0-9]+$" elm)) - (setq fname (match-string 1 elm))) - (elm (setq cand (concat fname ": " elm))) - (t (setq cand nil))) - when cand do (progn - (insert (concat cand "\n")) - (progress-reporter-update progress-reporter count))))) + with fname + with cand + for i in split for count from 0 + for elm = (unless (string-match "^\x0c" i) + (helm-aif (string-match "\177" i) + (substring i 0 it) + i)) + do (cond ((and elm (string-match "^\\([^,]+\\),[0-9]+$" elm)) + (setq fname (match-string 1 elm))) + (elm (setq cand (concat fname ": " elm))) + (t (setq cand nil))) + when cand do (progn + (insert (concat cand "\n")) + (progress-reporter-update progress-reporter count))))) (defun helm-etags-init () "Feed `helm-buffer' using `helm-etags-cache' or tag file. @@ -271,10 +271,10 @@ If no entry in cache, create one." (helm-log-run-hook 'helm-goto-line-before-hook) (let* ((split (helm-etags-split-line candidate)) (fname (cl-loop for tagf being the hash-keys of helm-etags-cache - for f = (expand-file-name - (car split) (file-name-directory tagf)) - when (file-exists-p f) - return f)) + for f = (expand-file-name + (car split) (file-name-directory tagf)) + when (file-exists-p f) + return f)) (elm (cadr split))) (if (null fname) (error "file %s not found" fname) @@ -315,8 +315,8 @@ This function aggregates three sources of tag files: (if (cl-notany 'file-exists-p tag-files) (message "Error: No tag file found. Create with etags shell command, or visit with `find-tag' or `visit-tags-table'.") (cl-loop for k being the hash-keys of helm-etags-cache - unless (member k tag-files) - do (remhash k helm-etags-cache)) + unless (member k tag-files) + do (remhash k helm-etags-cache)) (mapc (lambda (f) (when (or (equal arg '(4)) (and helm-etags-mtime-alist diff --git a/helm-utils.el b/helm-utils.el index 9c6ccb5b0..0aa68ecf5 100644 --- a/helm-utils.el +++ b/helm-utils.el @@ -55,7 +55,7 @@ and `helm-imenu-default-action'.") "The register where `helm-save-pos-to-register-before-jump' save position.") (defface helm-selection-line - '((t (:background "IndianRed4" :underline t))) + '((t (:background "IndianRed4" :underline t))) "Face used in the `helm-current-buffer' when jumping to candidate." :group 'helm-utils) @@ -156,14 +156,14 @@ Return nil if DIR is not an existing directory." (funcall handler 'file-in-directory-p file dir) (when (file-directory-p dir) (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 "/")) - for p = (string-match "^/" f1) - for i in ls1 for j in ls2 - when (string= i j) - concat (if p (concat "/" i) (concat i "/")) into root - finally return (file-equal-p (file-truename root) f2))))))) + with f2 = (file-truename dir) + with ls1 = (or (split-string f1 "/" t) (list "/")) + with ls2 = (or (split-string f2 "/" t) (list "/")) + for p = (string-match "^/" f1) + for i in ls1 for j in ls2 + when (string= i j) + concat (if p (concat "/" i) (concat i "/")) into root + finally return (file-equal-p (file-truename root) f2))))))) ;; CUA workaround @@ -186,9 +186,9 @@ Return nil if DIR is not an existing directory." (call-process "lpstat" nil t nil "-a") (split-string (buffer-string) "\n")))) (cl-loop for p in printer-list - for printer = (car (split-string p)) - when printer - collect printer)))) + for printer = (car (split-string p)) + when printer + collect printer)))) ;; Shut up byte compiler in emacs24*. (defun helm-switch-to-buffer (buffer-or-name) @@ -204,11 +204,11 @@ 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))) `(cl-loop for c ,key ,seq - for index from 0 - when (funcall ,test c ,item) - if ,all collect index into ls - else return index - finally return ls))) + for index from 0 + when (funcall ,test c ,item) + if ,all collect index into ls + else return index + finally return ls))) (defun helm-substring (str width) "Return the substring of string STR from 0 to WIDTH. @@ -225,26 +225,26 @@ 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." (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 - (concat ini-str endstr (make-string (- width sw) ? )))) + then (substring ini-str 0 (1- (length ini-str))) + for sw = (string-width ini-str) + when (<= sw width) return + (concat ini-str endstr (make-string (- width sw) ? )))) (defun helm-string-multibyte-p (str) "Check if string STR contains multibyte characters." (cl-loop for c across str - thereis (> (char-width c) 1))) + thereis (> (char-width c) 1))) (defun helm-get-pid-from-process-name (process-name) "Get pid from running process PROCESS-NAME." (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)) + for pid in process-list + for process = (assoc-default 'comm (process-attributes pid)) + when (and process (string-match process-name process)) + return pid)) (cl-defun helm-current-buffer-narrowed-p (&optional - (buffer helm-current-buffer)) + (buffer helm-current-buffer)) "Check if BUFFER is narrowed. Default is `helm-current-buffer'." (with-current-buffer buffer @@ -312,10 +312,10 @@ With a numeric prefix arg show only the ARG number of candidates." (with-current-buffer helm-buffer (goto-char (point-min)) (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)) - do (forward-line 1)))) + 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)) + do (forward-line 1)))) (defun helm-files-match-only-basename (candidate) "Allow matching only basename of file when \" -b\" is added at end of pattern. @@ -337,20 +337,20 @@ even is \" -b\" is specified." (defun helm-skip-entries (seq regexp-list) "Remove entries which matches one of REGEXP-LIST from SEQ." (cl-loop for i in seq - unless (cl-loop for regexp in regexp-list - thereis (and (stringp i) - (string-match regexp i))) - collect i)) + unless (cl-loop for regexp in regexp-list + thereis (and (stringp i) + (string-match regexp i))) + collect i)) (defun helm-shadow-entries (seq regexp-list) "Put shadow property on entries in SEQ matching a regexp in REGEXP-LIST." (let ((face 'italic)) (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) - else collect i))) + if (cl-loop for regexp in regexp-list + thereis (and (stringp i) + (string-match regexp i))) + collect (propertize i 'face face) + else collect i))) (defun helm-stringify (str-or-sym) "Get string of STR-OR-SYM." @@ -394,11 +394,11 @@ It is much faster, especially in large lists. A test function can be provided with TEST argument key. Default is `eq'." (cl-loop with cont = (make-hash-table :test test) - for elm in seq - unless (gethash elm cont) - do (puthash elm elm cont) - finally return - (cl-loop for i being the hash-values in cont collect i))) + for elm in seq + unless (gethash elm cont) + do (puthash elm elm cont) + finally return + (cl-loop for i being the hash-values in cont collect i))) ;;;###autoload (defun helm-quit-and-find-file () @@ -467,22 +467,22 @@ instead of `helm-walk-ignore-directories'." helm-walk-ignore-directories))) (cl-loop with ls = (directory-files dir t directory-files-no-dot-files-regexp) - for f in ls - if (file-directory-p f) - do (progn (when directories + for f in ls + if (file-directory-p f) + do (progn (when directories + (push (funcall fn f) result)) + ;; Don't recurse in directory symlink. + (unless (file-symlink-p f) + (funcall ls-R f))) + else do + (if match + (and (if (functionp match) + (funcall match f) + (and (stringp match) + (string-match + match (file-name-nondirectory f)))) (push (funcall fn f) result)) - ;; Don't recurse in directory symlink. - (unless (file-symlink-p f) - (funcall ls-R f))) - else do - (if match - (and (if (functionp match) - (funcall match f) - (and (stringp match) - (string-match - match (file-name-nondirectory f)))) - (push (funcall fn f) result)) - (push (funcall fn f) result)))))) + (push (funcall fn f) result)))))) (funcall ls-R directory) (nreverse result))) @@ -500,7 +500,7 @@ that is sorting is done against real value of candidate." ((and (string-match " " helm-pattern) (string-match (concat "\\_<" (car lst)) str) (cl-loop for r in (cdr lst) - always (string-match r str))) 3) + always (string-match r str))) 3) ((and (string-match " " helm-pattern) (cl-loop for r in lst always (string-match r str))) 2) ((string-match r2 str) 1) @@ -548,18 +548,18 @@ KBSIZE if a floating point number, default value is 1024.0." (K (cons "K" (/ size helm-default-kbsize))) (B (cons "B" size))) (cl-loop with result = B - for (a . b) in - (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)))))) + for (a . b) in + (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)))))) (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)) + status size mode gid-change inode device-num dired human-size + mode-type mode-owner mode-group mode-other (string t)) "Return `file-attributes' elements of FILE separately according to key value. Availables keys are: - TYPE: Same as nth 0 `files-attributes' if STRING is nil @@ -587,8 +587,8 @@ If you want the same behavior as `files-attributes' , However when STRING is non--nil, time and type value are different from what you have in `file-attributes'." (let* ((all (cl-destructuring-bind - (type links uid gid access-time modif-time - status size mode gid-change inode device-num) + (type links uid gid access-time modif-time + status size mode gid-change inode device-num) (file-attributes file string) (list :type (if string (cond ((stringp type) "symlink") ; fname @@ -649,19 +649,19 @@ you have in `file-attributes'." "Split mode file attributes STR into a proplist. If STRING is non--nil return instead a space separated string." (cl-loop with type = (substring str 0 1) - with cdr = (substring str 1) - for i across cdr - for count from 1 - if (<= count 3) - concat (string i) into user - if (and (> count 3) (<= count 6)) - concat (string i) into group - if (and (> count 6) (<= count 9)) - concat (string i) into other - finally return - (if string - (mapconcat 'identity (list type user group other) " ") - (list :mode-type type :user user :group group :other other)))) + with cdr = (substring str 1) + for i across cdr + for count from 1 + if (<= count 3) + concat (string i) into user + if (and (> count 3) (<= count 6)) + concat (string i) into group + if (and (> count 6) (<= count 9)) + concat (string i) into other + finally return + (if string + (mapconcat 'identity (list type user group other) " ") + (list :mode-type type :user user :group group :other other)))) (defun helm-current-directory () "Return current-directory name at point. @@ -677,14 +677,14 @@ Useful in dired buffers when there is inserted subdirs." `(let* ((,buffer (temp-buffer-window-setup ,buffer-or-name)) ,window) (unwind-protect - (with-current-buffer ,buffer - (dired-format-columns-of-files ,candidates) - (select-window - (setq ,window (temp-buffer-window-show - ,buffer - '(display-buffer-below-selected - (window-height . fit-window-to-buffer))))) - (progn ,@body)) + (with-current-buffer ,buffer + (dired-format-columns-of-files ,candidates) + (select-window + (setq ,window (temp-buffer-window-show + ,buffer + '(display-buffer-below-selected + (window-height . fit-window-to-buffer))))) + (progn ,@body)) (quit-window 'kill ,window))))) ;;; Persistent Action Helpers diff --git a/helm-w3m.el b/helm-w3m.el index 1a128d4cc..eb7d1234e 100644 --- a/helm-w3m.el +++ b/helm-w3m.el @@ -93,9 +93,9 @@ http://emacs-w3m.namazu.org/") (defun helm-highlight-w3m-bookmarks (bookmarks _source) (cl-loop for i in bookmarks - collect (propertize - i 'face 'helm-w3m-bookmarks - 'help-echo (helm-w3m-bookmarks-get-value i)))) + collect (propertize + i 'face 'helm-w3m-bookmarks + 'help-echo (helm-w3m-bookmarks-get-value i)))) (defun helm-w3m-delete-bookmark (elm) diff --git a/helm-yaoddmuse.el b/helm-yaoddmuse.el index 7df533248..70ec183d4 100644 --- a/helm-yaoddmuse.el +++ b/helm-yaoddmuse.el @@ -120,8 +120,8 @@ If load is non--nil load the file and feed `yaoddmuse-pages-hash'." (erase-buffer) (insert "(puthash \"EmacsWiki\" '(") (cl-loop for i in (gethash "EmacsWiki" yaoddmuse-pages-hash) - do - (insert (concat "(\"" (car i) "\") "))) + do + (insert (concat "(\"" (car i) "\") "))) (insert ") yaoddmuse-pages-hash)\n") (save-buffer) (kill-buffer (current-buffer)) diff --git a/helm.el b/helm.el index 34134933f..2ed179f2f 100644 --- a/helm.el +++ b/helm.el @@ -77,7 +77,7 @@ Run each function of FUNCTIONS list in turn when called within DELAY seconds." (defun helm-run-multi-key-command (functions iterator delay) (let ((fn #'(lambda () (cl-loop for count from 1 to (length functions) - collect count))) + collect count))) next) (unless (and (symbol-value iterator) ;; Reset iterator when another key is pressed. @@ -335,8 +335,8 @@ have to implement a similar feature directly in the process. See in helm-grep.el how it is implemented." :group 'helm :type '(choice (const :tag "Ignore case" t) - (const :tag "Respect case" nil) - (other :tag "Smart" 'smart))) + (const :tag "Respect case" nil) + (other :tag "Smart" 'smart))) (defcustom helm-file-name-case-fold-search (if (memq system-type @@ -446,53 +446,53 @@ This happen when using `helm-next/previous-line'." ;; ;; (defface helm-source-header - '((((background dark)) - :background "#22083397778B" - :foreground "white" - :weight bold :height 1.3 :family "Sans Serif") - (((background light)) - :background "#abd7f0" - :foreground "black" - :weight bold :height 1.3 :family "Sans Serif")) + '((((background dark)) + :background "#22083397778B" + :foreground "white" + :weight bold :height 1.3 :family "Sans Serif") + (((background light)) + :background "#abd7f0" + :foreground "black" + :weight bold :height 1.3 :family "Sans Serif")) "Face for source header in the helm buffer." :group 'helm) (defface helm-visible-mark - '((((min-colors 88) (background dark)) - (:background "green1" :foreground "black")) - (((background dark)) - (:background "green" :foreground "black")) - (((background light)) :background "#d1f5ea") - (((min-colors 88)) - (:background "green1")) - (t (:background "green"))) + '((((min-colors 88) (background dark)) + (:background "green1" :foreground "black")) + (((background dark)) + (:background "green" :foreground "black")) + (((background light)) :background "#d1f5ea") + (((min-colors 88)) + (:background "green1")) + (t (:background "green"))) "Face for visible mark." :group 'helm) (defface helm-header - '((t (:inherit header-line))) + '((t (:inherit header-line))) "Face for header lines in the helm buffer." :group 'helm) (defface helm-candidate-number - '((((background dark)) :background "Yellow" :foreground "black") - (((background light)) :background "#faffb5" :foreground "black")) + '((((background dark)) :background "Yellow" :foreground "black") + (((background light)) :background "#faffb5" :foreground "black")) "Face for candidate number in mode-line." :group 'helm) (defface helm-selection - '((((background dark)) :background "ForestGreen" :underline t) - (((background light)) :background "#b5ffd1" :underline t)) + '((((background dark)) :background "ForestGreen" :underline t) + (((background light)) :background "#b5ffd1" :underline t)) "Face for currently selected item in the helm buffer." :group 'helm) (defface helm-separator - '((((background dark)) :foreground "red") - (((background light)) :foreground "#ffbfb5")) + '((((background dark)) :foreground "red") + (((background light)) :foreground "#ffbfb5")) "Face for multiline source separator." :group 'helm) (defface helm-action - '((t (:underline t))) + '((t (:underline t))) "Face for action lines in the helm action buffer." :group 'helm) @@ -749,12 +749,12 @@ Use optional arguments ARGS like in `format'." "Get function name calling `helm-log'. The original idea is from `tramp-debug-message'." (cl-loop with exclude-func-re = "^helm-\\(?:interpret\\|log\\|.*funcall\\)" - for btn from 1 to 40 - 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))) - return fn)) + for btn from 1 to 40 + 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))) + return fn)) (defun helm-log-error (&rest args) "Accumulate error messages into `helm-issued-errors'. @@ -850,14 +850,14 @@ Like `this-command' but return the real command, not `exit-minibuffer' or unwanted functions." (cl-loop with bl = '(helm-exit-minibuffer exit-minibuffer) - for count from 1 to 50 - for btf = (backtrace-frame count) - for fn = (cl-second btf) - if (and (commandp fn) (not (memq fn bl))) return fn - else - if (and (eq fn 'call-interactively) - (> (length btf) 2)) - return (cadr (cdr btf)))) + for count from 1 to 50 + for btf = (backtrace-frame count) + for fn = (cl-second btf) + if (and (commandp fn) (not (memq fn bl))) return fn + else + if (and (eq fn 'call-interactively) + (> (length btf) 2)) + return (cadr (cdr btf)))) ;; Helm API @@ -905,7 +905,7 @@ not `exit-minibuffer' or unwanted functions." helm-restored-variables))) (unwind-protect (progn ,@body) (cl-loop for (var . value) in orig-vars - do (set var value)) + do (set var value)) (helm-log "restore variables")))) (defmacro with-helm-default-directory (directory &rest body) @@ -926,7 +926,7 @@ not `exit-minibuffer' or unwanted functions." `(progn (defun ,fun () (unwind-protect - (progn ,@body) + (progn ,@body) (remove-hook ,hook (quote ,fun)))) (add-hook ,hook (quote ,fun))))) @@ -960,9 +960,9 @@ if SRC is omitted, use current source." (and (helm-attr attribute-name src) t)) (cl-defun helm-attrset (attribute-name value - &optional - (src (helm-get-current-source)) - alter-type) + &optional + (src (helm-get-current-source)) + alter-type) "Set the value of ATTRIBUTE-NAME of source SRC to VALUE. If ATTRIBUTE-NAME doesn't exists in source it is created with value VALUE. If ALTER-TYPE is non--nil alter the value of ATTRIBUTE-NAME in `helm-attributes' @@ -1007,10 +1007,10 @@ arg TYPE is an existing type defined in `helm-type-attributes'." (let ((len (length seq))) (when (> index len) (setq index len)) (cl-loop for i in seq - for count from 1 collect i - when (= count index) - if (listp elm) append elm - else collect elm))) + for count from 1 collect i + when (= count index) + if (listp elm) append elm + else collect elm))) (defun helm-add-action-to-source (name fn source &optional index) "Add new action NAME linked to function FN to SOURCE. @@ -1042,7 +1042,7 @@ associated to name." (helm-attrset 'action (delete del-action actions) source))) (cl-defun helm-add-action-to-source-if (name fn source predicate - &optional (index 4) test-only) + &optional (index 4) test-only) "Add new action NAME linked to function FN to SOURCE. Action is added only if current candidate match PREDICATE. This function add an entry in the `action-transformer' attribute @@ -1142,21 +1142,21 @@ Attributes: - candidates-buffer candidates, volatile and match attribute are created." (cond - ;; action - ((helm-action-window) - helm-sources) - ;; memoized - (helm-compiled-sources) - ;; first time - (t - (prog1 - (setq helm-compiled-sources - (helm-compile-sources - helm-sources helm-compile-source-functions)) - (helm-log-eval helm-compiled-sources))))) + ;; action + ((helm-action-window) + helm-sources) + ;; memoized + (helm-compiled-sources) + ;; first time + (t + (prog1 + (setq helm-compiled-sources + (helm-compile-sources + helm-sources helm-compile-source-functions)) + (helm-log-eval helm-compiled-sources))))) (cl-defun helm-get-selection (&optional (buffer nil buffer-s) - force-display-part) + force-display-part) "Return the currently selected item or nil. if BUFFER is nil or unspecified, use helm-buffer as default value. If FORCE-DISPLAY-PART is non-nil, return the display string. @@ -1223,8 +1223,8 @@ Allow also checking if helm-buffer contain candidates." (goto-char header-pos) (helm-current-line-contents)))) (cl-loop for source in (helm-get-sources) thereis - (and (equal (assoc-default 'name source) source-name) - source)))))))) + (and (equal (assoc-default 'name source) source-name) + source)))))))) (defun helm-buffer-is-modified (buffer) "Return non-nil when BUFFER is modified since `helm' was invoked." @@ -1257,8 +1257,8 @@ DOC is displayed in `helm-type-attributes' docstring. Use this function is better than setting `helm-type-attributes' directly." (cl-loop for i in definition do - ;; without `ignore-errors', error at emacs22 - (ignore-errors (setf i (delete nil i)))) + ;; without `ignore-errors', error at emacs22 + (ignore-errors (setf i (delete nil i)))) (helm-add-type-attribute type definition) (and doc (helm-document-type-attribute type doc)) nil) @@ -1327,7 +1327,7 @@ Each KEYS VARNAME of elements of BINDING will be bound locally to VALUE by `helm-create-helm-buffer'." (setq helm-let-variables binding) (unwind-protect - (funcall bodyfunc) + (funcall bodyfunc) (setq helm-let-variables nil))) @@ -1345,7 +1345,7 @@ Return the result of last function call." (funs (if (functionp functions) (list functions) functions))) (helm-log-eval helm-source-name functions args) (cl-loop with result for fn in funs - do (setq result (apply fn args)) finally return result))) + 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." @@ -1379,22 +1379,22 @@ in the source where point is." (if (helm-pos-multiline-p) (save-excursion (cl-loop with count-multi = 1 - 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 (cl-incf count-multi) - finally return count-multi)) + 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 (cl-incf count-multi) + finally return count-multi)) (save-excursion (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 (cl-incf ln) - do (forward-line 1) finally return ln))))))) + while (not (if in-current-source + (or (helm-pos-header-line-p) (eobp)) + (eobp))) + unless (helm-pos-header-line-p) + 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." @@ -1451,7 +1451,7 @@ This is used in transformers to modify candidates list." ;; Core: entry point (defconst helm-argument-keys '(:sources :input :prompt :resume - :preselect :buffer :keymap :default :history)) + :preselect :buffer :keymap :default :history)) (defun helm (&rest plist) "Main function to execute helm sources. @@ -1601,19 +1601,19 @@ in source." ;; :candidate-number-limit 4)) ;; ==> ((helm-candidate-number-limit . 4)) (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 - (concat "helm-" symname))) - unless (memq key helm-argument-keys) - collect (cons sym value))) + for symname = (substring (symbol-name key) 1) + for sym = (intern (if (string-match "^helm-" symname) + symname + (concat "helm-" symname))) + unless (memq key helm-argument-keys) + collect (cons sym value))) ;;; Core: entry point helper (defun helm-internal (&optional - any-sources any-input - any-prompt any-resume - any-preselect any-buffer - any-keymap any-default any-history) + any-sources any-input + any-prompt any-resume + any-preselect any-buffer + any-keymap any-default any-history) "The internal helm function called by `helm'. For ANY-SOURCES ANY-INPUT ANY-PROMPT ANY-RESUME ANY-PRESELECT ANY-BUFFER and ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'." @@ -1634,41 +1634,41 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'." (helm-maybe-use-default-as-input (or helm-maybe-use-default-as-input ; it is let-bounded so use it. (cl-loop for s in (helm-normalize-sources any-sources) - thereis (memq s helm-sources-using-default-as-input))))) + thereis (memq s helm-sources-using-default-as-input))))) ;; cua-mode overhide local helm bindings. ;; disable this stupid thing if enabled. (and cua-mode (cua-mode -1)) (add-hook 'post-command-hook 'helm--maybe-update-keymap) (unwind-protect - (condition-case _v - (let (;; `helm-source-name' is non-nil - ;; when `helm' is invoked by action, reset it. - helm-source-name - helm-current-source - helm-in-persistent-action - helm-quit - (helm-buffer (or any-buffer helm-buffer))) - (with-helm-restore-variables - (helm-initialize any-resume any-input - any-default any-sources) - (helm-display-buffer helm-buffer) - (helm-log "show prompt") - (unwind-protect - (helm-read-pattern-maybe - any-prompt any-input any-preselect - any-resume any-keymap any-default - (when (and any-history (symbolp any-history)) - any-history)) - (helm-cleanup))) - (prog1 (unless helm-quit - (with-helm-temp-hook 'helm-cleanup-hook - (setq overriding-terminal-local-map old-overriding-local-map)) - (helm-execute-selection-action)) - (helm-log (concat "[End session] " (make-string 41 ?-))))) - (quit - (helm-restore-position-on-quit) - (helm-log (concat "[End session (quit)] " (make-string 34 ?-))) - nil)) + (condition-case _v + (let (;; `helm-source-name' is non-nil + ;; when `helm' is invoked by action, reset it. + helm-source-name + helm-current-source + helm-in-persistent-action + helm-quit + (helm-buffer (or any-buffer helm-buffer))) + (with-helm-restore-variables + (helm-initialize any-resume any-input + any-default any-sources) + (helm-display-buffer helm-buffer) + (helm-log "show prompt") + (unwind-protect + (helm-read-pattern-maybe + any-prompt any-input any-preselect + any-resume any-keymap any-default + (when (and any-history (symbolp any-history)) + any-history)) + (helm-cleanup))) + (prog1 (unless helm-quit + (with-helm-temp-hook 'helm-cleanup-hook + (setq overriding-terminal-local-map old-overriding-local-map)) + (helm-execute-selection-action)) + (helm-log (concat "[End session] " (make-string 41 ?-))))) + (quit + (helm-restore-position-on-quit) + (helm-log (concat "[End session (quit)] " (make-string 34 ?-))) + nil)) (remove-hook 'post-command-hook 'helm--maybe-update-keymap) (if (fboundp 'advice-add) (advice-remove 'tramp-read-passwd #'helm--advice-tramp-read-passwd) @@ -1767,17 +1767,17 @@ Call `helm' with only ANY-SOURCES and ANY-BUFFER as args." helm-last-frame-or-window-configuration) (orig-one-window-p helm-onewindow-p)) (unwind-protect - (let (helm-current-position - helm-current-buffer - helm-pattern - (helm-buffer (or (cl-getf same-as-helm :buffer) - (nth 5 same-as-helm) - "*Helm*")) - helm-sources - helm-compiled-sources - (helm-full-frame t) - (enable-recursive-minibuffers t)) - (apply #'helm same-as-helm)) + (let (helm-current-position + helm-current-buffer + helm-pattern + (helm-buffer (or (cl-getf same-as-helm :buffer) + (nth 5 same-as-helm) + "*Helm*")) + helm-sources + helm-compiled-sources + (helm-full-frame t) + (enable-recursive-minibuffers t)) + (apply #'helm same-as-helm)) (with-current-buffer orig-helm-buffer (setq helm-alive-p t) ; Nested session set this to nil on exit. (setq helm-buffer orig-helm-buffer) @@ -2044,7 +2044,7 @@ It is intended to use this only in `helm-initial-setup'." (helm-initialize-persistent-action) (helm-log-eval helm-display-function helm-let-variables) (cl-loop for (var . val) in helm-let-variables - do (set (make-local-variable var) val)) + do (set (make-local-variable var) val)) (setq truncate-lines helm-truncate-lines) ; already local. (setq cursor-type nil) (setq mode-name "Helm")) @@ -2052,8 +2052,8 @@ It is intended to use this only in `helm-initial-setup'." (get-buffer helm-buffer))) (defun helm-read-pattern-maybe (any-prompt any-input - any-preselect any-resume any-keymap - any-default any-history) + any-preselect any-resume any-keymap + any-default any-history) "Read pattern with prompt ANY-PROMPT and initial input ANY-INPUT. For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'." (if (and (helm-resume-p any-resume) @@ -2122,22 +2122,22 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'." (with-helm-current-buffer (thing-at-point 'symbol))))) (unwind-protect - (minibuffer-with-setup-hook - #'(lambda () - (setq timer (run-with-idle-timer - (max helm-input-idle-delay 0.001) 'repeat - #'(lambda () - ;; Stop updating when in persistent action - ;; or when `helm-suspend-update-flag' is - ;; non--nil. - (unless (or helm-in-persistent-action - helm-suspend-update-flag) - (save-selected-window - (helm-check-minibuffer-input) - (helm-print-error-messages))))))) - (read-from-minibuffer (or any-prompt "pattern: ") - any-input helm-map - nil hist tap t)) + (minibuffer-with-setup-hook + #'(lambda () + (setq timer (run-with-idle-timer + (max helm-input-idle-delay 0.001) 'repeat + #'(lambda () + ;; Stop updating when in persistent action + ;; or when `helm-suspend-update-flag' is + ;; non--nil. + (unless (or helm-in-persistent-action + helm-suspend-update-flag) + (save-selected-window + (helm-check-minibuffer-input) + (helm-print-error-messages))))))) + (read-from-minibuffer (or any-prompt "pattern: ") + any-input helm-map + nil hist tap t)) (when timer (cancel-timer timer) (setq timer nil))))))))) (defun helm-exit-or-quit-maybe () @@ -2173,9 +2173,9 @@ This can be useful for e.g writing quietly a complex regexp." (setq overriding-terminal-local-map nil) (let (stimers) (unwind-protect - (progn - (setq stimers (with-timeout-suspend)) - ad-do-it) + (progn + (setq stimers (with-timeout-suspend)) + ad-do-it) (with-timeout-unsuspend stimers) (setq helm-suspend-update-flag nil)))) @@ -2184,8 +2184,8 @@ This can be useful for e.g writing quietly a complex regexp." (setq helm-suspend-update-flag t) (setq overriding-terminal-local-map nil) (unwind-protect - ;; No need to suspend timer in emacs-24.4 - (apply old--fn args) + ;; No need to suspend timer in emacs-24.4 + (apply old--fn args) (setq helm-suspend-update-flag nil))) (defun helm--maybe-update-keymap () @@ -2276,9 +2276,9 @@ Helm plug-ins are realized by this function." (mapcar (lambda (source) (cl-loop with src = (if (listp source) source (symbol-value source)) - for f in funcs - do (setq src (funcall f src)) - finally (cl-return src))) + for f in funcs + do (setq src (funcall f src)) + finally (cl-return src))) sources)) @@ -2367,10 +2367,10 @@ ARGS is (cand1 cand2 ...) or ((disp1 . real1) (disp2 . real2) ...) => ((\"1st\" . \"FOO\") (\"2nd\" . \"BAR\")) " (cl-loop for arg in args - if (consp arg) - collect (cons (car arg) (funcall function (cdr arg))) - else - collect (funcall function arg))) + if (consp arg) + collect (cons (car arg) (funcall function (cdr arg))) + else + collect (funcall function arg))) (defun helm-process-candidate-transformer (candidates source) "Execute `candidate-transformer' function(s) on CANDIDATES in SOURCE." @@ -2389,7 +2389,7 @@ ARGS is (cand1 cand2 ...) or ((disp1 . real1) (disp2 . real2) ...) `(helm-aif (assoc-default 'filter-one-by-one ,source) (if (listp it) (cl-loop for f in it - do (setq ,candidate (funcall f ,candidate))) + do (setq ,candidate (funcall f ,candidate))) (setq ,candidate (funcall it ,candidate))))) (defun helm--initialize-one-by-one-candidates (candidates source) @@ -2398,8 +2398,8 @@ Return CANDIDATES when pattern is empty." (helm-aif (and (string= helm-pattern "") (assoc-default 'filter-one-by-one source)) (cl-loop for cand in candidates - do (helm--maybe-process-filter-one-by-one-candidate cand source) - collect cand) + do (helm--maybe-process-filter-one-by-one-candidate cand source) + collect cand) candidates)) (defun helm-process-filtered-candidate-transformer-maybe @@ -2474,7 +2474,7 @@ Default function to match candidates according to `helm-pattern'." (if (listp matchfns) matchfns (list matchfns)))) (defmacro helm--accumulate-candidates (candidate newmatches - hash item-count limit source) + hash item-count limit source) "Add CAND into NEWMATCHES and use HASH to uniq NEWMATCHES. Argument ITEM-COUNT count the matches. if ITEM-COUNT reaches LIMIT, exit from inner loop." @@ -2592,11 +2592,11 @@ and `helm-pattern'." (defun helm--compute-sources (src-list) (cl-loop with matches = (helm--maybe-use-while-no-input (cl-loop for src in src-list - collect (helm-compute-matches src))) - when (eq matches t) do (setq matches nil) - for src in src-list - for mtc in matches - do (helm-render-source src mtc))) + collect (helm-compute-matches src))) + when (eq matches t) do (setq matches nil) + for src in src-list + for mtc in matches + do (helm-render-source src mtc))) (cl-defun helm-process-delayed-sources (delayed-sources &optional preselect source) "Process helm DELAYED-SOURCES. @@ -2646,27 +2646,27 @@ is done on whole `helm-buffer' and not on current source." (let (normal-sources delayed-sources) (unwind-protect - (progn - ;; Iterate over all the sources - (cl-loop for source in (cl-remove-if-not - 'helm-update-source-p (helm-get-sources)) - if (helm-delayed-source-p source) - ;; Delayed sources just get collected for later - ;; processing - collect source into ds - else - ;; Collect the normal sources - collect source into ns - ;; Export the variables from cl-loop - finally (setq delayed-sources ds - normal-sources ns)) - (erase-buffer) - ;; Render all the sources into the helm buffer after - ;; calculating all candidates. - ;; Candidates must be computed AFTER erasing buffer - ;; even if it cause flickering; Doing so avoid - ;; unexpected results when executing actions. - (helm--compute-sources normal-sources)) + (progn + ;; Iterate over all the sources + (cl-loop for source in (cl-remove-if-not + 'helm-update-source-p (helm-get-sources)) + if (helm-delayed-source-p source) + ;; Delayed sources just get collected for later + ;; processing + collect source into ds + else + ;; Collect the normal sources + collect source into ns + ;; Export the variables from cl-loop + finally (setq delayed-sources ds + normal-sources ns)) + (erase-buffer) + ;; Render all the sources into the helm buffer after + ;; calculating all candidates. + ;; Candidates must be computed AFTER erasing buffer + ;; even if it cause flickering; Doing so avoid + ;; unexpected results when executing actions. + (helm--compute-sources normal-sources)) (helm-log-eval (mapcar (lambda (s) (assoc-default 'name s)) delayed-sources)) (cond ((and preselect delayed-sources normal-sources) @@ -2689,10 +2689,10 @@ is done on whole `helm-buffer' and not on current source." ;; Allow giving a value to `delayed' attr from inside source. ;; Retain the biggest value (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)) - finally return delay))) + for s in delayed-sources + for d = (assoc-default 'delayed s) + when d do (setq delay (max delay d)) + finally return delay))) (run-with-idle-timer ;; Be sure helm-idle-delay is > ;; to helm-input-idle-delay @@ -2886,17 +2886,17 @@ after the source name by overlay." (helm-log-eval (cdr incomplete-line-info)) (butlast (cl-loop for line in lines - ;; On start `incomplete-line-info' value is empty string. - for newline = (helm-aif (cdr incomplete-line-info) - (prog1 - (concat it line) - (setcdr incomplete-line-info nil)) - line) - do (helm--maybe-process-filter-one-by-one-candidate newline source) - collect newline - ;; Store last incomplete line (last chunk truncated) - ;; until new output arrives. - finally do (setcdr incomplete-line-info line)))) + ;; On start `incomplete-line-info' value is empty string. + for newline = (helm-aif (cdr incomplete-line-info) + (prog1 + (concat it line) + (setcdr incomplete-line-info nil)) + line) + do (helm--maybe-process-filter-one-by-one-candidate newline source) + collect newline + ;; Store last incomplete line (last chunk truncated) + ;; until new output arrives. + finally do (setcdr incomplete-line-info line)))) (defun helm-output-filter--post-process () (let ((src (helm-get-current-source))) @@ -2961,14 +2961,14 @@ Meant to be called at beginning of a sentinel process function." ;; is splitted, so jump to this position before executing action. (helm-current-position 'restore) (unwind-protect - (helm-execute-selection-action-1) + (helm-execute-selection-action-1) (helm-aif (get-buffer helm-action-buffer) (kill-buffer it)) (helm-log-run-hook 'helm-after-action-hook))) (defun helm-execute-selection-action-1 (&optional - selection action - preserve-saved-action) + selection action + preserve-saved-action) "Execute ACTION on current SELECTION. If PRESERVE-SAVED-ACTION is non--nil save action." (helm-log "executing action") @@ -3040,8 +3040,8 @@ If action buffer is selected, back to the helm buffer." (candidate-transformer . (lambda (candidates) (cl-loop for (i . j) in candidates - collect - (cons (propertize i 'face 'helm-action) j)))) + collect + (cons (propertize i 'face 'helm-action) j)))) (candidate-number-limit)))) (set (make-local-variable 'helm-source-filter) nil) (set (make-local-variable 'helm-selection-overlay) nil) @@ -3089,17 +3089,17 @@ Possible value of DIRECTION are 'next or 'previous." (if helm-mode-line-string (setq mode-line-format `(" " mode-line-buffer-identification " " - (line-number-mode "L%l") " " ,follow - (:eval (when ,helm--mode-line-display-prefarg - (let ((arg (prefix-numeric-value (or prefix-arg - current-prefix-arg)))) - (unless (= arg 1) - (propertize (format "[prefarg:%s] " arg) - 'face '((:foreground "green"))))))) - (:eval (helm-show-candidate-number - (when (listp helm-mode-line-string) - (car-safe helm-mode-line-string)))) - " " helm-mode-line-string-real " -%-") + (line-number-mode "L%l") " " ,follow + (:eval (when ,helm--mode-line-display-prefarg + (let ((arg (prefix-numeric-value (or prefix-arg + current-prefix-arg)))) + (unless (= arg 1) + (propertize (format "[prefarg:%s] " arg) + 'face '((:foreground "green"))))))) + (:eval (helm-show-candidate-number + (when (listp helm-mode-line-string) + (car-safe helm-mode-line-string)))) + " " helm-mode-line-string-real " -%-") helm-mode-line-string-real (substitute-command-keys (if (listp helm-mode-line-string) (cadr helm-mode-line-string) @@ -3368,9 +3368,9 @@ don't exit and send message 'no match'." (let* ((empty-buffer-p (with-current-buffer helm-buffer (eq (point-min) (point-max)))) (unknown (and (not empty-buffer-p) - (string= (get-text-property - 0 'display (helm-get-selection nil 'withprop)) - "[?]")))) + (string= (get-text-property + 0 'display (helm-get-selection nil 'withprop)) + "[?]")))) (cond ((and (or empty-buffer-p unknown) (eq minibuffer-completion-confirm 'confirm)) (setq helm-minibuffer-confirm-state @@ -3468,8 +3468,8 @@ to a list of forms.\n\n") (defun helm-kill-buffer-hook () "Remove tick entry from `helm-tick-hash' when killing a buffer." (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))) + 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) (defun helm-preselect (candidate-or-regexp &optional source) @@ -3706,8 +3706,8 @@ To customize `helm-candidates-in-buffer' behavior, use `search', (re-search-backward pattern nil t)) (defun helm-candidates-in-buffer-1 (buffer pattern get-line-fn - search-fns limit search-from-end - match-part-fn source) + search-fns limit search-from-end + match-part-fn source) "Return the list of candidates inserted in BUFFER matching PATTERN." ;; buffer == nil when candidates buffer does not exist. (when buffer @@ -3729,8 +3729,8 @@ To customize `helm-candidates-in-buffer' behavior, use `search', (/= (point) (save-excursion (funcall proc) (point)))) (defun helm-search-from-candidate-buffer (pattern get-line-fn search-fns - limit search-from-end - start-point match-part-fn source) + limit search-from-end + start-point match-part-fn source) (let (buffer-read-only matches newmatches @@ -3742,24 +3742,24 @@ To customize `helm-candidates-in-buffer' behavior, use `search', (goto-char start-point) (setq newmatches nil) (cl-loop with item-count = 0 - while (funcall searcher pattern) - for cand = (funcall get-line-fn (point-at-bol) (point-at-eol)) - when (and (not (gethash cand helm-cib-hash)) - (or - ;; Always collect when cand is matched by searcher funcs - ;; and match-part attr is not present. - (not match-part-fn) - ;; If match-part attr is present, collect only if PATTERN - ;; match the part of CAND specified by the match-part func. - (helm-search-match-part cand pattern match-part-fn))) - do (helm--accumulate-candidates - cand newmatches helm-cib-hash item-count limit source) - unless (helm-point-is-moved - (lambda () - (if search-from-end - (goto-char (1- (point-at-bol))) - (forward-line 1)))) - return nil) + while (funcall searcher pattern) + for cand = (funcall get-line-fn (point-at-bol) (point-at-eol)) + when (and (not (gethash cand helm-cib-hash)) + (or + ;; Always collect when cand is matched by searcher funcs + ;; and match-part attr is not present. + (not match-part-fn) + ;; If match-part attr is present, collect only if PATTERN + ;; match the part of CAND specified by the match-part func. + (helm-search-match-part cand pattern match-part-fn))) + do (helm--accumulate-candidates + cand newmatches helm-cib-hash item-count limit source) + unless (helm-point-is-moved + (lambda () + (if search-from-end + (goto-char (1- (point-at-bol))) + (forward-line 1)))) + return nil) (setq matches (append matches (nreverse newmatches)))) (delq nil matches))))) @@ -3768,20 +3768,20 @@ To customize `helm-candidates-in-buffer' behavior, use `search', (let ((part (funcall match-part-fn candidate))) (if (string-match " " pattern) (cl-loop for i in (split-string pattern " " t) - always (string-match i part)) + always (string-match i part)) (string-match pattern part)))) (defun helm-initial-candidates-from-candidate-buffer (endp get-line-fn limit search-from-end) (delq nil (cl-loop with next-line-fn = - (if search-from-end - (lambda (_x) (goto-char (max (1- (point-at-bol)) 1))) - #'forward-line) - until (funcall endp) - for i from 1 to limit - collect (funcall get-line-fn (point-at-bol) (point-at-eol)) - do (funcall next-line-fn 1)))) + (if search-from-end + (lambda (_x) (goto-char (max (1- (point-at-bol)) 1))) + #'forward-line) + until (funcall endp) + for i from 1 to limit + collect (funcall get-line-fn (point-at-bol) (point-at-eol)) + do (funcall next-line-fn 1)))) (defun helm-search-from-candidate-buffer-internal (search-fn) (goto-char (point-min)) @@ -3789,7 +3789,7 @@ To customize `helm-candidates-in-buffer' behavior, use `search', (goto-char (point-max)) (insert "\n") (unwind-protect - (funcall search-fn) + (funcall search-fn) (goto-char (point-min)) (delete-char 1) (goto-char (1- (point-max))) @@ -3826,9 +3826,9 @@ Acceptable values of CREATE-OR-BUFFER: helm-candidate-buffer-alist))))) (kill-buffers-func #'(lambda () (cl-loop for b in (buffer-list) - if (string-match (format "^%s" (regexp-quote global-bname)) - (buffer-name b)) - do (kill-buffer b)))) + if (string-match (format "^%s" (regexp-quote global-bname)) + (buffer-name b)) + do (kill-buffer b)))) (create-func #'(lambda () (with-current-buffer (get-buffer-create (if (eq create-or-buffer 'global) @@ -3887,32 +3887,32 @@ Arg DATA can be either a list or a plain string." (when helm-prevent-escaping-from-minibuffer (helm-prevent-switching-other-window :enabled nil)) (unwind-protect - (with-helm-window - (if (or helm-full-frame (one-window-p t)) - (message "Error: Attempt to resplit a single window") - (let ((before-height (window-height))) - (delete-window) - (set-window-buffer - (select-window - (if (= (window-height) before-height) ; initial split was horizontal. - ;; Split window vertically with `helm-buffer' placed - ;; on the good side according to actual value of - ;; `helm-split-window-default-side'. - (prog1 - (cond ((or (eq helm-split-window-default-side 'above) - (eq helm-split-window-default-side 'left)) - (split-window - (selected-window) nil 'above)) - (t (split-window-vertically))) - (setq helm-split-window-state 'vertical)) - ;; Split window vertically, same comment as above. - (setq helm-split-window-state 'horizontal) - (cond ((or (eq helm-split-window-default-side 'left) - (eq helm-split-window-default-side 'above)) - (split-window (selected-window) nil 'left)) - (t (split-window-horizontally))))) - helm-buffer))) - (setq helm--window-side-state (helm--get-window-side-state))) + (with-helm-window + (if (or helm-full-frame (one-window-p t)) + (message "Error: Attempt to resplit a single window") + (let ((before-height (window-height))) + (delete-window) + (set-window-buffer + (select-window + (if (= (window-height) before-height) ; initial split was horizontal. + ;; Split window vertically with `helm-buffer' placed + ;; on the good side according to actual value of + ;; `helm-split-window-default-side'. + (prog1 + (cond ((or (eq helm-split-window-default-side 'above) + (eq helm-split-window-default-side 'left)) + (split-window + (selected-window) nil 'above)) + (t (split-window-vertically))) + (setq helm-split-window-state 'vertical)) + ;; Split window vertically, same comment as above. + (setq helm-split-window-state 'horizontal) + (cond ((or (eq helm-split-window-default-side 'left) + (eq helm-split-window-default-side 'above)) + (split-window (selected-window) nil 'left)) + (t (split-window-horizontally))))) + helm-buffer))) + (setq helm--window-side-state (helm--get-window-side-state))) (when helm-prevent-escaping-from-minibuffer (helm-prevent-switching-other-window :enabled nil)))) @@ -3984,11 +3984,11 @@ If N is positive enlarge, if negative narrow." Possible values are 'left 'right 'below or 'above." (let ((side-list '(left right below above))) (cl-loop for side in side-list - thereis (and (equal (helm-window) - (window-in-direction - side (get-buffer-window helm-current-buffer t) - t)) - side)))) + thereis (and (equal (helm-window) + (window-in-direction + side (get-buffer-window helm-current-buffer t) + t)) + side)))) (defun helm-replace-buffer-in-window (window buffer1 buffer2) "Replace BUFFER1 by BUFFER2 in WINDOW registering BUFFER1." @@ -4146,8 +4146,8 @@ Argument ACTION if present will be used as second argument of `display-buffer'." (mapcar (lambda (x) (or (car-safe x) x)) special-display-buffer-names)) (cl-loop for x in special-display-regexps - thereis (string-match (or (car-safe x) x) - name)))) + thereis (string-match (or (car-safe x) x) + name)))) '(".")))) ;; Don't loose minibuffer when displaying persistent window in ;; another frame. @@ -4204,8 +4204,8 @@ Argument ACTION if present will be used as second argument of `display-buffer'." (defun helm-this-visible-mark () (cl-loop for o in helm-visible-mark-overlays - when (equal (point-at-bol) (overlay-start o)) - return o)) + when (equal (point-at-bol) (overlay-start o)) + return o)) (defun helm-delete-visible-mark (overlay) (setq helm-marked-candidates @@ -4328,20 +4328,20 @@ Otherwise one element list of current selection. When key WITH-WILDCARD is specified try to expand a wilcard if some." (with-current-buffer (helm-buffer-get) (cl-loop with current-src = (helm-get-current-source) - for (source . real) in - (or (reverse helm-marked-candidates) - (list (cons current-src (helm-get-selection)))) - when (equal current-src source) - ;; When real is a normal filename without wildcard - ;; file-expand-wildcards returns a list of one file. - ;; When real is a non--existent file it return nil. - append (let* ((elm (helm-coerce-selection real source)) - (c (and with-wildcard - (condition-case nil - (file-expand-wildcards elm t) - (error nil))))) - (or c (list elm))) into cands - finally do (prog1 (cl-return cands) (helm-log-eval cands))))) + for (source . real) in + (or (reverse helm-marked-candidates) + (list (cons current-src (helm-get-selection)))) + when (equal current-src source) + ;; When real is a normal filename without wildcard + ;; file-expand-wildcards returns a list of one file. + ;; When real is a non--existent file it return nil. + append (let* ((elm (helm-coerce-selection real source)) + (c (and with-wildcard + (condition-case nil + (file-expand-wildcards elm t) + (error nil))))) + (or c (list elm))) into cands + finally do (prog1 (cl-return cands) (helm-log-eval cands))))) (defun helm-current-source-name= (name) (save-excursion @@ -4368,23 +4368,23 @@ When key WITH-WILDCARD is specified try to expand a wilcard if some." (defun helm-next-point-in-list (curpos points &optional prev) (cond - ;; rule out special cases. - ((null points) curpos) - ((and prev (<= curpos (car points))) - (nth (1- (length points)) points)) - ((< (car (last points)) curpos) - (if prev (car (last points)) (nth 0 points))) - ((and (not prev) (>= curpos (car (last points)))) - (nth 0 points)) - (t - (nth (if prev - (cl-loop for pt in points + ;; rule out special cases. + ((null points) curpos) + ((and prev (<= curpos (car points))) + (nth (1- (length points)) points)) + ((< (car (last points)) curpos) + (if prev (car (last points)) (nth 0 points))) + ((and (not prev) (>= curpos (car (last points)))) + (nth 0 points)) + (t + (nth (if prev + (cl-loop for pt in points + for i from 0 + if (<= curpos pt) return (1- i)) + (cl-loop for pt in points for i from 0 - if (<= curpos pt) return (1- i)) - (cl-loop for pt in points - for i from 0 - if (< curpos pt) return i)) - points)))) + if (< curpos pt) return i)) + points)))) ;;;###autoload (defun helm-next-visible-mark (&optional prev) @@ -4456,10 +4456,10 @@ This will enable `helm-follow-mode' automatically in `helm-source-buffers-list'. (let* ((src (helm-get-current-source)) (name (assoc-default 'name src)) (sym (cl-loop for s in helm-sources - for sname = (and (symbolp s) - (assoc-default - 'name (symbol-value s))) - thereis (and sname (string= sname name) s))) + for sname = (and (symbolp s) + (assoc-default + 'name (symbol-value s))) + thereis (and sname (string= sname name) s))) (fol-attr (assq 'follow src)) (enabled (or (< arg 0) ; Assume follow is enabled. (eq (cdr fol-attr) 1))))