diff options
39 files changed, 1674 insertions, 1674 deletions
diff --git a/helm-adaptative.el b/helm-adaptative.el index 936b1b06..196ca767 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 @@ -68,12 +68,12 @@ Format: ((SOURCE-NAME (SELECTED-CANDIDATE (PATTERN . NUMBER-OF-USE) ...) ...) .. (add-hook 'helm-before-action-hook 'helm-adaptive-store-selection) ;; Should run at beginning of `helm-select-action'. (add-hook 'helm-select-action-hook 'helm-adaptive-store-selection)) - (helm-adaptive-save-history) - (setq helm-adaptive-history nil) - (remove-hook 'kill-emacs-hook 'helm-adaptive-save-history) - (remove-hook 'helm-before-initialize-hook 'helm-adaptative-done-reset) - (remove-hook 'helm-before-action-hook 'helm-adaptive-store-selection) - (remove-hook 'helm-select-action-hook 'helm-adaptive-store-selection))) + (helm-adaptive-save-history) + (setq helm-adaptive-history nil) + (remove-hook 'kill-emacs-hook 'helm-adaptive-save-history) + (remove-hook 'helm-before-initialize-hook 'helm-adaptative-done-reset) + (remove-hook 'helm-before-action-hook 'helm-adaptive-store-selection) + (remove-hook 'helm-select-action-hook 'helm-adaptive-store-selection))) (defun helm-adapt-use-adaptative-p (&optional source-name) "Return current source only if it use adaptative history, nil otherwise." @@ -89,7 +89,7 @@ Format: ((SOURCE-NAME (SELECTED-CANDIDATE (PATTERN . NUMBER-OF-USE) ...) ...) .. (assoc-default 'candidate-transformer source)))) (if (listp adapt-source) (and (member 'helm-adaptive-sort adapt-source) source) - (and (eq adapt-source 'helm-adaptive-sort) source))))) + (and (eq adapt-source 'helm-adaptive-sort) source))))) (defun helm-adaptive-store-selection () "Store history information for the selected candidate." @@ -111,13 +111,13 @@ Format: ((SOURCE-NAME (SELECTED-CANDIDATE (PATTERN . NUMBER-OF-USE) ...) ...) .. (if (not found) ;; new entry (list selection) - ;; move entry to the beginning of the - ;; list, so that it doesn't get - ;; trimmed when the history is - ;; truncated - (setcdr source-info - (delete found (cdr source-info))) - found)) + ;; move entry to the beginning of the + ;; list, so that it doesn't get + ;; trimmed when the history is + ;; truncated + (setcdr source-info + (delete found (cdr source-info))) + found)) (cdr source-info))) (cadr source-info))) (pattern-info (progn @@ -128,13 +128,13 @@ Format: ((SOURCE-NAME (SELECTED-CANDIDATE (PATTERN . NUMBER-OF-USE) ...) ...) .. ;; new entry (cons helm-pattern 0) - ;; move entry to the beginning of the - ;; list, so if two patterns used the - ;; same number of times then the one - ;; used last appears first in the list - (setcdr selection-info - (delete found (cdr selection-info))) - found)) + ;; move entry to the beginning of the + ;; list, so if two patterns used the + ;; same number of times then the one + ;; used last appears first in the list + (setcdr selection-info + (delete found (cdr selection-info))) + found)) (cdr selection-info))) (cadr selection-info)))) @@ -183,13 +183,13 @@ This is a filtered candidate transformer you can use with the helm-pattern)) (cl-incf count (cdr pattern-info)) - ;; if current pattern is equal to the previously - ;; used one then this candidate has priority - ;; (that's why its count is boosted by 10000) and - ;; it only has to compete with other candidates - ;; which were also selected with the same pattern - (setq count (+ 10000 (cdr pattern-info))) - (cl-return))) + ;; if current pattern is equal to the previously + ;; used one then this candidate has priority + ;; (that's why its count is boosted by 10000) and + ;; it only has to compete with other candidates + ;; which were also selected with the same pattern + (setq count (+ 10000 (cdr pattern-info))) + (cl-return))) (cons (car candidate-info) count))) (cdr source-info)))) (if (and usage (consp usage)) @@ -208,13 +208,13 @@ This is a filtered candidate transformer you can use with the (setq candidates (cl-remove info candidates :test 'helm-adaptive-compare)) finally return (append sorted candidates))) - (message "Your `%s' is maybe corrupted or too old, \ + (message "Your `%s' is maybe corrupted or too old, \ you should reinitialize it with `helm-reset-adaptative-history'" - helm-adaptive-history-file) - (sit-for 1) - candidates)) - ;; if there is no information stored for this source then do nothing - candidates))) + helm-adaptive-history-file) + (sit-for 1) + candidates)) + ;; if there is no information stored for this source then do nothing + candidates))) ;;;###autoload (defun helm-reset-adaptative-history () diff --git a/helm-apt.el b/helm-apt.el index 5a6b08b3..03f1c09e 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) @@ -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." @@ -185,8 +185,8 @@ package name - description." 'helm-apt-cache-show))) ;; A function, call it. (funcall helm-apt-cache-show-function package) - ;; nil or whatever use default. - (helm-apt-cache-show-1 package))) + ;; nil or whatever use default. + (helm-apt-cache-show-1 package))) (defun helm-apt-cache-show-1 (package) (let* ((command (format helm-apt-show-command package)) @@ -224,8 +224,8 @@ Support install, remove and purge actions." (if (and helm-apt-term-buffer (buffer-live-p (get-buffer helm-apt-term-buffer))) (switch-to-buffer helm-apt-term-buffer) - (ansi-term (getenv "SHELL") "term apt") - (setq helm-apt-term-buffer (buffer-name))) + (ansi-term (getenv "SHELL") "term apt") + (setq helm-apt-term-buffer (buffer-name))) (term-line-mode) (let ((command (cl-case action (install "sudo apt-get install ") @@ -245,7 +245,7 @@ Support install, remove and purge actions." (setq helm-external-commands-list nil) (setq helm-apt-installed-packages nil) (term-char-mode) (term-send-input)) - (delete-region beg end)))) + (delete-region beg end)))) ;;;###autoload (defun helm-apt (arg) diff --git a/helm-bbdb.el b/helm-bbdb.el index f6365f5e..14722a62 100644 --- a/helm-bbdb.el +++ b/helm-bbdb.el @@ -114,7 +114,7 @@ All other actions are removed." (helm-bbdb-read-address) (helm-bbdb-read-phone) (read-from-minibuffer "Note: "))))) - actions)) + actions)) (defun helm-bbdb-get-record (candidate) "Return record that match CANDIDATE." @@ -134,7 +134,7 @@ All other actions are removed." (setq helm-bbdb-name helm-pattern) (if (not candidates) (list "*Add to contacts*") - candidates))) + candidates))) (action-transformer . (lambda (actions candidate) (helm-bbdb-create-contact actions candidate)))) "Needs BBDB. diff --git a/helm-bookmark.el b/helm-bookmark.el index 3d08c681..05036dec 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) @@ -108,7 +108,7 @@ for len = (string-width i) for trunc = (if (> len bookmark-bmenu-file-column) (helm-substring i bookmark-bmenu-file-column) - i) + i) for sep = (make-string (- (+ bookmark-bmenu-file-column 2) (length trunc)) ? ) if helm-bookmark-show-location @@ -120,7 +120,7 @@ (if helm-bookmark-show-location ;; match only location, match-plugin will match also name. (string-match helm-pattern (bookmark-location candidate)) - (string-match helm-pattern candidate))) + (string-match helm-pattern candidate))) (defun helm-bookmark-toggle-filename () "Toggle bookmark location visibility." @@ -129,13 +129,13 @@ (let* ((real (helm-get-selection helm-buffer)) (trunc (if (> (string-width real) bookmark-bmenu-file-column) (helm-substring real bookmark-bmenu-file-column) - real))) + real))) (setq helm-bookmark-show-location (not helm-bookmark-show-location)) (helm-force-update (if helm-bookmark-show-location (concat (regexp-quote trunc) " +" (regexp-quote (bookmark-location real))) - real))))) + real))))) (defun helm-bookmark-jump (candidate) "Jump to bookmark from keyboard." @@ -185,7 +185,7 @@ Should be used with `helm-pp-bookmark-match-fn' as `match-part' function." (if helm-bookmark-show-location (helm-aif (next-single-property-change (point) 'location) (goto-char it)) - (re-search-forward pattern nil t))) + (re-search-forward pattern nil t))) (defun helm-pp-bookmark-match-fn (candidate) "Search function for bookmark sources using `candidates-in-buffer'. @@ -246,7 +246,7 @@ BOOKMARK is a bookmark name or a bookmark record." "Return non-nil if BOOKMARK bookmarks an image file." (if (stringp bookmark) (assoc 'image-type (assoc bookmark bookmark-alist)) - (assoc 'image-type bookmark))) + (assoc 'image-type bookmark))) (defun helm-bookmark-file-p (bookmark) "Return non-nil if BOOKMARK bookmarks a file or directory. @@ -261,8 +261,8 @@ This excludes bookmarks of a more specific kind (Info, Gnus, and W3m)." BOOKMARK is a bookmark name or a bookmark record." (if (listp bookmark) (string= (assoc-default 'type bookmark) "addressbook") - (string= (assoc-default - 'type (assoc bookmark bookmark-alist)) "addressbook"))) + (string= (assoc-default + 'type (assoc bookmark bookmark-alist)) "addressbook"))) (defun helm-bookmark-uncategorized-bookmark-p (bookmark) "Return non--nil if BOOKMARK match no known category." @@ -484,7 +484,7 @@ than `w3m-browse-url' use it." (append (message-buffers))) (if append (addressbook-set-mail-buffer1 bmk 'append) - (addressbook-set-mail-buffer1 bmk)) + (addressbook-set-mail-buffer1 bmk)) (setq contacts (cdr contacts)) (when contacts (cl-loop for bmk in contacts do @@ -508,7 +508,7 @@ than `w3m-browse-url' use it." (if (> (length mlist) 1) (helm-comp-read "Insert Mail Address: " mlist :must-match t) - (car mlist)))))) + (car mlist)))))) ("Show annotation" . (lambda (candidate) (let ((bmk (helm-bookmark-get-bookmark-from-name @@ -577,7 +577,7 @@ Work both with standard Emacs bookmarks and bookmark-extensions.el." (> len bookmark-bmenu-file-column)) (helm-substring i bookmark-bmenu-file-column) - i) + 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))) @@ -622,7 +622,7 @@ Work both with standard Emacs bookmarks and bookmark-extensions.el." 'help-echo isfile))) collect (if helm-bookmark-show-location (cons (concat bmk sep loc) i) - (cons bmk i))))) + (cons bmk i))))) (defun helm-bookmark-edit-bookmark (bookmark-name) "Edit bookmark's name and file name, and maybe save them. @@ -635,7 +635,7 @@ BOOKMARK-NAME is the current (old) name of the bookmark to be renamed." (or bookmark-fname (if (consp bookmark-loc) (car bookmark-loc) - bookmark-loc)))) + bookmark-loc)))) (docid (and (eq handler 'mu4e-bookmark-jump) (read-number "Docid: " (cdr bookmark-loc))))) (when docid @@ -646,9 +646,9 @@ BOOKMARK-NAME is the current (old) name of the bookmark to be renamed." (progn (helm-bookmark-rename bookmark-name new-name 'batch) (bookmark-set-filename new-name new-loc)) - (bookmark-prop-set - (bookmark-get-bookmark bookmark-name) 'location new-loc) - (helm-bookmark-rename bookmark-name new-name 'batch)) + (bookmark-prop-set + (bookmark-get-bookmark bookmark-name) 'location new-loc) + (helm-bookmark-rename bookmark-name new-name 'batch)) (helm-bookmark-maybe-save-bookmark) (list new-name new-loc)))) @@ -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 eb82f25b..957907b4 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) @@ -174,7 +174,7 @@ When disabled (nil) use the longest buffer-name length found." (buffer (get-buffer-create candidate))) (if mjm (with-current-buffer buffer (funcall mjm)) - (set-buffer-major-mode buffer)) + (set-buffer-major-mode buffer)) (helm-switch-to-buffer buffer)))))) (defvar ido-temp-list) @@ -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 @@ -239,7 +239,7 @@ See `ido-make-buffer-list' for more infos." (format "(%s %s in `%s')" (process-name proc) (process-status proc) dir) - (format "(in `%s')" dir)) + (format "(in `%s')" dir)) 'face face2))))) (defun helm-buffer--details (buffer &optional details) @@ -254,37 +254,37 @@ 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. @@ -292,13 +292,13 @@ 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)) + (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)) ? ))) + (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) @@ -311,7 +311,7 @@ Should be called after others transformers i.e (boring buffers)." collect (cons (if helm-buffer-details-flag (concat truncbuf "\t" formatted-size " " fmode " " meta) - name) + name) i))) (defun helm-buffer--get-preselection (buffer-name) @@ -323,9 +323,9 @@ Should be called after others transformers i.e (boring buffers)." (regexp-quote (helm-substring-by-width buffer-name helm-buffer-max-length)) - (concat (regexp-quote buffer-name) - (if helm-buffer-details-flag - "$" "[[:blank:]]+"))))) + (concat (regexp-quote buffer-name) + (if helm-buffer-details-flag + "$" "[[:blank:]]+"))))) (defun helm-toggle-buffers-details () (interactive) @@ -338,9 +338,9 @@ Should be called after others transformers i.e (boring buffers)." (defun helm-buffers-sort-transformer (candidates _source) (if (string= helm-pattern "") candidates - (sort candidates - #'(lambda (s1 s2) - (< (string-width s1) (string-width s2)))))) + (sort candidates + #'(lambda (s1 s2) + (< (string-width s1) (string-width s2)))))) ;;; match functions @@ -361,7 +361,7 @@ Should be called after others transformers i.e (boring buffers)." (defun helm-buffer--match-pattern (pattern candidate) (if (string-match "\\`!" pattern) (not (string-match (substring pattern 1) candidate)) - (string-match pattern candidate))) + (string-match pattern candidate))) (defun helm-buffer-match-major-mode (candidate) "Match maybe buffer by major-mode. @@ -429,7 +429,7 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (goto-char (point-min)) (if (consp replace) (apply fn (list (car replace) (cdr replace))) - (apply fn (list replace tostring))))))))) + (apply fn (list replace tostring))))))))) (defun helm-buffer-query-replace-regexp (_candidate) (helm-buffer-query-replace-1 'regexp)) @@ -568,7 +568,7 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (progn (save-buffer) (kill-buffer buffer)) - (kill-buffer buffer))) + (kill-buffer buffer))) (helm-delete-current-selection) (when (helm-empty-source-p) (helm-next-source)) (with-helm-temp-hook 'helm-after-persistent-action-hook @@ -577,7 +577,7 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (defun helm-buffers-list-persistent-action (candidate) (if current-prefix-arg (helm-buffers-persistent-kill candidate) - (helm-switch-to-buffer candidate))) + (helm-switch-to-buffer candidate))) (defun helm-ediff-marked-buffers (_candidate &optional merge) "Ediff 2 marked buffers or CANDIDATE and `helm-current-buffer'. @@ -597,7 +597,7 @@ With optional arg MERGE call `ediff-merge-buffers'." (error "Error:To much buffers marked!"))) (if merge (ediff-merge-buffers buf1 buf2) - (ediff-buffers buf1 buf2)))) + (ediff-buffers buf1 buf2)))) (defun helm-ediff-marked-buffers-merge (candidate) "Ediff merge `helm-current-buffer' with CANDIDATE. @@ -610,7 +610,7 @@ Can be used by any source that list buffers." (let ((helm-moccur-always-search-in-current (if helm-current-prefix-arg (not helm-moccur-always-search-in-current) - helm-moccur-always-search-in-current)) + 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) @@ -634,11 +634,11 @@ Can be used by any source that list buffers." (remove 'helm-shadow-boring-buffers filter-attrs)) helm-source-buffers-list t) - (helm-attrset 'filtered-candidate-transformer - (cons 'helm-shadow-boring-buffers - (remove 'helm-skip-boring-buffers - filter-attrs)) - helm-source-buffers-list t)) + (helm-attrset 'filtered-candidate-transformer + (cons 'helm-shadow-boring-buffers + (remove 'helm-skip-boring-buffers + filter-attrs)) + helm-source-buffers-list t)) (helm-force-update)))) @@ -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-call-tree.el b/helm-call-tree.el index 55aa32a8..1debc6e6 100644 --- a/helm-call-tree.el +++ b/helm-call-tree.el @@ -56,7 +56,7 @@ http://www.emacswiki.org/cgi-bin/wiki/download/simple-call-tree.el") (insert (car entry) message (if (string= funcs " ") " no functions." - funcs) + funcs) "\n\n")))))))) (defun helm-simple-call-tree-functions-callers-init () diff --git a/helm-command.el b/helm-command.el index cdcb9152..4769f007 100644 --- a/helm-command.el +++ b/helm-command.el @@ -148,29 +148,29 @@ You can get help on each command by persistent action." (set-window-buffer (get-buffer-window hbuf) helm-current-buffer)) (setq in-help nil)) - (helm-describe-function candidate) - (setq in-help t)) + (helm-describe-function candidate) + (setq in-help t)) (setq help-cand candidate)))) (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 d37d8717..1a8be703 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 a7135f96..7e22ffc2 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 @@ -162,13 +162,13 @@ but the initial search for all candidates in buffer(s)." (substring-no-properties it))) (lst (if (string= match-1 match-2) (list match-1) - (list match-1 match-2)))) + (list match-1 match-2)))) (cl-loop for match in lst 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))) + (list (current-buffer))) do (with-current-buffer buf (when (or minibuf ; check against all buffers when in minibuffer. @@ -208,7 +208,7 @@ but the initial search for all candidates in buffer(s)." ;; Search all but don't recompute current-buffer. (let ((helm-dabbrev--exclude-current-buffer-flag t)) (append lst (funcall dabbrev-get abbrev 'all-bufs))) - lst)))) + lst)))) (defvar helm-source-dabbrev `((name . "Dabbrev Expand") diff --git a/helm-elisp-package.el b/helm-elisp-package.el index 67f9f5fe..a8305a00 100644 --- a/helm-elisp-package.el +++ b/helm-elisp-package.el @@ -40,7 +40,7 @@ (let ((id (get-text-property 0 'tabulated-list-id candidate))) (describe-package (if (fboundp 'package-desc-name) (package-desc-name id) - (car id))))) + (car id))))) (defun helm-el-package-install (_candidate) (cl-loop with mkd = (helm-marked-candidates) @@ -49,18 +49,18 @@ do (package-install (if (fboundp 'package-desc-name) (package-desc-name id) - (car 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 ", ")))))) + (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) (cl-loop with mkd = (helm-marked-candidates) @@ -72,38 +72,38 @@ (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))))) + ;; 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)))))) + (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)) + (car id)) package-alist) for cand = (cons c (car (split-string c))) when (or (and installed-p diff --git a/helm-elisp.el b/helm-elisp.el index c5cf2637..c950f919 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) @@ -99,18 +99,18 @@ e.g give only function names after \(function ." (with-selected-window (selected-window) (if (window-dedicated-p) (helm-default-display-buffer buffer) - (let* ((screen-size (+ (count-screen-lines (window-start) (point) t) - 1 ; mode-line - (if header-line-format 1 0))) ; header-line - (def-size (- (window-height) - helm-show-completion-min-window-height)) - (upper-height (max window-min-height (min screen-size def-size))) - split-window-keep-point) - (recenter -1) - (set-window-buffer (if (active-minibuffer-window) - (minibuffer-selected-window) - (split-window nil upper-height)) - buffer))))) + (let* ((screen-size (+ (count-screen-lines (window-start) (point) t) + 1 ; mode-line + (if header-line-format 1 0))) ; header-line + (def-size (- (window-height) + helm-show-completion-min-window-height)) + (upper-height (max window-min-height (min screen-size def-size))) + split-window-keep-point) + (recenter -1) + (set-window-buffer (if (active-minibuffer-window) + (minibuffer-selected-window) + (split-window nil upper-height)) + buffer))))) (defmacro with-helm-show-completion (beg end &rest body) "Show helm candidate in an overlay at point. @@ -128,11 +128,11 @@ If `helm-turn-on-show-completion' is nil just do nothing." (set (make-local-variable 'helm-display-function) (if helm-show-completion-use-special-display 'helm-show-completion-display-function - 'helm-default-display-buffer)))) + '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)) @@ -177,7 +177,7 @@ If `helm-turn-on-show-completion' is nil just do nothing." (error nil))) (lambda (sym) (or (boundp sym) (fboundp sym) (symbol-plist sym))) - #'fboundp)))) + #'fboundp)))) (defun helm-thing-before-point (&optional limits regexp) "Return symbol name before point. @@ -191,11 +191,11 @@ of symbol before point." (boundary (field-beginning nil nil (point-at-bol)))) (if (re-search-backward (or regexp "\\_<") boundary t) (setq beg (match-end 0)) - (setq beg boundary)) + (setq beg boundary)) (unless (= beg end) (if limits (cons beg end) - (buffer-substring-no-properties beg end)))))) + (buffer-substring-no-properties beg end)))))) (defun helm-bounds-of-thing-before-point (&optional regexp) "Get the beginning and end position of `helm-thing-before-point'. @@ -267,7 +267,7 @@ Return a cons \(beg . end\)." :resume 'noresume :buffer "*helm lisp completion*" :allow-nest t)) - (message "[No Match]")))) + (message "[No Match]")))) (defun helm-lisp-completion-persistent-action (candidate) (let ((cursor-in-echo-area t) @@ -306,7 +306,7 @@ If SYM is not documented, return \"Not documented\"." ;; for CL-style functions. (not (string-match-p "^\n\n" doc))) (car (split-string doc "\n")) - "Not documented"))) + "Not documented"))) ;;; File completion. ;; @@ -338,7 +338,7 @@ If SYM is not documented, return \"Not documented\"." (when (and completion (not (string= completion ""))) (delete-region beg end) (insert (if (string-match "^~" tap) (abbreviate-file-name completion) - completion))))) + completion))))) ;;;###autoload (defun helm-lisp-indent () @@ -361,7 +361,7 @@ Filename completion happen if string start after or between a double quote." (search-backward tap (point-at-bol) t) (looking-back "[^'`( ]"))) (helm-complete-file-name-at-point) - (helm-lisp-completion-at-point)))) + (helm-lisp-completion-at-point)))) (helm-multi-key-defun helm-multi-lisp-complete-at-point "Multi key function for completion in emacs lisp buffers. @@ -510,7 +510,7 @@ First call indent, second complete symbol, third complete fname." (defun helm-advice-persistent-action (func-class-advice) (if current-prefix-arg (helm-advice-toggle func-class-advice) - (describe-function (car func-class-advice)))) + (describe-function (car func-class-advice)))) (defun helm-advice-toggle (func-class-advice) (cl-destructuring-bind (function _class advice) func-class-advice @@ -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.") @@ -676,7 +676,7 @@ First call indent, second complete symbol, third complete fname." (let ((time (timer--time timer))) (if (timer--idle-delay timer) (format-time-string "idle-for=%5s" time) - (format-time-string "%m/%d %T" time))) + (format-time-string "%m/%d %T" time))) (or (timer--repeat-delay timer) "nil") (mapconcat 'identity (split-string (prin1-to-string (timer--function timer)) diff --git a/helm-elscreen.el b/helm-elscreen.el index c13e1ed6..ee6fcab1 100644 --- a/helm-elscreen.el +++ b/helm-elscreen.el @@ -50,17 +50,17 @@ #'(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 32929258..fd276ca8 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) @@ -103,16 +103,16 @@ (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) diff --git a/helm-eshell.el b/helm-eshell.el index eae44b4d..de16b71b 100644 --- a/helm-eshell.el +++ b/helm-eshell.el @@ -111,8 +111,8 @@ The function that call this should set `helm-ec-target' to thing at point." ;; 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)))) + (expand-file-name + i (file-name-directory entry)))) ;; Compare them to avoid dups. for file-entry-p = (and (stringp exp-entry) (stringp file-cand) @@ -139,7 +139,7 @@ The function that call this should set `helm-ec-target' to thing at point." (append (list exp-entry) ;; Entry should not be here now but double check. (remove entry ls)) - 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 98d88877..23af7a76 100644 --- a/helm-eval.el +++ b/helm-eval.el @@ -77,7 +77,7 @@ Should take one arg: the string to display." (if edebug-active (edebug-eval-expression (read helm-pattern)) - (eval (read helm-pattern))))) + (eval (read helm-pattern))))) (error "Error"))))) (action . (("Copy result to kill-ring" . (lambda (candidate) (kill-new @@ -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 7d19e65c..6d0eda36 100644 --- a/helm-external.el +++ b/helm-external.el @@ -91,27 +91,27 @@ In this case EXE must be provided as \"EXE %s\"." (if (get-process proc) (if helm-raise-command (shell-command (format helm-raise-command real-com)) - (error "Error: %s is already running" real-com)) - (when (cl-loop for i in helm-external-commands-list thereis (string= real-com i)) - (message "Starting %s..." real-com) - (if file - (start-process-shell-command - proc nil (format exe (shell-quote-argument - (if (eq system-type 'windows-nt) - (helm-w32-prepare-filename file) - file)))) - (start-process-shell-command proc nil real-com)) - (set-process-sentinel - (get-process proc) - #'(lambda (process event) - (when (and (string= event "finished\n") - helm-raise-command - (not (helm-get-pid-from-process-name real-com))) - (shell-command (format helm-raise-command "emacs"))) - (message "%s process...Finished." process)))) - (setq helm-external-commands-list - (cons real-com - (delete real-com helm-external-commands-list)))))) + (error "Error: %s is already running" real-com)) + (when (cl-loop for i in helm-external-commands-list thereis (string= real-com i)) + (message "Starting %s..." real-com) + (if file + (start-process-shell-command + proc nil (format exe (shell-quote-argument + (if (eq system-type 'windows-nt) + (helm-w32-prepare-filename file) + file)))) + (start-process-shell-command proc nil real-com)) + (set-process-sentinel + (get-process proc) + #'(lambda (process event) + (when (and (string= event "finished\n") + helm-raise-command + (not (helm-get-pid-from-process-name real-com))) + (shell-command (format helm-raise-command "emacs"))) + (message "%s process...Finished." process)))) + (setq helm-external-commands-list + (cons real-com + (delete real-com helm-external-commands-list)))))) (defun helm-get-mailcap-for-file (filename) "Get the command to use for FILENAME from mailcap files. @@ -155,8 +155,8 @@ If not found or a prefix arg is given query the user which tool to use." :history helm-external-command-history) ;; Always prompt to set this program as default. (setq def-prog nil)) - ;; No prefix arg or default program exists. - (replace-regexp-in-string " %s\\| '%s'" "" def-prog))) + ;; No prefix arg or default program exists. + (replace-regexp-in-string " %s\\| '%s'" "" def-prog))) (program (concat real-prog-name " %s"))) (unless (or def-prog ; Association exists, no need to record it. ;; Don't try to record non--filenames associations (e.g urls). diff --git a/helm-files.el b/helm-files.el index bcc46e39..491a2417 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) @@ -456,7 +456,7 @@ for current buffer." (save-selected-window (other-window 1) default-directory) - (car helm-ff-history))))) + (car helm-ff-history))))) (defun helm-find-files-do-action (action) "Generic function for creating actions from `helm-source-find-files'. @@ -480,7 +480,7 @@ ACTION must be an action supported by `helm-dired-action'." (mapcar #'(lambda (f) (if (file-directory-p f) (concat (helm-basename f) "/") - (helm-basename f))) + (helm-basename f))) ifiles) (with-helm-current-buffer (helm-read-file-name @@ -530,20 +530,20 @@ ACTION must be an action supported by `helm-dired-action'." (let* ((bname (helm-basename candidate)) (marked (helm-marked-candidates :with-wildcard t)) (prompt (if merge "Ediff Merge `%s' With File: " - "Ediff `%s' With File: ")) + "Ediff `%s' With File: ")) (fun (if merge 'ediff-merge-files 'ediff-files)) (input (helm-dwim-target-directory)) (presel (if helm-ff-transformer-show-only-basename (helm-basename candidate) - (expand-file-name - (helm-basename candidate) - input)))) + (expand-file-name + (helm-basename candidate) + input)))) (if (= (length marked) 2) (funcall fun (car marked) (cadr marked)) - (funcall fun candidate (helm-read-file-name - (format prompt bname) - :initial-input input - :preselect presel))))) + (funcall fun candidate (helm-read-file-name + (format prompt bname) + :initial-input input + :preselect presel))))) (defun helm-find-files-ediff-files (candidate) (helm-find-files-ediff-files-1 candidate)) @@ -579,7 +579,7 @@ ACTION must be an action supported by `helm-dired-action'." (let* ((source-name (assoc-default 'name (helm-get-current-source))) (default-directory (if (string= source-name "Find Files") helm-ff-default-directory - (file-name-directory candidate)))) + (file-name-directory candidate)))) (helm-etags-select helm-current-prefix-arg))) (defun helm-find-files-switch-to-hist (_candidate) @@ -648,9 +648,9 @@ will not be loaded first time you use this." ;; Two time C-u from `helm-comp-read' mean print to current-buffer. ;; i.e `eshell-command' will use this value. (setq current-prefix-arg '(16)) - ;; Else reset the value of `current-prefix-arg' - ;; to avoid printing in current-buffer. - (setq current-prefix-arg nil)) + ;; Else reset the value of `current-prefix-arg' + ;; to avoid printing in current-buffer. + (setq current-prefix-arg nil)) (if (and (or ;; One prefix-arg have been passed before `helm-comp-read'. ;; If map have been set with C-u C-u (value == '(16)) @@ -669,17 +669,17 @@ will not be loaded first time you use this." (let ((mapfiles (mapconcat 'shell-quote-argument cand-list " "))) (if (string-match "'%s'\\|\"%s\"\\|%s" command) (eshell-command (format command mapfiles)) ; See [1] - (eshell-command (format "%s %s" command mapfiles)))) - - ;; 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 <command %s some_more_args> - (format command files) - (format "%s %s" command files)) - do (eshell-command com)))))) + (eshell-command (format "%s %s" command mapfiles)))) + + ;; 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 <command %s some_more_args> + (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. @@ -696,7 +696,7 @@ See `helm-find-files-eshell-command-on-file-1' for more info." (eshell-send-input)))) (if (get-buffer "*eshell*") (helm-switch-to-buffer "*eshell*") - (call-interactively 'eshell)) + (call-interactively 'eshell)) (unless (get-buffer-process (current-buffer)) (funcall cd-eshell)))) @@ -736,7 +736,7 @@ See `helm-ff-serial-rename-1'." (message nil)))) (if done (with-helm-current-buffer (helm-find-files-1 dir)) - (message "Operation aborted")))) + (message "Operation aborted")))) (defun helm-ff-member-directory-p (file directory) (let ((dir-file (expand-file-name @@ -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) @@ -1014,7 +1014,7 @@ Same as `dired-do-print' but for helm." (printer-name (if helm-ff-printer-list (helm-comp-read "Printer: " helm-ff-printer-list) - printer-name)) + printer-name)) (command (read-string (format "Print *%s File(s):\n%s with: " len @@ -1028,7 +1028,7 @@ Same as `dired-do-print' but for helm." (cons lpr-command (append (if (stringp lpr-switches) (list lpr-switches) - lpr-switches) + lpr-switches) (list printer-name))) " ")))) (file-args (mapconcat #'(lambda (x) @@ -1037,7 +1037,7 @@ Same as `dired-do-print' but for helm." (cmd-line (concat command " " file-args))) (if command (start-process-shell-command "helm-print" nil cmd-line) - (error "Error: Please verify your printer settings in Emacs.")))) + (error "Error: Please verify your printer settings in Emacs.")))) (defun helm-ff-run-print-file () "Run Print file action from `helm-source-find-files'." @@ -1055,15 +1055,15 @@ 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 (insert-file-contents-literally file) (secure-hash algo (current-buffer))) - (with-temp-buffer - (insert-file-contents-literally file) - (sha1 (current-buffer))))) + (with-temp-buffer + (insert-file-contents-literally file) + (sha1 (current-buffer))))) (message "Checksum copied to kill-ring."))) (defun helm-ff-toggle-basename (candidate) @@ -1090,20 +1090,20 @@ If EXPAND is non--nil expand-file-name." (len (length fname-list)) (pop-list (if (< level 0) (cl-subseq fname-list (* level -1)) - (cl-subseq fname-list 0 (- len level)))) + (cl-subseq fname-list 0 (- len level)))) (result (mapconcat 'identity pop-list "/")) (empty (string= result ""))) (when unix-close (setq result (concat result "/"))) (if (string-match "^~" result) (if (string= result "~/") "~/" result) - (if (< level 0) - (if empty "../" (concat "../" result)) - (cond ((eq system-type 'windows-nt) - (if empty (expand-file-name "/") ; Expand to "/" or "c:/". - result)) - (empty "/") - (t - (concat "/" result))))))) + (if (< level 0) + (if empty "../" (concat "../" result)) + (cond ((eq system-type 'windows-nt) + (if empty (expand-file-name "/") ; Expand to "/" or "c:/". + result)) + (empty "/") + (t + (concat "/" result))))))) ;; Internal (defvar helm-file-completion-sources @@ -1154,7 +1154,7 @@ or hitting C-z on \"..\"." (let ((presel (if helm-ff-transformer-show-only-basename (helm-basename (directory-file-name helm-ff-last-expanded)) - (directory-file-name helm-ff-last-expanded)))) + (directory-file-name helm-ff-last-expanded)))) (with-helm-window (when (re-search-forward (concat "^" (regexp-quote presel) "$") nil t) (forward-line 0) @@ -1193,7 +1193,7 @@ expand to this directory." (pat (if (string-match helm-tramp-file-name-regexp helm-pattern) (helm-create-tramp-name helm-pattern) - helm-pattern)) + helm-pattern)) (completed-p (string= (file-name-as-directory (expand-file-name pat)) helm-ff-default-directory)) @@ -1224,15 +1224,15 @@ expand to this directory." ;; and only one candidate is remaining [2], ;; assume candidate is a new directory to expand, and do it. (helm-set-pattern (file-name-as-directory cur-cand)) - ;; The candidate is one of "." or ".." - ;; that mean we have entered the last letter of the directory name - ;; in prompt, so expansion is already done, just add the "/" at end - ;; of name unless helm-pattern ends with "." - ;; (i.e we are writing something starting with ".") - (unless (string-match "\\`.*[.]\\{1\\}\\'" helm-pattern) - (helm-set-pattern - ;; Need to expand-file-name to avoid e.g /ssh:host:./ in prompt. - (expand-file-name (file-name-as-directory helm-pattern))))) + ;; The candidate is one of "." or ".." + ;; that mean we have entered the last letter of the directory name + ;; in prompt, so expansion is already done, just add the "/" at end + ;; of name unless helm-pattern ends with "." + ;; (i.e we are writing something starting with ".") + (unless (string-match "\\`.*[.]\\{1\\}\\'" helm-pattern) + (helm-set-pattern + ;; Need to expand-file-name to avoid e.g /ssh:host:./ in prompt. + (expand-file-name (file-name-as-directory helm-pattern))))) (helm-check-minibuffer-input)))))))) (defun helm-ff-auto-expand-to-home-or-root () @@ -1255,8 +1255,8 @@ expand to this directory." (if (file-directory-p input) (setq helm-ff-default-directory (setq input (file-name-as-directory input))) - (setq helm-ff-default-directory (file-name-as-directory - (file-name-directory input)))) + (setq helm-ff-default-directory (file-name-as-directory + (file-name-directory input)))) (with-helm-window (helm-set-pattern input) (helm-check-minibuffer-input))))) @@ -1273,9 +1273,9 @@ On windows system substitute from start up to \"/[a-z]:/\"." (goto-char (if (or (string= match "//") (string-match-p "/[[:alpha:]]:/" match)) (1+ (match-beginning 0)) - (match-beginning 0))) + (match-beginning 0))) (buffer-substring-no-properties (point) (point-at-eol))) - fname))) + fname))) (add-hook 'helm-after-update-hook 'helm-ff-update-when-only-one-matched) (add-hook 'helm-after-update-hook 'helm-ff-auto-expand-to-home-or-root) @@ -1381,7 +1381,7 @@ purpose." ;; is enabled. helm-ff-auto-update-flag) (file-name-as-directory (expand-file-name path)) - (file-name-directory (expand-file-name path)))) + (file-name-directory (expand-file-name path)))) invalid-basedir non-essential (tramp-verbose helm-tramp-verbose)) ; No tramp message when 0. @@ -1409,10 +1409,10 @@ purpose." (setq helm-ff-default-directory (if (string= helm-pattern "") (expand-file-name "/") ; Expand to "/" or "c:/" - ;; If path is an url *default-directory have to be nil. - (unless (or (string-match helm-ff-url-regexp path) - (and ffap-url-regexp (string-match ffap-url-regexp path))) - path-name-dir))) + ;; If path is an url *default-directory have to be nil. + (unless (or (string-match helm-ff-url-regexp path) + (and ffap-url-regexp (string-match ffap-url-regexp path))) + path-name-dir))) (cond ((string= path "Invalid tramp file name") (or (helm-ff-tramp-hostnames) ; Hostnames completion. (prog2 @@ -1506,7 +1506,7 @@ If FNAME is a valid directory name,return FNAME unchanged." (t (setq bn (if (> (length bn) 2) ; wait 3nd char before concating. (helm-ff-mapconcat-candidate bn) - (concat ".*" bn))) + (concat ".*" bn))) (concat (regexp-quote bd) bn))))) (defun helm-ff-mapconcat-candidate (candidate) @@ -1521,12 +1521,12 @@ e.g helm.el$ (if (string= c ".") (concat "[" c "]") c)) (cdr ls) "") - (mapconcat (lambda (c) - (cond ((string= c ".") - (concat "[^" c "]*" (concat "[" c "]"))) - ((string= c "$") c) - (t (concat "[^" c "]*" c)))) - ls "")))) + (mapconcat (lambda (c) + (cond ((string= c ".") + (concat "[^" c "]*" (concat "[" c "]"))) + ((string= c "$") c) + (t (concat "[^" c "]*" c)))) + ls "")))) (defun helm-dir-is-dot (dir) (string-match "\\(?:/\\|\\`\\)\\.\\{1,2\\}\\'" dir)) @@ -1610,7 +1610,7 @@ Note that only directories are saved here." (format "Size: %s\n" size) (format "Modified: %s\n" modif) (format "Accessed: %s\n" access))) - (message dired-line) (sit-for 5)))) + (message dired-line) (sit-for 5)))) (defun helm-ff-properties-persistent () "Show properties without quitting helm." @@ -1653,7 +1653,7 @@ Note that only directories are saved here." (if buf (progn (kill-buffer buf) (message "Buffer `%s' killed" buf)) - (message "No buffer to kill")))) + (message "No buffer to kill")))) (defun helm-ff-kill-or-find-buffer-fname (candidate) "Find file CANDIDATE or kill it's buffer if it is visible. @@ -1672,7 +1672,7 @@ in `helm-find-files-persistent-action'." (kill-buffer buf) (set-window-buffer win helm-current-buffer) (message "Buffer `%s' killed" buf-name)) - (find-file candidate)))) + (find-file candidate)))) (defun helm-ff-run-kill-buffer-persistent () "Execute `helm-ff-kill-buffer-fname' whitout quitting." @@ -1706,32 +1706,32 @@ Return candidates prefixed with basename of `helm-input' first." (if (or (file-directory-p helm-input) (null candidates)) candidates - (let* ((c1 (car candidates)) - (cand1real (if (consp c1) (cdr c1) c1)) - (cand1 (unless (file-exists-p cand1real) - c1)) - (rest-cand (if cand1 (cdr candidates) candidates)) - (all (sort rest-cand - #'(lambda (s1 s2) - (let* ((score (lambda (str) - (if (condition-case _err - (string-match - (concat - "\\_<" - (helm-basename - helm-input)) str) - (invalid-regexp nil)) - 1 0))) - (bn1 (helm-basename (if (consp s1) (cdr s1) s1))) - (bn2 (helm-basename (if (consp s2) (cdr s2) s2))) - (sc1 (funcall score bn1)) - (sc2 (funcall score bn2))) - (cond ((= sc1 sc2) - (< (string-width bn1) - (string-width bn2))) - ((> sc1 sc2)) - (t (string-lessp bn1 bn2)))))))) - (if cand1 (cons cand1 all) all)))) + (let* ((c1 (car candidates)) + (cand1real (if (consp c1) (cdr c1) c1)) + (cand1 (unless (file-exists-p cand1real) + c1)) + (rest-cand (if cand1 (cdr candidates) candidates)) + (all (sort rest-cand + #'(lambda (s1 s2) + (let* ((score (lambda (str) + (if (condition-case _err + (string-match + (concat + "\\_<" + (helm-basename + helm-input)) str) + (invalid-regexp nil)) + 1 0))) + (bn1 (helm-basename (if (consp s1) (cdr s1) s1))) + (bn2 (helm-basename (if (consp s2) (cdr s2) s2))) + (sc1 (funcall score bn1)) + (sc2 (funcall score bn2))) + (cond ((= sc1 sc2) + (< (string-width bn1) + (string-width bn2))) + ((> sc1 sc2)) + (t (string-lessp bn1 bn2)))))))) + (if cand1 (cons cand1 all) all)))) (defun helm-ff-filter-candidate-one-by-one (file) "`filter-one-by-one' Transformer function for `helm-source-find-files'." @@ -1745,54 +1745,54 @@ Return candidates prefixed with basename of `helm-input' first." (if helm-ff-transformer-show-only-basename (if (helm-dir-is-dot file) file - (cons (or (helm-ff-get-host-from-tramp-invalid-fname file) - (helm-basename file)) - file)) - file) - ;; Now highlight. - (let* ((disp (if (and helm-ff-transformer-show-only-basename - (not (helm-dir-is-dot file)) - (not (and ffap-url-regexp - (string-match ffap-url-regexp file))) - (not (string-match helm-ff-url-regexp file))) - (or (helm-ff-get-host-from-tramp-invalid-fname file) - (helm-basename file)) file)) - (attr (file-attributes file)) - (type (car attr))) - - (cond ((string-match "access denied" file) file) - ( ;; A not already saved file. - (and (stringp type) - (not (helm-ff-valid-symlink-p file)) - (not (string-match "^\.#" (helm-basename file)))) - (cons (helm-ff-prefix-filename - (propertize disp 'face 'helm-ff-invalid-symlink) t) - file)) - ;; A symlink. - ((stringp type) - (cons (helm-ff-prefix-filename - (propertize disp 'face 'helm-ff-symlink) t) - file)) - ;; A directory. - ((eq t type) - (cons (helm-ff-prefix-filename - (propertize disp 'face 'helm-ff-directory) t) - file)) - ;; An executable file. - ((and attr (string-match "x" (nth 8 attr))) - (cons (helm-ff-prefix-filename - (propertize disp 'face 'helm-ff-executable) t) - file)) - ;; A file. - ((and attr (null type)) - (cons (helm-ff-prefix-filename - (propertize disp 'face 'helm-ff-file) t) - file)) - ;; A non--existing file. - (t - (cons (helm-ff-prefix-filename - (propertize disp 'face 'helm-ff-file) nil 'new-file) - file))))))) + (cons (or (helm-ff-get-host-from-tramp-invalid-fname file) + (helm-basename file)) + file)) + file) + ;; Now highlight. + (let* ((disp (if (and helm-ff-transformer-show-only-basename + (not (helm-dir-is-dot file)) + (not (and ffap-url-regexp + (string-match ffap-url-regexp file))) + (not (string-match helm-ff-url-regexp file))) + (or (helm-ff-get-host-from-tramp-invalid-fname file) + (helm-basename file)) file)) + (attr (file-attributes file)) + (type (car attr))) + + (cond ((string-match "access denied" file) file) + ( ;; A not already saved file. + (and (stringp type) + (not (helm-ff-valid-symlink-p file)) + (not (string-match "^\.#" (helm-basename file)))) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-invalid-symlink) t) + file)) + ;; A symlink. + ((stringp type) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-symlink) t) + file)) + ;; A directory. + ((eq t type) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-directory) t) + file)) + ;; An executable file. + ((and attr (string-match "x" (nth 8 attr))) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-executable) t) + file)) + ;; A file. + ((and attr (null type)) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-file) t) + file)) + ;; A non--existing file. + (t + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-file) nil 'new-file) + file))))))) (defun helm-find-files-action-transformer (actions candidate) "Action transformer for `helm-source-find-files'." @@ -1842,7 +1842,7 @@ This is a destructive operation on FILE made by external tool mogrify." (image-dired-display-image file) (message nil) (display-buffer (get-buffer image-dired-display-image-buffer))) - (error "mogrify not found")))) + (error "mogrify not found")))) (defun helm-ff-rotate-image-left (candidate) "Rotate image file CANDIDATE left. @@ -1876,8 +1876,8 @@ This affect directly file CANDIDATE." helm-ff-exif-data-program helm-ff-exif-data-program-args candidate)) - (format "No program %s found to extract exif" - helm-ff-exif-data-program))) + (format "No program %s found to extract exif" + helm-ff-exif-data-program))) (defun helm-find-files-persistent-action (candidate) "Open subtree CANDIDATE without quitting helm. @@ -1906,7 +1906,7 @@ If a prefix arg is given or `helm-follow-mode' is on open file." ;; second hit insert ":" and expand. (if (string= candidate helm-pattern) (funcall insert-in-minibuffer (concat candidate ":")) - (funcall insert-in-minibuffer candidate))) + (funcall insert-in-minibuffer candidate))) ( ;; A symlink directory, expand it's truename. (and (file-directory-p candidate) (file-symlink-p candidate)) (funcall insert-in-minibuffer (file-name-as-directory @@ -1959,22 +1959,22 @@ If a prefix arg is given or `helm-follow-mode' is on open file." (with-helm-current-buffer (if buffer-read-only (error "Error: Buffer `%s' is read-only" (buffer-name)) - (let* ((end (point)) - (tap (thing-at-point 'filename)) - (guess (and (stringp tap) (substring-no-properties tap))) - (beg (- (point) (length guess))) - (full-path-p (and (stringp guess) - (or (string-match-p (concat "^" (getenv "HOME")) guess) - (string-match-p "^[^\~]" guess))))) - (set-text-properties 0 (length candidate) nil candidate) - (if (and guess (not (string= guess "")) - (string-match-p "^\\(~/\\|/\\|[a-zA-Z]:/\\)" guess)) - (progn - (delete-region beg end) - (insert (if full-path-p - (expand-file-name candidate) - (abbreviate-file-name candidate)))) - (insert candidate)))))) + (let* ((end (point)) + (tap (thing-at-point 'filename)) + (guess (and (stringp tap) (substring-no-properties tap))) + (beg (- (point) (length guess))) + (full-path-p (and (stringp guess) + (or (string-match-p (concat "^" (getenv "HOME")) guess) + (string-match-p "^[^\~]" guess))))) + (set-text-properties 0 (length candidate) nil candidate) + (if (and guess (not (string= guess "")) + (string-match-p "^\\(~/\\|/\\|[a-zA-Z]:/\\)" guess)) + (progn + (delete-region beg end) + (insert (if full-path-p + (expand-file-name candidate) + (abbreviate-file-name candidate)))) + (insert candidate)))))) (cl-defun helm-find-files-history (&key (comp-read t)) "The `helm-find-files' history. @@ -1987,14 +1987,14 @@ Show the first `helm-ff-history-max-length' elements of (setq helm-ff-history (if (>= (length history) helm-ff-history-max-length) (cl-subseq history 0 helm-ff-history-max-length) - history)) + history)) (if comp-read (helm-comp-read "Switch to Directory: " helm-ff-history :name "Helm Find Files History" :must-match t) - helm-ff-history)))) + helm-ff-history)))) (defun helm-find-files-1 (fname &optional preselect) "Find FNAME with `helm' completion. @@ -2133,27 +2133,27 @@ Argument FOLLOW when non--nil specify to follow FILES to destination." ;; Else we use CANDIDATE. #'(lambda (from) (expand-file-name (file-name-nondirectory from) candidate)) - #'(lambda (_from) candidate)) + #'(lambda (_from) candidate)) marker) (push (file-name-as-directory (if (file-directory-p candidate) (expand-file-name candidate) - (file-name-directory candidate))) + (file-name-directory candidate))) helm-ff-history) ;; If follow is non--nil we should not be in async mode. (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) @@ -2188,7 +2188,7 @@ following files to destination." (helm-make-visible-mark) (helm-next-line) (setq helm-ff-cand-to-mark (cdr helm-ff-cand-to-mark))) - (helm-next-line))) + (helm-next-line))) (unless (helm-this-visible-mark) (helm-prev-visible-mark))))) @@ -2226,8 +2226,8 @@ Ask to kill buffers associated with that file, too." (file-directory-p file)) (delete-directory file)) (t (delete-file file))) - (dired-delete-file - file dired-recursive-deletes delete-by-moving-to-trash)) + (dired-delete-file + file dired-recursive-deletes delete-by-moving-to-trash)) (when buffers (cl-dolist (buf buffers) (when (y-or-n-p (format "Kill buffer %s, too? " buf)) @@ -2241,14 +2241,14 @@ Ask to kill buffers associated with that file, too." (mapcar #'(lambda (f) (if (file-directory-p f) (concat (helm-basename f) "/") - (helm-basename f))) + (helm-basename f))) files) (if (not (y-or-n-p (format "Delete *%s File(s)" len))) (message "(No deletions performed)") - (cl-dolist (i files) - (set-text-properties 0 (length i) nil i) - (helm-delete-file i helm-ff-signal-error-on-dot-files)) - (message "%s File(s) deleted" len))))) + (cl-dolist (i files) + (set-text-properties 0 (length i) nil i) + (helm-delete-file i helm-ff-signal-error-on-dot-files)) + (message "%s File(s) deleted" len))))) (defun helm-find-file-or-marked (candidate) "Open file CANDIDATE or open helm marked files in background." @@ -2265,28 +2265,28 @@ Ask to kill buffers associated with that file, too." (error "Mkdir: Unable to create directory `%s': file exists." (helm-basename dirfname)) - (make-directory dir 'parent))) + (make-directory dir 'parent))) (or (and helm-ff (helm-find-files-1 dir)) t))))) (if (> (length marked) 1) ;; Open all marked files in background and display ;; the first one. (progn (mapc 'find-file-noselect (cdr marked)) (find-file (car marked))) - (if (and (not (file-exists-p candidate)) - (not url-p) - (string-match "/$" candidate)) - ;; A a non--existing filename ending with / - ;; Create a directory and jump to it. - (funcall make-dir-fn candidate 'helm-ff) - ;; A non--existing filename NOT ending with / or - ;; an existing filename, create or jump to it. - ;; If the basedir of candidate doesn't exists, - ;; ask for creating it. - (let ((dir (file-name-directory candidate))) - (if (or (and dir (file-directory-p dir)) url-p) - (find-file-at-point (car marked)) - (and (funcall make-dir-fn dir) - (find-file-at-point candidate)))))))) + (if (and (not (file-exists-p candidate)) + (not url-p) + (string-match "/$" candidate)) + ;; A a non--existing filename ending with / + ;; Create a directory and jump to it. + (funcall make-dir-fn candidate 'helm-ff) + ;; A non--existing filename NOT ending with / or + ;; an existing filename, create or jump to it. + ;; If the basedir of candidate doesn't exists, + ;; ask for creating it. + (let ((dir (file-name-directory candidate))) + (if (or (and dir (file-directory-p dir)) url-p) + (find-file-at-point (car marked)) + (and (funcall make-dir-fn dir) + (find-file-at-point candidate)))))))) (defun helm-shadow-boring-files (files) "Files matching `helm-boring-file-regexp' will be @@ -2311,14 +2311,14 @@ other candidate transformers." "/cygdrive/\\(.\\)" "\\1:" (replace-regexp-in-string "\\\\" "/" x))) args) - args)) + args)) (defun helm-transform-file-load-el (actions candidate) "Add action to load the file CANDIDATE if it is an emacs lisp file. Else return ACTIONS unmodified." (if (member (file-name-extension candidate) '("el" "elc")) (append actions '(("Load Emacs Lisp File" . load-file))) - actions)) + actions)) (defun helm-transform-file-browse-url (actions candidate) "Add an action to browse the file CANDIDATE if it is a html file or URL. @@ -2340,7 +2340,7 @@ Else return ACTIONS unmodified." 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)))))) + (directory-files f t dired-re-no-dot)))))) ;; (dired '("~/" "~/.emacs.d/.emacs-custom.el" "~/.emacs.d/.emacs.bmk")) @@ -2398,7 +2398,7 @@ Else return ACTIONS unmodified." (candidates . (lambda () (if helm-ff-file-name-history-use-recentf recentf-list - file-name-history))) + file-name-history))) (persistent-action . ignore) (filtered-candidate-transformer . helm-file-name-history-transformer) (action . (("Find file" @@ -2604,7 +2604,7 @@ utility mdfind.") (filtered-candidate-transformer . ((lambda (candidates _source) (if helm-findutils-skip-boring-files (helm-skip-boring-files candidates) - candidates)) + candidates)) helm-findutils-transformer)) (action-transformer helm-transform-file-load-el) (action . ,(cdr (helm-inherit-attribute-from-source @@ -2669,7 +2669,7 @@ utility mdfind.") (if arg (file-name-as-directory (read-directory-name "DefaultDirectory: ")) - default-directory))) + default-directory))) (helm-find-1 directory))) (defvar org-directory) diff --git a/helm-font.el b/helm-font.el index aaf455cc..201f6c4b 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) @@ -93,9 +93,9 @@ Only math* symbols are collected." 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)) + ;; 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) diff --git a/helm-gentoo.el b/helm-gentoo.el index 766ccb3e..7160293b 100644 --- a/helm-gentoo.el +++ b/helm-gentoo.el @@ -56,7 +56,7 @@ ("Show history" . (lambda (elm) (if (member elm helm-cache-world) (helm-gentoo-eshell-action elm "genlop -qe") - (message "No infos on packages not yet installed")))) + (message "No infos on packages not yet installed")))) ("Copy in kill-ring" . kill-new) ("insert at point" . insert) ("Browse HomePage" . (lambda (elm) @@ -65,7 +65,7 @@ ("Show extra infos" . (lambda (elm) (if (member elm helm-cache-world) (helm-gentoo-eshell-action elm "genlop -qi") - (message "No infos on packages not yet installed")))) + (message "No infos on packages not yet installed")))) ("Show use flags" . (lambda (elm) (helm-gentoo-default-action elm "equery" "-C" "u") (font-lock-add-keywords nil '(("^\+.*" . font-lock-variable-name-face))) @@ -107,7 +107,7 @@ (let ((com-list (append args (list elm)))) (apply #'call-process command nil t nil com-list))) - (message "No infos on packages not yet installed"))) + (message "No infos on packages not yet installed"))) (defvar helm-source-use-flags '((name . "Use Flags") @@ -174,7 +174,7 @@ (pop-to-buffer "*scratch*") (eshell-command (format "%s %s" command elm))) (pop-to-buffer "*EShell Command Output*")) - (eshell-command (format "%s %s" command elm))))) + (eshell-command (format "%s %s" command elm))))) (defun helm-gentoo-get-use () "Initialize buffer with all use flags." diff --git a/helm-grep.el b/helm-grep.el index 8e20729c..6c8919cb 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) @@ -249,53 +249,53 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") (mapcar #'(lambda (x) (file-remote-p x 'localname)) candidates) - candidates)) + candidates)) (if helm-zgrep-recurse-flag (mapconcat 'shell-quote-argument candidates " ") - ;; When candidate is a directory, search in all its files. - ;; NOTE that `file-expand-wildcards' will return also - ;; directories, they will be ignored by grep but not - ;; by ack-grep that will grep all files of this directory - ;; without recursing in their subdirs though, see that as a one - ;; 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 " "))))) + ;; When candidate is a directory, search in all its files. + ;; NOTE that `file-expand-wildcards' will return also + ;; directories, they will be ignored by grep but not + ;; by ack-grep that will grep all files of this directory + ;; without recursing in their subdirs though, see that as a one + ;; 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 " "))))) (defun helm-grep-command (&optional recursive) (let ((com (car (split-string (if recursive helm-grep-default-recurse-command - helm-grep-default-command) " ")))) + helm-grep-default-command) " ")))) (if (string= com "git") "git-grep" com))) (cl-defun helm-grep-use-ack-p (&key where) @@ -331,7 +331,7 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") (if helm-grep-in-recurse (concat (or include ignored-files) " " ignored-dirs) - ignored-files))) + ignored-files))) (types (and (helm-grep-use-ack-p) ;; When %e format spec is not specified ;; in `helm-grep-default-command' @@ -339,16 +339,16 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") ;; to types to avoid error. (or include ""))) (smartcase (if (helm-grep-use-ack-p) "" - (unless (let ((case-fold-search nil)) - (string-match-p - "[A-Z]" helm-pattern)) "i"))) + (unless (let ((case-fold-search nil)) + (string-match-p + "[A-Z]" helm-pattern)) "i"))) (cmd-line (format-spec helm-grep-default-command (delq nil (list (unless zgrep (if types (cons ?e types) - (cons ?e exclude))) + (cons ?e exclude))) (cons ?c (or smartcase "")) (cons ?p (shell-quote-argument helm-pattern)) @@ -390,10 +390,10 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") "[%s process finished - (no results)] " (if helm-grep-use-zgrep "Zgrep" - (capitalize - (if helm-grep-in-recurse - (helm-grep-command t) - (helm-grep-command))))) + (capitalize + (if helm-grep-in-recurse + (helm-grep-command t) + (helm-grep-command))))) 'face 'helm-grep-finish)))))) ((string= event "finished\n") (with-helm-window @@ -405,10 +405,10 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") "[%s process finished - (%s results)] " (if helm-grep-use-zgrep "Zgrep" - (capitalize - (if helm-grep-in-recurse - (helm-grep-command t) - (helm-grep-command)))) + (capitalize + (if helm-grep-in-recurse + (helm-grep-command t) + (helm-grep-command)))) (max (1- (count-lines (point-min) (point-max))) 0)) @@ -438,7 +438,7 @@ WHERE can be one of other-window, elscreen, other-frame." (loc-fname (or (with-current-buffer (if (eq major-mode 'helm-grep-mode) (current-buffer) - helm-buffer) + helm-buffer) (get-text-property (point-at-bol) 'help-echo)) (car split))) (tramp-method (file-remote-p (or helm-ff-default-directory @@ -455,7 +455,7 @@ WHERE can be one of other-window, elscreen, other-frame." (grep (helm-grep-save-results-1)) (pdf (if helm-pdfgrep-default-read-command (helm-pdfgrep-action-1 split lineno (car split)) - (find-file (car split)) (doc-view-goto-page lineno))) + (find-file (car split)) (doc-view-goto-page lineno))) (t (find-file fname))) (unless (or (eq where 'grep) (eq where 'pdf)) (helm-goto-line lineno)) @@ -480,7 +480,7 @@ WHERE can be one of other-window, elscreen, other-frame." With a prefix arg record CANDIDATE in `mark-ring'." (if current-prefix-arg (helm-grep-action candidate nil 'mark) - (helm-grep-action candidate)) + (helm-grep-action candidate)) (helm-highlight-current-line)) (defun helm-grep-other-window (candidate) @@ -500,16 +500,16 @@ With a prefix arg record CANDIDATE in `mark-ring'." If N is positive go forward otherwise go backward." (let* ((sel (if (eq major-mode 'helm-grep-mode) (buffer-substring (point-at-bol) (point-at-eol)) - (helm-get-selection nil t))) + (helm-get-selection nil t))) (current-line-list (if (eq type 'etags) (split-string sel ": +" t) - (helm-grep-split-line sel))) + (helm-grep-split-line sel))) (current-fname (nth 0 current-line-list)) (bob-or-eof (if (eq n 1) 'eobp 'bobp)) (mark-maybe #'(lambda () (if (eq major-mode 'helm-grep-mode) (ignore) - (helm-mark-current-line))))) + (helm-mark-current-line))))) (catch 'break (while (not (funcall bob-or-eof)) (forward-line n) ; Go forward or backward depending of n value. @@ -519,7 +519,7 @@ If N is positive go forward otherwise go backward." (unless (or (string= current-fname (car (if (eq type 'etags) (split-string sel ": +" t) - (helm-grep-split-line sel)))) + (helm-grep-split-line sel)))) (and (eq major-mode 'helm-grep-mode) (not (get-text-property (point-at-bol) 'help-echo)))) (funcall mark-maybe) @@ -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}") @@ -733,7 +733,7 @@ These extensions will be added to command line with --include arg of grep." (directory-files (car files) nil directory-files-no-dot-files-regexp) - files) + files) for i in lst for ext = (file-name-extension i 'dot) for glob = (and ext (not (string= ext "")) @@ -761,7 +761,7 @@ These extensions will be added to command line with --include arg of grep." ;; e.g '("*.el *.py") (cl-loop for i in extensions append (split-string-and-unquote i " ")) - (list "*")))) + (list "*")))) ;;; Set up source @@ -794,7 +794,7 @@ in recurse, search being made on `helm-zgrep-file-extension-regexp'." (shell-quote-argument x))) (if (> (length exts) 1) (remove "*" exts) - exts) " "))) + exts) " "))) (types (and (not include-files) (not zgrep) recurse @@ -836,7 +836,7 @@ in recurse, search being made on `helm-zgrep-file-extension-regexp'." (setq helm-source-grep `((name . ,(if zgrep "Zgrep" (capitalize (if recurse (helm-grep-command t) - (helm-grep-command))))) + (helm-grep-command))))) (header-name . (lambda (name) (concat name "(C-c ? Help)"))) (candidates-process . helm-grep-collect-candidates) @@ -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 - def-dir - (helm-walk-directory + (let* ((def-dir (or helm-ff-default-directory + default-directory)) + (only (if recursive + (or (gethash def-dir helm-rzgrep-cache) + (puthash def-dir - :directories nil - :path 'full - :match helm-zgrep-file-extension-regexp) - helm-rzgrep-cache)) - flist))) - (helm-do-grep-1 only recursive 'zgrep)) + (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)) (setq helm-zgrep-recurse-flag nil))) @@ -913,7 +913,7 @@ in recurse, search being made on `helm-zgrep-file-extension-regexp'." (split (helm-grep-split-line candidate)) (fname (if (and root split) (expand-file-name (car split) root) - (car-safe split))) + (car-safe split))) (lineno (nth 1 split)) (str (nth 2 split))) (when (and fname lineno str) @@ -946,7 +946,7 @@ in recurse, search being made on `helm-zgrep-file-extension-regexp'." helm-pattern) unless (string-match "\\`!" r) collect r) - (list helm-pattern)) + (list helm-pattern)) do (while (and (re-search-forward reg nil t) (> (- (setq end (match-end 0)) @@ -972,10 +972,10 @@ If a prefix arg is given run grep on all buffers ignoring non--file-buffers." (if (and helm-ff-default-directory (file-remote-p helm-ff-default-directory)) default-directory - helm-ff-default-directory)) + helm-ff-default-directory)) (cands (if prefarg (buffer-list) - (helm-marked-candidates))) + (helm-marked-candidates))) (win-conf (current-window-configuration)) ;; Non--fname and remote buffers are ignored. (bufs (cl-loop for buf in cands @@ -985,15 +985,15 @@ If a prefix arg is given run grep on all buffers ignoring non--file-buffers." (if bufs (if zgrep (helm-do-grep-1 bufs nil 'zgrep) - (helm-do-grep-1 bufs)) - ;; bufs is empty, thats mean we have only CANDIDATE - ;; and it is not a buffer-filename, fallback to occur. - (helm-switch-to-buffer candidate) - (when (get-buffer helm-action-buffer) - (kill-buffer helm-action-buffer)) - (helm-occur) - (when (eq helm-exit-status 1) - (set-window-configuration win-conf))))) + (helm-do-grep-1 bufs)) + ;; bufs is empty, thats mean we have only CANDIDATE + ;; and it is not a buffer-filename, fallback to occur. + (helm-switch-to-buffer candidate) + (when (get-buffer helm-action-buffer) + (kill-buffer helm-action-buffer)) + (helm-occur) + (when (eq helm-exit-status 1) + (set-window-configuration win-conf))))) (defun helm-grep-buffers (candidate) "Action to grep buffers." @@ -1018,7 +1018,7 @@ If a prefix arg is given run grep on all buffers ignoring non--file-buffers." (mapcar #'(lambda (x) (file-remote-p x 'localname)) only-files) - only-files))) + only-files))) (cmd-line (format helm-pdfgrep-default-command helm-pattern fnargs)) @@ -1045,8 +1045,8 @@ If a prefix arg is given run grep on all buffers ignoring non--file-buffers." (point-min) (point-max))) 0)) 'face 'helm-grep-finish)))) (force-mode-line-update)) - (helm-log "Error: Pdf grep %s" - (replace-regexp-in-string "\n" "" event)))))))) + (helm-log "Error: Pdf grep %s" + (replace-regexp-in-string "\n" "" event)))))))) (defun helm-do-pdfgrep-1 (only) "Launch pdfgrep with a list of ONLY files." @@ -1114,7 +1114,7 @@ See also `helm-do-grep-1'." :preselect (and helm-do-grep-preselect-candidate (if helm-ff-transformer-show-only-basename (helm-basename preselection) - preselection)))) + preselection)))) (prefarg (or current-prefix-arg helm-current-prefix-arg))) (helm-do-grep-1 only prefarg))) @@ -1132,7 +1132,7 @@ See also `helm-do-grep-1'." :preselect (and helm-do-grep-preselect-candidate (if helm-ff-transformer-show-only-basename (helm-basename preselection) - preselection))))) + preselection))))) (helm-ff-zgrep-1 ls prefarg))) ;;;###autoload @@ -1152,7 +1152,7 @@ See also `helm-do-grep-1'." :preselect (and helm-do-grep-preselect-candidate (if helm-ff-transformer-show-only-basename (helm-basename preselection) - preselection)))) + preselection)))) (helm-grep-default-function 'helm-pdfgrep-init)) (helm-do-pdfgrep-1 only))) diff --git a/helm-help.el b/helm-help.el index 626ee889..a2a99f1a 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)))) diff --git a/helm-imenu.el b/helm-imenu.el index 5d5deaab..115cb21e 100644 --- a/helm-imenu.el +++ b/helm-imenu.el @@ -99,12 +99,12 @@ (let ((tick (buffer-modified-tick))) (if (eq helm-cached-imenu-tick tick) helm-cached-imenu-candidates - (setq imenu--index-alist nil) - (setq helm-cached-imenu-tick tick - helm-cached-imenu-candidates - (let ((index (imenu--make-index-alist))) - (helm-imenu--candidates-1 - (delete (assoc "*Rescan*" index) index)))))))) + (setq imenu--index-alist nil) + (setq helm-cached-imenu-tick tick + helm-cached-imenu-candidates + (let ((index (imenu--make-index-alist))) + (helm-imenu--candidates-1 + (delete (assoc "*Rescan*" index) index)))))))) (defun helm-imenu--candidates-1 (alist) (cl-loop for elm in alist @@ -114,8 +114,8 @@ (cons (propertize e 'helm-imenu-type (car elm)) v))) - (and (cdr elm) ; bug in imenu, should not be needed. - (list elm))))) + (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 diff --git a/helm-info.el b/helm-info.el index 0169bfe6..643999d8 100644 --- a/helm-info.el +++ b/helm-info.el @@ -103,16 +103,16 @@ source.") "Collect candidates for initial Info node Top." (if helm-info-pages helm-info-pages - (let ((info-topic-regexp "\\* +\\([^:]+: ([^)]+)[^.]*\\)\\.") - topics) - (require 'info) - (with-temp-buffer - (Info-find-node "dir" "top") - (goto-char (point-min)) - (while (re-search-forward info-topic-regexp nil t) - (push (match-string-no-properties 1) topics)) - (kill-buffer)) - (setq helm-info-pages topics)))) + (let ((info-topic-regexp "\\* +\\([^:]+: ([^)]+)[^.]*\\)\\.") + topics) + (require 'info) + (with-temp-buffer + (Info-find-node "dir" "top") + (goto-char (point-min)) + (while (re-search-forward info-topic-regexp nil t) + (push (match-string-no-properties 1) topics)) + (kill-buffer)) + (setq helm-info-pages topics)))) (defvar helm-source-info-pages `((name . "Info Pages") diff --git a/helm-locate.el b/helm-locate.el index e45f5993..395506af 100644 --- a/helm-locate.el +++ b/helm-locate.el @@ -140,13 +140,13 @@ See `helm-locate-with-db' and `helm-locate'." (let ((pfn #'(lambda (candidate) (if (file-directory-p candidate) (message "Error: The locate Db should be a file") - (if (= (shell-command - (format helm-locate-create-db-command - candidate - helm-ff-default-directory)) - 0) - (message "New locatedb file `%s' created" candidate) - (error "Failed to create locatedb file `%s'" candidate))))) + (if (= (shell-command + (format helm-locate-create-db-command + candidate + helm-ff-default-directory)) + 0) + (message "New locatedb file `%s' created" candidate) + (error "Failed to create locatedb file `%s'" candidate))))) (locdb (and localdb (not (string-match "^es" helm-locate-command)) (or (and (equal '(4) localdb) @@ -164,7 +164,7 @@ See `helm-locate-with-db' and `helm-locate'." (or (string-match helm-locate-db-file-regexp x) (file-directory-p x)) - x))))))) + x))))))) (when (and locdb (or (equal localdb '(16)) (not (file-exists-p locdb)))) (funcall pfn locdb)) @@ -202,7 +202,7 @@ See also `helm-locate'." unless (file-directory-p i) collect i) ":")) helm-locate-command) - helm-locate-command))) + helm-locate-command))) (setq helm-file-name-history (mapcar 'helm-basename file-name-history)) (helm :sources 'helm-source-locate :buffer "*helm locate*" @@ -227,10 +227,10 @@ See also `helm-locate'." (smart (let ((case-fold-search nil)) (if (string-match "[A-Z]" helm-pattern) case-sensitive-flag - ignore-case-flag))) + ignore-case-flag))) (t (if helm-locate-case-fold-search ignore-case-flag - case-sensitive-flag))) + case-sensitive-flag))) (concat ;; The pattern itself. (shell-quote-argument (car args)) " " @@ -251,8 +251,8 @@ See also `helm-locate'." (point-min) (point-max))) 0)) 'face 'helm-grep-finish)))) (force-mode-line-update)) - (helm-log "Error: Locate %s" - (replace-regexp-in-string "\n" "" event)))))))) + (helm-log "Error: Locate %s" + (replace-regexp-in-string "\n" "" event)))))))) (defun helm-locate-pattern-transformer (pattern) "Replace spaces in PATTERN with \".*\". @@ -263,7 +263,7 @@ Do nothing when `helm-locate-command' is 'es'." " -[a-z]\\'" "" pattern)) (not (string-match-p "\\`es" helm-locate-command))) (replace-match ".*" nil t pattern) - pattern)) + pattern)) (defvar helm-source-locate `((name . "Locate") diff --git a/helm-man.el b/helm-man.el index e87775b0..a0fcb80b 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 @@ -51,8 +51,8 @@ source.") "ManFile: " wfiles :must-match t))) (if (eq helm-man-or-woman-function 'Man-getpage-in-background) (manual-entry (format "-l %s" file)) - (woman-find-file file))) - (funcall helm-man-or-woman-function candidate)) + (woman-find-file file))) + (funcall helm-man-or-woman-function candidate)) ;; If woman is unable to format correctly ;; use man instead. (error (kill-buffer) ; Kill woman buffer. @@ -81,7 +81,7 @@ source.") (action-transformer . (lambda (actions candidate) (if (eq system-type 'darwin) '(("Display Man page" . man)) - actions))))) + actions))))) ;;;###autoload (defun helm-man-woman (arg) diff --git a/helm-match-plugin.el b/helm-match-plugin.el index ec35d0e0..60208ec3 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 @@ -116,10 +116,10 @@ See `helm-mp-matching-method' for the behavior of each method." (progn (add-to-list 'helm-compile-source-functions 'helm-compile-source--match-plugin) (add-hook 'helm-update-hook 'helm-mp-highlight-match)) - (setq helm-compile-source-functions - (delq 'helm-compile-source--match-plugin - helm-compile-source-functions)) - (remove-hook 'helm-update-hook 'helm-mp-highlight-match))) + (setq helm-compile-source-functions + (delq 'helm-compile-source--match-plugin + helm-compile-source-functions)) + (remove-hook 'helm-update-hook 'helm-mp-highlight-match))) ;;; Build regexps @@ -135,11 +135,11 @@ i.e \"foo bar\"=> (\"foo\" \"bar\") but \"foo\ bar\"=> (\"foobar\")." (if (string= pattern "") '("") - (cl-loop for s in (split-string - (replace-regexp-in-string helm-mp-space-regexp - "\000\000" pattern) - " " t) - collect (replace-regexp-in-string "\000\000" " " s)))) + (cl-loop for s in (split-string + (replace-regexp-in-string helm-mp-space-regexp + "\000\000" pattern) + " " t) + collect (replace-regexp-in-string "\000\000" " " s)))) (defun helm-mp-1-make-regexp (pattern) "Replace spaces in PATTERN with \"\.*\"." @@ -271,7 +271,7 @@ e.g ((identity . \"foo\") (identity . \"bar\"))." (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))))) + (cons 'identity pat))))) (defun helm-mp-3-match (str &optional pattern) "Check if PATTERN match STR. @@ -296,7 +296,7 @@ instead of matching on a string. 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) + pattern) while (funcall searchfn1 (or (cdar pat) "") nil t) for bol = (point-at-bol) for eol = (point-at-eol) @@ -353,30 +353,30 @@ e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to (defun helm-compile-source--match-plugin (source) (if (assoc 'no-matchplugin source) source - (let* ((searchers (if (assoc 'search-from-end source) - helm-mp-default-search-backward-functions - helm-mp-default-search-functions)) - (defmatch (helm-aif (assoc-default 'match source) - (helm-mklist it))) - (defmatch-strict (helm-aif (assoc-default 'match-strict source) - (helm-mklist it))) - (defsearch (helm-aif (assoc-default 'search source) - (helm-mklist it))) - (defsearch-strict (helm-aif (assoc-default 'search-strict source) - (helm-mklist it))) - (matchfns (cond (defmatch-strict) - (defmatch - (append helm-mp-default-match-functions defmatch)) - (t helm-mp-default-match-functions))) - (searchfns (cond (defsearch-strict) - (defsearch - (append searchers defsearch)) - (t searchers)))) - `(,(if (or (assoc 'candidates-in-buffer source) - (equal '(identity) matchfns)) - '(match identity) `(match ,@matchfns)) - (search ,@searchfns) - ,@source)))) + (let* ((searchers (if (assoc 'search-from-end source) + helm-mp-default-search-backward-functions + helm-mp-default-search-functions)) + (defmatch (helm-aif (assoc-default 'match source) + (helm-mklist it))) + (defmatch-strict (helm-aif (assoc-default 'match-strict source) + (helm-mklist it))) + (defsearch (helm-aif (assoc-default 'search source) + (helm-mklist it))) + (defsearch-strict (helm-aif (assoc-default 'search-strict source) + (helm-mklist it))) + (matchfns (cond (defmatch-strict) + (defmatch + (append helm-mp-default-match-functions defmatch)) + (t helm-mp-default-match-functions))) + (searchfns (cond (defsearch-strict) + (defsearch + (append searchers defsearch)) + (t searchers)))) + `(,(if (or (assoc 'candidates-in-buffer source) + (equal '(identity) matchfns)) + '(match identity) `(match ,@matchfns)) + (search ,@searchfns) + ,@source)))) ;;; Highlight matches. @@ -417,7 +417,7 @@ e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to finally return (if (and re-list (>= (length re-list) 1)) (mapconcat 'identity re-list "\\|") - (regexp-quote helm-pattern))))) + (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 816b36f5..e1f32ec7 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) @@ -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 @@ -151,7 +151,7 @@ http://www.emacswiki.org/cgi-bin/wiki/download/linkd.el") collect (if (get item 'name) (cons (get item 'name) item) - (cons (symbol-name item) item))))) + (cons (symbol-name item) item))))) (defvar helm-source-jabber-contacts '((name . "Jabber Contacts") @@ -234,8 +234,8 @@ It is added to `extended-command-history'. (cmd (helm-symbolify cmd-or-name))) (if (stringp (symbol-function cmd)) (execute-kbd-macro (symbol-function cmd)) - (setq this-command cmd) - (call-interactively cmd)))) + (setq this-command cmd) + (call-interactively cmd)))) ;;; Minibuffer History ;; @@ -251,7 +251,7 @@ It is added to `extended-command-history'. unless (string= "" i) collect i))) (if (consp (car history)) (mapcar 'prin1-to-string history) - history)))) + history)))) (migemo) (multiline) (action . (lambda (candidate) diff --git a/helm-mode.el b/helm-mode.el index ac60961f..f4b128fd 100644 --- a/helm-mode.el +++ b/helm-mode.el @@ -167,7 +167,7 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." (condition-case err (if (eq (quote ,test) 'commandp) (funcall (quote ,test) (intern elm)) - (funcall (quote ,test) elm)) + (funcall (quote ,test) elm)) (wrong-type-argument (funcall (quote ,test) (intern elm))))))) (all-completions "" (symbol-value collection) predicate))) @@ -309,7 +309,7 @@ that use `helm-comp-read' See `helm-M-x' for example." . (lambda (candidate) (if ,marked-candidates (helm-marked-candidates) - (identity candidate))))))) + (identity candidate))))))) ;; Assume completion have been already required, ;; so always use 'confirm. (when (eq must-match 'confirm-after-completion) @@ -323,7 +323,7 @@ that use `helm-comp-read' See `helm-M-x' for example." (loc-map (if must-match-map (make-composed-keymap must-match-map (or keymap helm-map)) - (or keymap helm-map))) + (or keymap helm-map))) (helm-read-file-name-mode-line-string (replace-regexp-in-string "helm-exit-minibuffer" "helm-confirm-and-exit-minibuffer" @@ -340,7 +340,7 @@ that use `helm-comp-read' See `helm-M-x' for example." (setq helm-cr-unknown-pattern-flag t)) (if (and default (not (string= default ""))) (delq nil (cons default (delete default cands))) - cands)))) + cands)))) (history-get-candidates (lambda () (let ((all (helm-comp-read-get-candidates history test nil alistp))) @@ -351,7 +351,7 @@ that use `helm-comp-read' See `helm-M-x' for example." (if (and default (not (string= default ""))) (delq nil (cons default (delete default all))) - all) + all) :test 'equal)))))) (src-hist `((name . ,(format "%s History" name)) (candidates . ,history-get-candidates) @@ -392,9 +392,9 @@ that use `helm-comp-read' See `helm-M-x' for example." (src-list (list src-hist (if candidates-in-buffer src-1 - (if volatile - (append src '((volatile))) - src)))) + (if volatile + (append src '((volatile))) + src)))) (helm-execute-action-at-once-if-one exec-when-only-one) (helm-quit-if-no-candidate quit-when-no-cand) result) @@ -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 @@ -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. @@ -512,8 +512,8 @@ It should be used when candidate list don't need to rebuild dynamically." ;; and set it to its car. #bugfix `grep-read-files'. (setq collection (if (listp collection) (append default collection) - ;; Else COLLECTION is maybe a function or a table. - (append default (all-completions "" collection)))) + ;; Else COLLECTION is maybe a function or a table. + (append default (all-completions "" collection)))) (setq default (car default))) (helm-comp-read prompt collection @@ -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 @@ -569,7 +569,7 @@ See documentation of `completing-read' and `all-completions' for details." (let* ((current-command (or (helm-this-command) this-command)) (str-command (if (consp current-command) ; Maybe a lambda. "Anonymous" - (symbol-name current-command))) + (symbol-name current-command))) (buf-name (format "*helm-mode-%s*" str-command)) (entry (assq current-command helm-completing-read-handlers-alist)) @@ -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 @@ -707,7 +707,7 @@ Keys description: . (lambda (candidate) (if ,marked-candidates (helm-marked-candidates :with-wildcard t) - (identity candidate)))))) + (identity candidate)))))) (helm-mp-highlight-delay nil) ;; Be sure we don't erase the underlying minibuffer if some. (helm-ff-auto-update-initial-value @@ -725,7 +725,7 @@ Keys description: (cmap (if must-match-map (make-composed-keymap must-match-map helm-read-file-map) - helm-read-file-map)) + helm-read-file-map)) (helm-read-file-name-mode-line-string (replace-regexp-in-string "helm-exit-minibuffer" "helm-confirm-and-exit-minibuffer" @@ -762,7 +762,7 @@ Keys description: when (or (member i hn) ; A tramp host (funcall ',test i)) ; Test ok collect i) - (helm-find-files-get-candidates ',must-match))))) + (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) (keymap . ,cmap) @@ -775,7 +775,7 @@ Keys description: :sources (if nomark (cl-loop for src in src-list collect (cons '(nomark) src)) - src-list) + src-list) :input initial-input :prompt prompt :resume 'noresume @@ -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 <f>" 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 - 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)))) + (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 <f>" 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 + 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))) @@ -981,16 +981,16 @@ Can be used as value for `completion-in-region-function'." (string-match "/\\'" target) (if (string-match "~?/" target) (file-exists-p (expand-file-name candidate (helm-basedir target))) - (file-exists-p (expand-file-name - candidate (with-helm-current-buffer - default-directory))))))) + (file-exists-p (expand-file-name + candidate (with-helm-current-buffer + default-directory))))))) (when (boundp 'completion-in-region-function) (defconst helm--old-completion-in-region-function 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 @@ -1021,14 +1021,14 @@ Note: This mode is incompatible with Emacs23." helm-mode-handle-completion-in-region) (setq completion-in-region-function #'helm--completion-in-region)) (message helm-completion-mode-start-message)) - (setq completing-read-function (and (fboundp 'completing-read-default) - 'completing-read-default) - read-file-name-function (and (fboundp 'read-file-name-default) - 'read-file-name-default)) - (when (and (boundp 'completion-in-region-function) - (boundp 'helm--old-completion-in-region-function)) - (setq completion-in-region-function helm--old-completion-in-region-function)) - (message helm-completion-mode-quit-message))) + (setq completing-read-function (and (fboundp 'completing-read-default) + 'completing-read-default) + read-file-name-function (and (fboundp 'read-file-name-default) + 'read-file-name-default)) + (when (and (boundp 'completion-in-region-function) + (boundp 'helm--old-completion-in-region-function)) + (setq completion-in-region-function helm--old-completion-in-region-function)) + (message helm-completion-mode-quit-message))) (provide 'helm-mode) diff --git a/helm-net.el b/helm-net.el index 5ff69d0e..052bbc24 100644 --- a/helm-net.el +++ b/helm-net.el @@ -209,9 +209,9 @@ Return an alist with elements like (data . number_results)." (with-temp-buffer (call-process "curl" nil t nil request) (funcall fetch)) - (with-current-buffer - (url-retrieve-synchronously request) - (funcall fetch))))) + (with-current-buffer + (url-retrieve-synchronously request) + (funcall fetch))))) (defun helm-google-suggest-set-candidates (&optional request-prefix) "Set candidates with result and number of google results found." @@ -234,7 +234,7 @@ Return an alist with elements like (data . number_results)." helm-ggs-max-length-num-flag) (- helm-ggs-max-length-num-flag (length fnumresult)) - 0) + 0) ;; Add now the spaces before fnumresult. for align-fnumresult = (concat (make-string nspaces ? ) fnumresult) @@ -247,12 +247,12 @@ Return an alist with elements like (data . number_results)." (if (cl-loop for (_disp . dat) in suggestions 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 - (append - suggestions - (list (cons (concat "Search for " "'" helm-input "'" " on Google") - helm-input)))))) + ;; if there is no suggestion exactly matching the input then + ;; prepend a Search on Google item to the list + (append + suggestions + (list (cons (concat "Search for " "'" helm-input "'" " on Google") + helm-input)))))) (defun helm-ggs-set-number-result (num) (if num @@ -267,7 +267,7 @@ Return an alist with elements like (data . number_results)." finally return (replace-regexp-in-string "^," "" (mapconcat 'identity (reverse C) "")))) - "?")) + "?")) (defun helm-google-suggest-action (candidate) "Default action to jump to a google suggested candidate." @@ -349,9 +349,9 @@ Return an alist with elements like (data . number_results)." (with-temp-buffer (call-process "curl" nil t nil request) (helm-wikipedia--parse-buffer)) - (with-current-buffer - (url-retrieve-synchronously request) - (helm-wikipedia--parse-buffer))))) + (with-current-buffer + (url-retrieve-synchronously request) + (helm-wikipedia--parse-buffer))))) (defun helm-wikipedia--parse-buffer () (goto-char (point-min)) @@ -387,14 +387,14 @@ Return an alist with elements like (data . number_results)." t))) (if (not result) (message "Error when getting summary.") - (with-current-buffer buf - (erase-buffer) - (setq cursor-type nil) - (insert result) - (fill-region (point-min) (point-max)) - (goto-char (point-min))) - (display-buffer buf) - (message mess))))) + (with-current-buffer buf + (erase-buffer) + (setq cursor-type nil) + (insert result) + (fill-region (point-min) (point-max)) + (goto-char (point-min))) + (display-buffer buf) + (message mess))))) (defun helm-wikipedia-fetch-summary (input) @@ -403,9 +403,9 @@ Return an alist with elements like (data . number_results)." (with-temp-buffer (call-process "curl" nil t nil request) (helm-wikipedia--parse-summary)) - (with-current-buffer - (url-retrieve-synchronously request) - (helm-wikipedia--parse-summary))))) + (with-current-buffer + (url-retrieve-synchronously request) + (helm-wikipedia--parse-summary))))) (defun helm-wikipedia--parse-summary () @@ -421,24 +421,24 @@ Return an alist with elements like (data . number_results)." (if (string-match "<span class=\"redirectText\"><a href=[^>]+>\\([^<]+\\)" result) (cons 'redirect (match-string 1 result)) - ;; find the beginning of the summary text in the result - - ;; check if there is a table before the summary and skip that - (when (or (string-match "</table>\\(\n<div.*?</div>\\)?\n<p>" result) - ;; otherwise just find the first paragraph - (string-match "<p>" result)) - ;; remove cruft and do a simple formatting - (replace-regexp-in-string - "Cite error: .*" "" - (replace-regexp-in-string - " " "" + ;; find the beginning of the summary text in the result + + ;; check if there is a table before the summary and skip that + (when (or (string-match "</table>\\(\n<div.*?</div>\\)?\n<p>" result) + ;; otherwise just find the first paragraph + (string-match "<p>" result)) + ;; remove cruft and do a simple formatting (replace-regexp-in-string - "\\[[^\]]+\\]" "" + "Cite error: .*" "" (replace-regexp-in-string - "<[^>]*>" "" + " " "" (replace-regexp-in-string - "</p>\n<p>" "\n\n" - (substring result (match-end 0))))))))))))) + "\\[[^\]]+\\]" "" + (replace-regexp-in-string + "<[^>]*>" "" + (replace-regexp-in-string + "</p>\n<p>" "\n\n" + (substring result (match-end 0))))))))))))) (defvar helm-source-wikipedia-suggest @@ -507,17 +507,17 @@ 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")))) + (error "No usable browser found")))) (defun helm-browse-url (url &rest args) "Default command to browse URL." (if browse-url-browser-function (browse-url url args) - (helm-browse-url-default-browser url args))) + (helm-browse-url-default-browser url args))) ;;; Surfraw @@ -556,18 +556,18 @@ Return an alist with elements like (data . number_results)." ;; "sr duckduckgo -p foo" is broken, workaround. (format helm-surfraw-duckduckgo-url (url-hexify-string pattern)) - (with-temp-buffer - (apply 'call-process "surfraw" nil t nil - (append (list engine-nodesc "-p") (split-string pattern))) - (replace-regexp-in-string - "\n" "" (buffer-string))))) + (with-temp-buffer + (apply 'call-process "surfraw" nil t nil + (append (list engine-nodesc "-p") (split-string pattern))) + (replace-regexp-in-string + "\n" "" (buffer-string))))) (browse-url-browser-function (or helm-surfraw-default-browser-function browse-url-browser-function))) (if (string= engine-nodesc "W") (helm-browse-url helm-home-url) - (helm-browse-url url) - (setq helm-surfraw-engines-history - (cons engine (delete engine helm-surfraw-engines-history)))))) + (helm-browse-url url) + (setq helm-surfraw-engines-history + (cons engine (delete engine helm-surfraw-engines-history)))))) ;;;###autoload (defun helm-google-suggest () diff --git a/helm-plugin.el b/helm-plugin.el index 95888fca..df20830e 100644 --- a/helm-plugin.el +++ b/helm-plugin.el @@ -107,12 +107,12 @@ (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)) + source)) (add-to-list 'helm-compile-source-functions 'helm-compile-source--candidates-file) (defun helm-p-candidates-file-init () @@ -162,7 +162,7 @@ source '((candidates-in-buffer) (persistent-help . "Show this line"))) - source)) + source)) (add-to-list 'helm-compile-source-functions 'helm-compile-source--helm-headline) (defun helm-headline-init () @@ -190,8 +190,8 @@ (if (numberp subexp) (cons (match-string-no-properties subexp) (match-beginning subexp)) - (cons (buffer-substring (point-at-bol) (point-at-eol)) - (point-at-bol))))) + (cons (buffer-substring (point-at-bol) (point-at-eol)) + (point-at-bol))))) (arrange #'(lambda (headlines) (unless (null headlines) ; FIX headlines empty bug! @@ -220,8 +220,8 @@ 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))))))) + (cl-loop while (re-search-forward regexp nil t) + collect (funcall matched))))))) (defun helm-headline-make-candidate-buffer (regexp subexp) (with-current-buffer (helm-candidate-buffer 'local) diff --git a/helm-regexp.el b/helm-regexp.el index 1b8e1dbf..22687daa 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) @@ -163,7 +163,7 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b." (if helm-moccur-always-search-in-current (cons helm-current-buffer (remove helm-current-buffer helm-multi-occur-buffer-list)) - helm-multi-occur-buffer-list)) + helm-multi-occur-buffer-list)) (helm-init-candidates-in-buffer 'global (cl-loop for buf in helm-multi-occur-buffer-list @@ -196,7 +196,7 @@ arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame." (lineno (string-to-number (nth 1 split))) (split-pat (if helm-occur-match-plugin-mode (helm-mp-split-pattern helm-pattern) - (list helm-pattern)))) + (list helm-pattern)))) (cl-case method (buffer (switch-to-buffer buf)) (buffer-other-window (switch-to-buffer-other-window buf)) @@ -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 @@ -270,8 +270,8 @@ Same as `helm-moccur-goto-line' but go in new frame." (remove (assoc 'no-matchplugin helm-source-moccur) helm-source-moccur) helm-source-occur helm-source-moccur) - (helm-attrset 'no-matchplugin nil helm-source-moccur) - (setq helm-source-occur helm-source-moccur))) + (helm-attrset 'no-matchplugin nil helm-source-moccur) + (setq helm-source-occur helm-source-moccur))) (defvar helm-source-moccur `((name . "Moccur") @@ -332,15 +332,15 @@ It is used with type attribute 'line'." (if (string-match "^ *\\([0-9]+\\):\\(.*\\)$" candidate) (list (string-to-number (match-string 1 candidate)) (match-string 2 candidate)) - (error "Line number not found"))) + (error "Line number not found"))) ;;; Type attributes ;; ;; (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 @@ -412,7 +412,7 @@ the center of window, otherwise at the top of window.") (interactive) (let ((input (if isearch-regexp isearch-string - (regexp-quote isearch-string)))) + (regexp-quote isearch-string)))) (isearch-exit) (setq helm-multi-occur-buffer-list (list (buffer-name (current-buffer)))) (helm-occur-init-source) @@ -438,7 +438,7 @@ or during the buffer selection." (if (or current-prefix-arg helm-current-prefix-arg) (not helm-moccur-always-search-in-current) - helm-moccur-always-search-in-current))) + helm-moccur-always-search-in-current))) (helm-multi-occur-1 buffers))) ;;;###autoload @@ -454,7 +454,7 @@ The prefix arg can be set before calling helm-moccur-always-search-in-current (input (if isearch-regexp isearch-string - (regexp-quote isearch-string)))) + (regexp-quote isearch-string)))) (isearch-exit) (setq buf-list (helm-comp-read "Buffers: " (helm-buffer-list) @@ -464,7 +464,7 @@ The prefix arg can be set before calling (if (or current-prefix-arg helm-current-prefix-arg) (not helm-moccur-always-search-in-current) - helm-moccur-always-search-in-current)) + helm-moccur-always-search-in-current)) (helm-multi-occur-1 buf-list input))) diff --git a/helm-ring.el b/helm-ring.el index 22d0f084..ec8f89f6 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 @@ -112,24 +112,24 @@ replace with STR as yanked string." (setq kill-ring (delete str kill-ring)) (if (not (eq (helm-attr 'last-command helm-source-kill-ring) 'yank)) (run-with-timer 0.01 nil `(lambda () (insert-for-yank ,str))) - ;; from `yank-pop' - (let ((inhibit-read-only t) - (before (< (point) (mark t)))) - (if before - (funcall (or yank-undo-function 'delete-region) (point) (mark t)) - (funcall (or yank-undo-function 'delete-region) (mark t) (point))) - (setq yank-undo-function nil) - (set-marker (mark-marker) (point) helm-current-buffer) - (run-with-timer 0.01 nil `(lambda () (insert-for-yank ,str))) - ;; Set the window start back where it was in the yank command, - ;; if possible. - (set-window-start (selected-window) yank-window-start t) - (when before - ;; This is like exchange-point-and-mark, but doesn't activate the mark. - ;; It is cleaner to avoid activation, even though the command - ;; loop would deactivate the mark because we inserted text. - (goto-char (prog1 (mark t) - (set-marker (mark-marker) (point) helm-current-buffer)))))) + ;; from `yank-pop' + (let ((inhibit-read-only t) + (before (< (point) (mark t)))) + (if before + (funcall (or yank-undo-function 'delete-region) (point) (mark t)) + (funcall (or yank-undo-function 'delete-region) (mark t) (point))) + (setq yank-undo-function nil) + (set-marker (mark-marker) (point) helm-current-buffer) + (run-with-timer 0.01 nil `(lambda () (insert-for-yank ,str))) + ;; Set the window start back where it was in the yank command, + ;; if possible. + (set-window-start (selected-window) yank-window-start t) + (when before + ;; This is like exchange-point-and-mark, but doesn't activate the mark. + ;; It is cleaner to avoid activation, even though the command + ;; loop would deactivate the mark because we inserted text. + (goto-char (prog1 (mark t) + (set-marker (mark-marker) (point) helm-current-buffer)))))) (kill-new str))) @@ -193,8 +193,8 @@ replace with STR as yanked string." (let (line) (if (string= "" line) (setq line "<EMPTY LINE>") - (setq line (car (split-string (thing-at-point 'line) - "[\n\r]")))) + (setq line (car (split-string (thing-at-point 'line) + "[\n\r]")))) (format "%7d:%s: %s" (line-number-at-pos) (marker-buffer marker) line)))) @@ -227,62 +227,62 @@ replace with STR as yanked string." 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)) + ((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 (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!")) + (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))))) diff --git a/helm-semantic.el b/helm-semantic.el index 9eeae673..cda23cc3 100644 --- a/helm-semantic.el +++ b/helm-semantic.el @@ -58,7 +58,7 @@ (if (and class (not type-p)) (format "%s%sClass(%s) " spaces (if (< depth 2) "" "├►") class) - spaces) + spaces) ;; Save the tag for later (propertize (semantic-format-tag-summarize tag nil t) 'semantic-tag tag) @@ -132,7 +132,7 @@ Fill in the symbol at point by default." (interactive) (let* ((source (if (semantic-active-p) 'helm-source-semantic - 'helm-source-imenu)) + 'helm-source-imenu)) (imenu-p (eq source 'helm-source-imenu)) (str (thing-at-point 'symbol)) (imenu-auto-rescan imenu-p) diff --git a/helm-sys.el b/helm-sys.el index 17ab3930..d9eef5c2 100644 --- a/helm-sys.el +++ b/helm-sys.el @@ -131,7 +131,7 @@ Show actions only on line starting by a PID." (defun helm-top-set-mode-line (str) (if (string-match "Sort:\\[\\(.*\\)\\] " helm-top-mode-line) (setq helm-top-mode-line (replace-match str nil nil helm-top-mode-line 1)) - (setq helm-top-mode-line (concat (format "Sort:[%s] " str) helm-top-mode-line)))) + (setq helm-top-mode-line (concat (format "Sort:[%s] " str) helm-top-mode-line)))) (defun helm-top-sort-transformer (candidates source) (helm-top-transformer @@ -141,9 +141,9 @@ Show actions only on line starting by a PID." else collect c into header-cands finally return (append (if (cdr header-cands) (butlast header-cands) - header-cands) + header-cands) (sort pid-cands helm-top-sort-fn))) - candidates) + candidates) source)) (defun helm-top-sort-by-com (s1 s2) diff --git a/helm-tags.el b/helm-tags.el index 2b2d21aa..62aa31e5 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 @@ -95,7 +95,7 @@ one match." (if (string-match "\\.el\\.gz$" helm-buffer-file-name) (format "ctags -e -u -f- --language-force=lisp --fields=n =(zcat %s) " helm-buffer-file-name) - (format "ctags -e -u -f- --fields=n %s " helm-buffer-file-name)) + (format "ctags -e -u -f- --fields=n %s " helm-buffer-file-name)) nil (current-buffer)) (goto-char (point-min)) (forward-line 2) @@ -244,7 +244,7 @@ If no entry in cache, create one." ;; and not the filename. (if helm-etags-match-part-only (cadr (helm-etags-split-line candidate)) - candidate))) + candidate))) (mode-line . helm-etags-mode-line-string) (keymap . ,helm-etags-map) (action . (("Go to tag" . (lambda (c) @@ -278,11 +278,11 @@ If no entry in cache, create one." (elm (cadr split))) (if (null fname) (error "file %s not found" fname) - (ring-insert find-tag-marker-ring (point-marker)) - (funcall switcher fname) - (goto-char (point-min)) - (search-forward elm nil t) - (goto-char (match-beginning 0))))) + (ring-insert find-tag-marker-ring (point-marker)) + (funcall switcher fname) + (goto-char (point-min)) + (search-forward elm nil t) + (goto-char (match-beginning 0))))) (defun helm-etags-mtime (file) "Last modification time of etags tag FILE." @@ -314,19 +314,19 @@ This function aggregates three sources of tag files: (str (thing-at-point 'symbol))) (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)) - (mapc (lambda (f) - (when (or (equal arg '(4)) - (and helm-etags-mtime-alist - (helm-etags-file-modified-p f))) - (remhash f helm-etags-cache))) - tag-files) - (helm :sources 'helm-source-etags-select - :keymap helm-etags-map - :default (list (concat "\\_<" str "\\_>") str) - :buffer "*helm etags*")))) + (cl-loop for k being the hash-keys of 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 + (helm-etags-file-modified-p f))) + (remhash f helm-etags-cache))) + tag-files) + (helm :sources 'helm-source-etags-select + :keymap helm-etags-map + :default (list (concat "\\_<" str "\\_>") str) + :buffer "*helm etags*")))) (provide 'helm-tags) diff --git a/helm-utils.el b/helm-utils.el index 0aa68ecf..8b4b06d0 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) @@ -127,7 +127,7 @@ buffer as BUFFER." (with-current-buffer (or buffer (current-buffer)) (if (listp buffer-undo-list) (length buffer-undo-list) - (buffer-modified-tick))))) + (buffer-modified-tick))))) ;; Functions not available in versions < emacs-24. ;; Allow using helm-async.el in Emacs-23 among other things. @@ -140,10 +140,10 @@ If FILE1 or FILE2 does not exist, the return value is unspecified." (find-file-name-handler file2 'file-equal-p)))) (if handler (funcall handler 'file-equal-p file1 file2) - (let (f1-attr f2-attr) - (and (setq f1-attr (file-attributes (file-truename file1))) - (setq f2-attr (file-attributes (file-truename file2))) - (equal f1-attr f2-attr)))))) + (let (f1-attr f2-attr) + (and (setq f1-attr (file-attributes (file-truename file1))) + (setq f2-attr (file-attributes (file-truename file2))) + (equal f1-attr f2-attr)))))) ;; This is the original loop version, more readable, not the one of 24.1+. (defun file-in-directory-p (file dir) @@ -154,16 +154,16 @@ Return nil if DIR is not an existing directory." (find-file-name-handler dir 'file-in-directory-p)))) (if handler (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))))))) + (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))))))) ;; CUA workaround @@ -173,7 +173,7 @@ Return nil if DIR is not an existing directory." (defadvice copy-region-as-kill (around helm-avoid-cua activate) (if cua-mode (ignore-errors ad-do-it) - ad-do-it)) + ad-do-it)) ;;; Utils functions @@ -327,12 +327,12 @@ even is \" -b\" is specified." (helm-attrset 'no-matchplugin nil source) (string-match (match-string 1 helm-pattern) (helm-basename candidate))) - ;; Disable no-matchplugin by side effect. - (helm-aif (assq 'no-matchplugin source) - (setq source (delete it source))) - (string-match - (replace-regexp-in-string " -b\\'" "" helm-pattern) - candidate)))) + ;; Disable no-matchplugin by side effect. + (helm-aif (assq 'no-matchplugin source) + (setq source (delete it source))) + (string-match + (replace-regexp-in-string " -b\\'" "" helm-pattern) + candidate)))) (defun helm-skip-entries (seq regexp-list) "Remove entries which matches one of REGEXP-LIST from SEQ." @@ -356,13 +356,13 @@ even is \" -b\" is specified." "Get string of STR-OR-SYM." (if (stringp str-or-sym) str-or-sym - (symbol-name str-or-sym))) + (symbol-name str-or-sym))) (defun helm-symbolify (str-or-sym) "Get symbol of STR-OR-SYM." (if (symbolp str-or-sym) str-or-sym - (intern str-or-sym))) + (intern str-or-sym))) (defun helm-describe-function (func) "FUNC is symbol or string." @@ -414,7 +414,7 @@ from its directory." (regexp-quote (if helm-ff-transformer-show-only-basename (helm-basename f) f))) - (helm-find-files-1 f))) + (helm-find-files-1 f))) (let* ((sel (helm-get-selection)) (grep-line (and (stringp sel) (helm-grep-split-line sel)))) @@ -436,7 +436,7 @@ from its directory." (expand-file-name (car grep-line))) ((and ffap-url-regexp (string-match ffap-url-regexp sel)) sel) (t default-directory))) - default-directory)))) + default-directory)))) ;; Same as `vc-directory-exclusion-list'. (defvar helm-walk-ignore-directories @@ -464,7 +464,7 @@ instead of `helm-walk-ignore-directories'." (member (helm-basename dir) (if (listp skip-subdirs) skip-subdirs - 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 @@ -478,11 +478,11 @@ instead of `helm-walk-ignore-directories'." (if match (and (if (functionp match) (funcall match f) - (and (stringp match) - (string-match - match (file-name-nondirectory 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))) @@ -522,7 +522,7 @@ If specified, also remove filename extension EXT." (string= (file-name-extension fname t) ext)) (not (file-directory-p fname))) (file-name-sans-extension (file-name-nondirectory fname)) - (file-name-nondirectory (directory-file-name fname))))) + (file-name-nondirectory (directory-file-name fname))))) (defun helm-basedir (fname) "Return the base directory of filename." @@ -554,7 +554,7 @@ KBSIZE if a floating point number, default value is 1024.0." 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)))))) + (format "%.1f%s" (cdr result) (car result)))))) (cl-defun helm-file-attributes (file &key type links uid gid access-time modif-time @@ -594,22 +594,22 @@ you have in `file-attributes'." (cond ((stringp type) "symlink") ; fname (type "directory") ; t (t "file")) ; nil - type) + type) :links links :uid uid :gid gid :access-time (if string (format-time-string "%Y-%m-%d %R" access-time) - access-time) + access-time) :modif-time (if string (format-time-string "%Y-%m-%d %R" modif-time) - modif-time) + modif-time) :status (if string (format-time-string "%Y-%m-%d %R" status) - status) + status) :size size :mode mode :gid-change gid-change @@ -636,8 +636,8 @@ you have in `file-attributes'." (cl-getf all :gid) " " (if human-size (helm-file-human-size (cl-getf all :size)) - (int-to-string (cl-getf all :size))) " " - (cl-getf all :modif-time))) + (int-to-string (cl-getf all :size))) " " + (cl-getf all :modif-time))) (human-size (helm-file-human-size (cl-getf all :size))) (mode-type (cl-getf modes :mode-type)) (mode-owner (cl-getf modes :user)) @@ -661,14 +661,14 @@ If STRING is non--nil return instead a space separated string." finally return (if string (mapconcat 'identity (list type user group other) " ") - (list :mode-type type :user user :group group :other other)))) + (list :mode-type type :user user :group group :other other)))) (defun helm-current-directory () "Return current-directory name at point. Useful in dired buffers when there is inserted subdirs." (if (eq major-mode 'dired-mode) (dired-current-directory) - default-directory)) + default-directory)) (defmacro with-helm-display-marked-candidates (buffer-or-name candidates &rest body) (declare (indent 0) (debug t)) @@ -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 @@ -700,7 +700,7 @@ Useful in dired buffers when there is inserted subdirs." (args (list start end buf))) (if (not helm-match-line-overlay) (setq helm-match-line-overlay (apply 'make-overlay args)) - (apply 'move-overlay helm-match-line-overlay args)) + (apply 'move-overlay helm-match-line-overlay args)) (overlay-put helm-match-line-overlay 'face (or face 'helm-selection-line)) (recenter) @@ -740,22 +740,22 @@ Useful in dired buffers when there is inserted subdirs." (let (process-connection-type) (if (eq system-type 'windows-nt) (helm-w32-shell-execute-open-file file) - (start-process "helm-open-file-with-default-tool" - nil - (cond ((eq system-type 'gnu/linux) - "xdg-open") - ((or (eq system-type 'darwin) ;; Mac OS X - (eq system-type 'macos)) ;; Mac OS 9 - "open")) - file)))) + (start-process "helm-open-file-with-default-tool" + nil + (cond ((eq system-type 'gnu/linux) + "xdg-open") + ((or (eq system-type 'darwin) ;; Mac OS X + (eq system-type 'macos)) ;; Mac OS 9 + "open")) + file)))) (defun helm-open-dired (file) "Opens a dired buffer in FILE's directory. If FILE is a directory, open this directory." (if (file-directory-p file) (dired file) - (dired (file-name-directory file)) - (dired-goto-file file))) + (dired (file-name-directory file)) + (dired-goto-file file))) (defun helm-action-line-goto (lineno-and-content) (apply #'helm-goto-file-line @@ -764,7 +764,7 @@ directory, open this directory." (if (and (helm-attr-defined 'target-file) (not helm-in-persistent-action)) 'find-file-other-window - 'find-file))))) + 'find-file))))) (cl-defun helm-action-file-line-goto (file-line-content) (apply #'helm-goto-file-line @@ -772,7 +772,7 @@ directory, open this directory." ;; Case: filtered-candidate-transformer is skipped (cdr (helm-filtered-candidate-transformer-file-line-1 file-line-content)) - file-line-content))) + file-line-content))) (defun helm-require-or-error (feature function) (or (require feature nil t) @@ -805,7 +805,7 @@ directory, open this directory." (when file (funcall find-file-function file)) (if (helm-attr-defined 'adjust) (helm-goto-line-with-adjustment lineno content) - (helm-goto-line lineno)) + (helm-goto-line lineno)) (unless (helm-attr-defined 'recenter) (set-window-start (get-buffer-window helm-current-buffer) (point))) (helm-aif (helm-attr 'after-jump-hook) @@ -821,7 +821,7 @@ directory, open this directory." (set-buffer buf) (find-alternate-file (concat "/" helm-su-or-sudo "::" (expand-file-name candidate)))) - (find-file (concat "/" helm-su-or-sudo "::" (expand-file-name candidate)))))) + (find-file (concat "/" helm-su-or-sudo "::" (expand-file-name candidate)))))) (defun helm-find-many-files (_ignore) (mapc 'find-file (helm-marked-candidates))) diff --git a/helm-w3m.el b/helm-w3m.el index eb7d1234..4e9ccddb 100644 --- a/helm-w3m.el +++ b/helm-w3m.el @@ -73,7 +73,7 @@ (persistent-action . (lambda (candidate) (if current-prefix-arg (helm-w3m-browse-bookmark candidate t) - (helm-w3m-browse-bookmark candidate nil t)))) + (helm-w3m-browse-bookmark candidate nil t)))) (persistent-help . "Open URL with emacs-w3m in new tab / \ C-u \\[helm-execute-persistent-action]: Open URL with Firefox")) "Needs w3m and emacs-w3m. diff --git a/helm-yaoddmuse.el b/helm-yaoddmuse.el index 70ec183d..c94b6cd3 100644 --- a/helm-yaoddmuse.el +++ b/helm-yaoddmuse.el @@ -38,8 +38,8 @@ (setq helm-yaoddmuse-ew-cache (gethash "EmacsWiki" yaoddmuse-pages-hash))) helm-yaoddmuse-ew-cache) - (yaoddmuse-update-pagename t) - (gethash "EmacsWiki" yaoddmuse-pages-hash))) + (yaoddmuse-update-pagename t) + (gethash "EmacsWiki" yaoddmuse-pages-hash))) (defvar helm-source-yaoddmuse-emacswiki-edit-or-view '((name . "Yaoddmuse Edit or View (EmacsWiki)") @@ -71,7 +71,7 @@ (helm-yaoddmuse-cache-pages t) (setq helm-yaoddmuse-ew-cache (gethash "EmacsWiki" yaoddmuse-pages-hash))) - (yaoddmuse-update-pagename)))))) + (yaoddmuse-update-pagename)))))) (action-transformer helm-yaoddmuse-action-transformer)) "Needs yaoddmuse.el. @@ -107,7 +107,7 @@ http://www.emacswiki.org/emacs/download/yaoddmuse.el") (append actions '(("Install Elisp" . (lambda (elm) (install-elisp-from-emacswiki elm))))) - actions)) + actions)) ;;;###autoload (defun helm-yaoddmuse-cache-pages (&optional load) @@ -61,7 +61,7 @@ After DELAY seconds the FUNS list is reinitialised. See `helm-define-multi-key'." (declare (indent 2)) (setq docstring (if docstring (concat docstring "\n\n") - "This is a helmish multi-key command.")) + "This is a helmish multi-key command.")) `(defalias (quote ,name) (helm-make-multi-command ,funs ,delay) ,docstring)) (defun helm-make-multi-command (functions &optional delay) @@ -335,14 +335,14 @@ 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 '(cygwin windows-nt ms-dos darwin)) t - helm-case-fold-search) + helm-case-fold-search) "Local setting of `helm-case-fold-search' for reading filenames. See `helm-case-fold-search' for more info." @@ -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) @@ -794,8 +794,8 @@ If `helm-last-log-file' is nil, switch to `helm-debug-buffer' ." (interactive) (if helm-last-log-file (view-file helm-last-log-file) - (switch-to-buffer helm-debug-buffer) - (view-mode 1) (visual-line-mode 1))) + (switch-to-buffer helm-debug-buffer) + (view-mode 1) (visual-line-mode 1))) (defun helm-print-error-messages () "Print error messages in `helm-issued-errors'." @@ -842,7 +842,7 @@ THEN-FORM and ELSE-FORMS are then excuted just like in `if'." Otherwise make a list with one element." (if (and (listp obj) (not (functionp obj))) obj - (list obj))) + (list obj))) (defun helm-this-command () "Return the actual command in action. @@ -866,7 +866,7 @@ not `exit-minibuffer' or unwanted functions." "Return `helm-action-buffer' if shown otherwise `helm-buffer'." (if (helm-action-window) helm-action-buffer - helm-buffer)) + helm-buffer)) (defun helm-window () "Window of `helm-buffer'." @@ -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))))) @@ -941,7 +941,7 @@ not `exit-minibuffer' or unwanted functions." `(progn (if helm-alive-p (progn ,@body) - (error "Running helm command outside of context")))) + (error "Running helm command outside of context")))) (cl-defun helm-attr (attribute-name &optional (src (helm-get-current-source)) compute) @@ -1028,7 +1028,7 @@ without modifying source code." (helm-attrset 'action (if index (helm-append-at-nth actions new-action index) - (append actions new-action)) + (append actions new-action)) source))) (defun helm-delete-action-from-source (action-or-name source) @@ -1038,7 +1038,7 @@ associated to name." (let* ((actions (helm-attr 'action source)) (del-action (if (symbolp action-or-name) (rassoc action-or-name actions) - (assoc action-or-name actions)))) + (assoc action-or-name actions)))) (helm-attrset 'action (delete del-action actions) source))) (cl-defun helm-add-action-to-source-if (name fn source predicate @@ -1078,9 +1078,9 @@ only when predicate helm-ff-candidates-lisp-p return non--nil: (setq action-transformers (list action-transformers))) (if test-only ; debug (delq nil (append (list transformer) action-transformers)) - (helm-attrset 'action-transformer - (delq nil (append (list transformer) action-transformers)) - source)))) + (helm-attrset 'action-transformer + (delq nil (append (list transformer) action-transformers)) + source)))) (defun helm-set-source-filter (sources) "Set the value of `helm-source-filter' to SOURCES and update. @@ -1142,18 +1142,18 @@ 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) @@ -1167,7 +1167,7 @@ with its properties." (with-current-buffer buffer (let* ((disp-fn (if (eq force-display-part 'withprop) 'buffer-substring - 'buffer-substring-no-properties)) + 'buffer-substring-no-properties)) (selection (or (and (not force-display-part) (get-text-property (overlay-start @@ -1269,8 +1269,8 @@ SHORT-DOC is displayed beside attribute name. LONG-DOC is displayed below attribute name and short documentation." (if long-doc (setq short-doc (concat "(" short-doc ")")) - (setq long-doc short-doc - short-doc "")) + (setq long-doc short-doc + short-doc "")) (add-to-list 'helm-attributes attribute t) (put attribute 'helm-attrdoc (concat "- " (symbol-name attribute) @@ -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))) @@ -1371,30 +1371,30 @@ in the source where point is." (if (or (helm-empty-buffer-p) (helm-empty-source-p)) 0 - (save-excursion - (if in-current-source - (goto-char (helm-get-previous-header-pos)) - (goto-char (point-min))) - (forward-line 1) - (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)) - (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))))))) + (save-excursion + (if in-current-source + (goto-char (helm-get-previous-header-pos)) + (goto-char (point-min))) + (forward-line 1) + (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)) + (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))))))) (defmacro with-helm-quittable (&rest body) "If an error occur in execution of BODY, quit helm safely." @@ -1443,15 +1443,15 @@ candidate-transformer: This is used in transformers to modify candidates list." (if (functionp funcs) (apply 'helm-funcall-with-source source funcs args) - (apply 'helm-funcall-with-source source - (lambda (&rest oargs) (helm-compose oargs funcs)) - args))) + (apply 'helm-funcall-with-source source + (lambda (&rest oargs) (helm-compose oargs funcs)) + args))) ;; 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. @@ -1559,24 +1559,24 @@ to 10 as session local variable." (if (helm-alive-p) ;; A helm session is normally running. (error "Error: Trying to run helm within a running helm session") - ;; A helm session is already running and user jump somewhere else - ;; without desactivating it: weird. - (with-helm-buffer - (prog1 - (message "Aborting an helm session running in background") - ;; helm-alive-p will be reset in unwind-protect forms. - (helm-keyboard-quit)))) - (if (keywordp (car plist)) - ;; Recursion: [1] Call `helm' on itself with plist args converted - ;; to simple args will end up to [2] and call `helm-internal' with - ;; simple args. - ;; (`helm-let-internal' is not exited until recursion finish) - (helm-let-internal - (helm-parse-keys plist) - (lambda () ; [1] - (apply fn (mapcar #'(lambda (key) (plist-get plist key)) - helm-argument-keys)))) - (apply fn plist))))) ; [2] + ;; A helm session is already running and user jump somewhere else + ;; without desactivating it: weird. + (with-helm-buffer + (prog1 + (message "Aborting an helm session running in background") + ;; helm-alive-p will be reset in unwind-protect forms. + (helm-keyboard-quit)))) + (if (keywordp (car plist)) + ;; Recursion: [1] Call `helm' on itself with plist args converted + ;; to simple args will end up to [2] and call `helm-internal' with + ;; simple args. + ;; (`helm-let-internal' is not exited until recursion finish) + (helm-let-internal + (helm-parse-keys plist) + (lambda () ; [1] + (apply fn (mapcar #'(lambda (key) (plist-get plist key)) + helm-argument-keys)))) + (apply fn plist))))) ; [2] (defun helm-alive-p () "Check if `helm' is alive. @@ -1604,23 +1604,23 @@ in source." for symname = (substring (symbol-name key) 1) for sym = (intern (if (string-match "^helm-" symname) symname - (concat "helm-" 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'." ;; Activate the advice for `tramp-read-passwd'. (if (fboundp 'advice-add) (advice-add 'tramp-read-passwd :around #'helm--advice-tramp-read-passwd) - (ad-activate 'tramp-read-passwd)) + (ad-activate 'tramp-read-passwd)) (catch 'exit ; `exit-minibuffer' use this tag on exit. (helm-log (concat "[Start session] " (make-string 41 ?+))) (helm-log-eval any-prompt any-preselect @@ -1640,39 +1640,39 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'." (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) - (ad-deactivate 'tramp-read-passwd)) + (ad-deactivate 'tramp-read-passwd)) (helm-log-eval (setq helm-alive-p nil)) (setq overriding-terminal-local-map old-overriding-local-map) (setq helm-alive-p nil) @@ -1695,8 +1695,8 @@ Called from lisp, you can specify a buffer-name as a string with ARG." (if arg (if (and (stringp arg) (bufferp (get-buffer arg))) (setq any-buffer arg) - (setq any-buffer (helm-resume-select-buffer))) - (setq any-buffer helm-last-buffer)) + (setq any-buffer (helm-resume-select-buffer))) + (setq any-buffer helm-last-buffer)) (cl-assert any-buffer nil "helm-resume: No helm buffers found to resume") ;; Reset `cursor-type' to nil as it have been set to t @@ -1726,7 +1726,7 @@ Called from lisp, you can specify a buffer-name as a string with ARG." (interactive "p") (if (and helm-alive-p (> (length helm-buffers) arg)) (helm-run-after-quit `(lambda () (helm-resume (nth ,arg helm-buffers)))) - (message "No previous helm sessions to resume yet!"))) + (message "No previous helm sessions to resume yet!"))) ;;;###autoload (defun helm-resume-list-buffers-after-quit () @@ -1734,7 +1734,7 @@ Called from lisp, you can specify a buffer-name as a string with ARG." (interactive) (if (and helm-alive-p (> (length helm-buffers) 0)) (helm-run-after-quit #'(lambda () (helm-resume t))) - (message "No previous helm sessions to resume yet!"))) + (message "No previous helm sessions to resume yet!"))) (defun helm-resume-p (any-resume) "Whether current helm session is resumed or not." @@ -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) @@ -1829,7 +1829,7 @@ window or frame configuration is saved/restored according to values of ;; e.g M-: + helm-minibuffer-history. (let ((frame (if (minibufferp helm-current-buffer) (selected-frame) - (last-nonminibuffer-frame)))) + (last-nonminibuffer-frame)))) (select-frame-set-input-focus frame)))))) (defun helm-split-window-default-fn (window) @@ -1843,24 +1843,24 @@ window or frame configuration is saved/restored according to values of (split-window (selected-window) nil (if (eq helm-split-window-default-side 'other) 'below helm-split-window-default-side)) - ;; If more than one window reuse one of them. - (cl-case helm-split-window-default-side - (left (or (helm-window-in-direction 'left) - (helm-window-in-direction 'above) - (selected-window))) - (above (or (helm-window-in-direction 'above) - (helm-window-in-direction 'left) - (selected-window))) - (right (or (helm-window-in-direction 'right) - (helm-window-in-direction 'below) - (selected-window))) - (below (or (helm-window-in-direction 'below) - (helm-window-in-direction 'right) - (selected-window))) - (same (selected-window)) - (other (other-window-for-scrolling)) - (t (or (window-next-sibling) (selected-window))))) - (split-window-sensibly window)))) + ;; If more than one window reuse one of them. + (cl-case helm-split-window-default-side + (left (or (helm-window-in-direction 'left) + (helm-window-in-direction 'above) + (selected-window))) + (above (or (helm-window-in-direction 'above) + (helm-window-in-direction 'left) + (selected-window))) + (right (or (helm-window-in-direction 'right) + (helm-window-in-direction 'below) + (selected-window))) + (below (or (helm-window-in-direction 'below) + (helm-window-in-direction 'right) + (selected-window))) + (same (selected-window)) + (other (other-window-for-scrolling)) + (t (or (window-next-sibling) (selected-window))))) + (split-window-sensibly window)))) (defun helm-window-in-direction (direction) "Same as `window-in-direction' but check if window is dedicated." @@ -1884,7 +1884,7 @@ The function used to display `helm-buffer'." ((eq helm-split-window-default-side 'other) 'other) (helm--window-side-state) (t helm-split-window-default-side)) - helm-split-window-default-side))) + helm-split-window-default-side))) (prog1 (funcall (with-current-buffer buffer helm-display-function) buffer) (setq helm-onewindow-p (one-window-p t)) @@ -1908,12 +1908,12 @@ It uses `switch-to-buffer' or `pop-to-buffer' depending of value of (and (eq helm-split-window-default-side 'same) (one-window-p t))) (progn (delete-other-windows) (switch-to-buffer buffer)) - (when (and helm-always-two-windows - (not (eq helm-split-window-default-side 'same)) - (not (minibufferp helm-current-buffer)) - (not helm-split-window-in-side-p)) - (delete-other-windows)) - (pop-to-buffer buffer))) + (when (and helm-always-two-windows + (not (eq helm-split-window-default-side 'same)) + (not (minibufferp helm-current-buffer)) + (not helm-split-window-in-side-p)) + (delete-other-windows)) + (pop-to-buffer buffer))) ;;; Core: initialize @@ -1929,7 +1929,7 @@ For ANY-RESUME ANY-INPUT ANY-DEFAULT and ANY-SOURCES See `helm'." (helm-current-position 'save) (if (helm-resume-p any-resume) (helm-initialize-overlays (helm-buffer-get)) - (helm-initial-setup any-default)) + (helm-initial-setup any-default)) (setq helm-alive-p t) (unless (eq any-resume 'noresume) (helm-recent-push helm-buffer 'helm-buffers) @@ -1947,9 +1947,9 @@ For ANY-RESUME ANY-INPUT ANY-DEFAULT and ANY-SOURCES See `helm'." (move-overlay helm-selection-overlay (point-min) (point-min) (get-buffer buffer)) - (setq helm-selection-overlay - (make-overlay (point-min) (point-min) (get-buffer buffer))) - (overlay-put helm-selection-overlay 'face 'helm-selection))) + (setq helm-selection-overlay + (make-overlay (point-min) (point-min) (get-buffer buffer))) + (overlay-put helm-selection-overlay 'face 'helm-selection))) (defun helm-restore-position-on-quit () "Restore position in `helm-current-buffer' when quitting." @@ -1972,14 +1972,14 @@ It is intended to use this only in `helm-initial-setup'." ;; as `helm-current-buffer', this allow to use helm ;; from an already active minibuffer (M-: etc...) (window-buffer (active-minibuffer-window)) - ;; Fix Issue #456 - ;; Use this instead of `current-buffer' to ensure - ;; helm session started in helm-mode from a completing-read - ;; Use really the buffer where we started and not the one - ;; where the completing-read is wrapped. i.e - ;; (with-current-buffer SOME-OTHER-BUFFER (completing-read [...]) - (window-buffer (with-selected-window (minibuffer-window) - (minibuffer-selected-window))))) + ;; Fix Issue #456 + ;; Use this instead of `current-buffer' to ensure + ;; helm session started in helm-mode from a completing-read + ;; Use really the buffer where we started and not the one + ;; where the completing-read is wrapped. i.e + ;; (with-current-buffer SOME-OTHER-BUFFER (completing-read [...]) + (window-buffer (with-selected-window (minibuffer-window) + (minibuffer-selected-window))))) (defun helm-initial-setup (any-default) "Initialize helm settings and set up the helm buffer." @@ -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) @@ -2061,7 +2061,7 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'." ;; or contain non--candidate lines (e.g grep exit status) (helm-get-current-source)) (helm-mark-current-line t) - (helm-update any-preselect)) + (helm-update any-preselect)) (with-current-buffer (helm-buffer-get) (let* ((src (helm-get-current-source)) (src-keymap (assoc-default 'keymap src)) @@ -2073,7 +2073,7 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'." (source-delayed-p (or (assq 'delayed src) (assq 'delayed (if (symbolp first-src) (symbol-value first-src) - first-src))))) + first-src))))) ;; Startup with the first keymap found either in current source ;; or helm arg, otherwise use global value of `helm-map'. ;; This map will be used as a `minibuffer-local-map'. @@ -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 () @@ -2165,7 +2165,7 @@ This can be useful for e.g writing quietly a complex regexp." (setq helm-pattern "")) (message (if helm-suspend-update-flag "Helm update suspended!" - "Helm update reenabled!"))) + "Helm update reenabled!"))) (defadvice tramp-read-passwd (around disable-helm-update) ;; Suspend update when prompting for a tramp password. @@ -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 () @@ -2199,7 +2199,7 @@ If no map is found in current source do nothing (keep previous map)." ;; to not overhide other minor-mode-map's. (if (fboundp 'set-transient-map) (set-transient-map it) - (set-temporary-overlay-map it))))) + (set-temporary-overlay-map it))))) ;; Core: clean up @@ -2308,7 +2308,7 @@ Helm plug-ins are realized by this function." ;; It may return a process or a list of candidates. (if candidate-proc (helm-interpret-value candidate-proc source) - (helm-interpret-value candidate-fn source)) + (helm-interpret-value candidate-fn source)) (error (helm-log "Error: %S" err) nil)))) (when (and (processp candidates) (not candidate-proc)) (warn "Candidates function `%s' should be called in a `candidates-process' attribute" @@ -2390,7 +2390,7 @@ ARGS is (cand1 cand2 ...) or ((disp1 . real1) (disp2 . real2) ...) (if (listp it) (cl-loop for f in it do (setq ,candidate (funcall f ,candidate))) - (setq ,candidate (funcall it ,candidate))))) + (setq ,candidate (funcall it ,candidate))))) (defun helm--initialize-one-by-one-candidates (candidates source) "Process the CANDIDATES with the `filter-one-by-one' function in SOURCE. @@ -2410,7 +2410,7 @@ functions if some, otherwise return CANDIDATES." (if process-p ;; When no filter return CANDIDATES unmodified. (helm-process-filtered-candidate-transformer candidates source) - candidates)) + candidates)) (defun helm-process-real-to-display (candidates source) "Execute real-to-display function on all CANDIDATES of SOURCE." @@ -2421,7 +2421,7 @@ functions if some, otherwise return CANDIDATES." (if (consp cand_) ;; override DISPLAY from candidate-transformer (cons (funcall it (cdr cand_)) (cdr cand_)) - (cons (funcall it cand_) cand_))) + (cons (funcall it cand_) cand_))) candidates)) candidates)) @@ -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." @@ -2507,7 +2507,7 @@ and `helm-pattern'." ;; `helm-basename' is not available yet. (file-name-nondirectory (directory-file-name pattern)) - pattern))) + pattern))) (helm-set-case-fold-search-1 bn-or-pattern))) (defun helm-set-case-fold-search-1 (pattern) @@ -2557,9 +2557,9 @@ and `helm-pattern'." ;; Compute all candidates up to LIMIT. (helm-take-first-elements (helm-get-cached-candidates source) limit) - ;; Compute candidates according to pattern with their match fns. - (helm-match-from-candidates - (helm-get-cached-candidates source) matchfns limit source)) + ;; Compute candidates according to pattern with their match fns. + (helm-match-from-candidates + (helm-get-cached-candidates source) matchfns limit source)) source)))) (defun helm-render-source (source matches) @@ -2571,13 +2571,13 @@ and `helm-pattern'." (mapc #'(lambda (m) (helm-insert-match m 'insert source)) matches) - (let ((start (point)) separate) - (cl-dolist (match matches) - (if separate - (helm-insert-candidate-separator) - (setq separate t)) - (helm-insert-match match 'insert source)) - (put-text-property start (point) 'helm-multiline t))))) + (let ((start (point)) separate) + (cl-dolist (match matches) + (if separate + (helm-insert-candidate-separator) + (setq separate t)) + (helm-insert-match match 'insert source)) + (put-text-property start (point) 'helm-multiline t))))) (defmacro helm--maybe-use-while-no-input (&rest body) "Wrap BODY in `helm-while-no-input' unless initializing a remote connection." @@ -2586,8 +2586,8 @@ and `helm-pattern'." (not (file-remote-p helm-pattern nil t))) ;; Tramp will ask for passwd, don't use `helm-while-no-input'. ,@body - (helm-log "Using here `helm-while-no-input'") - (helm-while-no-input ,@body)))) + (helm-log "Using here `helm-while-no-input'") + (helm-while-no-input ,@body)))) (defun helm--compute-sources (src-list) (cl-loop with matches = (helm--maybe-use-while-no-input @@ -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) @@ -2714,7 +2714,7 @@ is done on whole `helm-buffer' and not on current source." ;; Don't count spaces entered when using ;; match-plugin. (replace-regexp-in-string " " "" helm-pattern) - helm-pattern)))) + helm-pattern)))) (and (or (not helm-source-filter) (member (assoc-default 'name source) helm-source-filter)) (>= len @@ -2869,7 +2869,7 @@ after the source name by overlay." (helm-insert-candidate-separator) (helm-insert-match candidate 'insert-before-markers source) (put-text-property start (point) 'helm-multiline t)) - (helm-insert-match candidate 'insert-before-markers source)) + (helm-insert-match candidate 'insert-before-markers source)) (cl-incf (cdr (assoc 'item-count source))) (when (>= (assoc-default 'item-count source) limit) (helm-kill-async-process process) @@ -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") @@ -2977,7 +2977,7 @@ If PRESERVE-SAVED-ACTION is non--nil save action." helm-saved-action (if (get-buffer helm-action-buffer) (helm-get-selection helm-action-buffer) - (helm-get-action))))) + (helm-get-action))))) (let ((source (or helm-saved-current-source (helm-get-current-source))) non-essential) @@ -3001,7 +3001,7 @@ Coerce source with coerce function." "Get the first ACTION value of action list in source." (if (and (listp action) (not (functionp action))) (cdar action) - action)) + action)) ;;;###autoload (defun helm-select-action () @@ -3021,11 +3021,11 @@ If action buffer is selected, back to the helm buffer." (let ((actions (helm-get-action))) (if (functionp actions) (message "Sole action: %s" actions) - (helm-show-action-buffer actions) - (helm-delete-minibuffer-contents) - ;; Make `helm-pattern' differs from the previous value. - (setq helm-pattern 'dummy) - (helm-check-minibuffer-input)))) + (helm-show-action-buffer actions) + (helm-delete-minibuffer-contents) + ;; Make `helm-pattern' differs from the previous value. + (setq helm-pattern 'dummy) + (helm-check-minibuffer-input)))) (t (message "No Actions available"))))) (defun helm-show-action-buffer (actions) @@ -3089,22 +3089,22 @@ 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) - helm-mode-line-string))) - (setq mode-line-format (default-value 'mode-line-format))) + helm-mode-line-string))) + (setq mode-line-format (default-value 'mode-line-format))) ;; Setup header-line. (let* ((hlstr (helm-interpret-value (and (listp source) @@ -3174,13 +3174,13 @@ Key arg DIRECTION can be one of: (goto-char (if (or (null separator-pos) (< separator-pos header-pos)) header-pos - separator-pos)) + separator-pos)) (forward-line 1))))) (defun helm-move--previous-line-fn () (if (not (helm-pos-multiline-p)) (forward-line -1) - (helm-move--previous-multi-line-fn)) + (helm-move--previous-multi-line-fn)) (when (and helm-move-to-line-cycle-in-source (helm-pos-header-line-p)) (forward-line 1) @@ -3204,7 +3204,7 @@ Key arg DIRECTION can be one of: (defun helm-move--next-line-fn () (if (not (helm-pos-multiline-p)) (forward-line 1) - (helm-move--next-multi-line-fn)) + (helm-move--next-multi-line-fn)) (when (and helm-move-to-line-cycle-in-source (or (save-excursion (and (helm-pos-multiline-p) (goto-char (overlay-end @@ -3241,7 +3241,7 @@ Key arg DIRECTION can be one of: (forward-line -1) (if (bobp) (goto-char (point-max)) - (helm-skip-header-and-separator-line 'previous)) + (helm-skip-header-and-separator-line 'previous)) (goto-char (helm-get-previous-header-pos)) (forward-line 1)) @@ -3251,7 +3251,7 @@ Key arg DIRECTION can be one of: (defun helm-move--goto-source-fn (source-or-name) (goto-char (point-min)) (let ((name (if (stringp source-or-name) source-or-name - (assoc-default 'name source-or-name)))) + (assoc-default 'name source-or-name)))) (condition-case err (while (not (string= name (helm-current-line-contents))) (goto-char (helm-get-next-header-pos))) @@ -3321,7 +3321,7 @@ Key arg DIRECTION can be one of: (eq last-command 'helm-follow-action-backward)) (if (> arg 0) (helm-next-line) - (helm-previous-line))) + (helm-previous-line))) (helm-execute-persistent-action))) (defun helm-follow-action-forward () @@ -3352,7 +3352,7 @@ to mark candidates." separator-pos) header-pos (point-max))) - (1+ (point-at-eol)))) + (1+ (point-at-eol)))) (setq helm-selection-point (overlay-start helm-selection-overlay))) (helm-follow-execute-persistent-action-maybe)) @@ -3478,8 +3478,8 @@ to a list of forms.\n\n") (when candidate-or-regexp (if helm-force-updating-p (and source (helm-goto-source source)) - (goto-char (point-min)) - (forward-line 1)) + (goto-char (point-min)) + (forward-line 1)) (let ((start (point))) (or (re-search-forward candidate-or-regexp nil t) (goto-char start)))) @@ -3571,8 +3571,8 @@ delete minibuffer contents from point instead of deleting all." (if (> (length input) 0) ;; minibuffer is not empty, delete contents and update. (helm-set-pattern str) - ;; minibuffer is already empty, force update. - (helm-force-update)))) + ;; minibuffer is already empty, force update. + (helm-force-update)))) ;;; Plugins @@ -3613,7 +3613,7 @@ delete minibuffer contents from point instead of deleting all." (accept-empty) (match identity) (volatile)))) - source)) + source)) ;; Built-in plug-in: candidates-in-buffer (defun helm-candidates-in-buffer (source) @@ -3691,7 +3691,7 @@ To customize `helm-candidates-in-buffer' behavior, use `search', (or (assoc-default 'search source) (if (assoc 'search-from-end source) '(helm-candidates-in-buffer-search-from-end) - '(helm-candidates-in-buffer-search-from-start))) + '(helm-candidates-in-buffer-search-from-start))) (helm-candidate-number-limit source) (assoc 'search-from-end source) (helm-attr 'match-part) @@ -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 @@ -3720,17 +3720,17 @@ To customize `helm-candidates-in-buffer' behavior, use `search', (if (string= pattern "") (helm-initial-candidates-from-candidate-buffer endp get-line-fn limit search-from-end) - (helm-search-from-candidate-buffer - pattern get-line-fn search-fns limit search-from-end - start-point match-part-fn source)))))) + (helm-search-from-candidate-buffer + pattern get-line-fn search-fns limit search-from-end + start-point match-part-fn source)))))) (defun helm-point-is-moved (proc) "If point is moved after executing PROC, return t, otherwise nil." (/= (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 @@ -3758,7 +3758,7 @@ To customize `helm-candidates-in-buffer' behavior, use `search', (lambda () (if search-from-end (goto-char (1- (point-at-bol))) - (forward-line 1)))) + (forward-line 1)))) return nil) (setq matches (append matches (nreverse newmatches)))) (delq nil matches))))) @@ -3769,7 +3769,7 @@ To customize `helm-candidates-in-buffer' behavior, use `search', (if (string-match " " pattern) (cl-loop for i in (split-string pattern " " t) always (string-match i part)) - (string-match pattern part)))) + (string-match pattern part)))) (defun helm-initial-candidates-from-candidate-buffer (endp get-line-fn @@ -3777,7 +3777,7 @@ To customize `helm-candidates-in-buffer' behavior, use `search', (delq nil (cl-loop with next-line-fn = (if search-from-end (lambda (_x) (goto-char (max (1- (point-at-bol)) 1))) - #'forward-line) + #'forward-line) until (funcall endp) for i from 1 to limit collect (funcall get-line-fn (point-at-bol) (point-at-eol)) @@ -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))) @@ -3833,7 +3833,7 @@ Acceptable values of CREATE-OR-BUFFER: (with-current-buffer (get-buffer-create (if (eq create-or-buffer 'global) global-bname - local-bname)) + local-bname)) (buffer-disable-undo) (erase-buffer) (font-lock-mode -1)))) @@ -3860,12 +3860,12 @@ Arg DATA can be either a list or a plain string." (if (or (stringp buffer) (bufferp buffer)) (get-buffer-create buffer) - buffer)))) ; a symbol. + buffer)))) ; a symbol. (with-current-buffer buf (erase-buffer) (if (listp data) (cl-loop for i in data do (insert (concat i "\n"))) - (and (stringp data) (insert data))))) + (and (stringp data) (insert data))))) buffer) (defun helm-compile-source--candidates-in-buffer (source) @@ -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)))) @@ -3943,41 +3943,41 @@ If N is positive enlarge, if negative narrow." (interactive) (if (and helm-full-frame (one-window-p t)) (error "Error: Can't swap windows in a single window") - (let* ((w1 (helm-window)) - (split-state (eq helm-split-window-state 'horizontal)) - (w1size (window-total-size w1 split-state)) - (b1 (window-buffer w1)) ; helm-buffer - (s1 (window-start w1)) - (cur-frame (window-frame w1)) - (w2 (with-selected-window (helm-window) - ;; Don't try to display helm-buffer - ;; in a dedicated window. - (get-window-with-predicate - (lambda (w) (not (window-dedicated-p w))) - 1 cur-frame))) - (w2size (window-total-size w2 split-state)) - (b2 (window-buffer w2)) ; probably helm-current-buffer - (s2 (window-start w2)) - resize) - (with-selected-frame (window-frame w1) - (helm-replace-buffer-in-window w1 b1 b2) - (helm-replace-buffer-in-window w2 b2 b1) - (setq resize - (cond ( ;; helm-window is smaller than other window. - (< w1size w2size) - (- (- (max w2size w1size) - (min w2size w1size)))) - ( ;; helm-window is larger than other window. - (> w1size w2size) - (- (max w2size w1size) - (min w2size w1size))) - ( ;; windows have probably same size. - t nil))) - ;; Maybe resize the window holding helm-buffer. - (and resize (window-resize w2 resize split-state)) - (set-window-start w1 s2 t) - (set-window-start w2 s1 t)) - (setq helm--window-side-state (helm--get-window-side-state))))) + (let* ((w1 (helm-window)) + (split-state (eq helm-split-window-state 'horizontal)) + (w1size (window-total-size w1 split-state)) + (b1 (window-buffer w1)) ; helm-buffer + (s1 (window-start w1)) + (cur-frame (window-frame w1)) + (w2 (with-selected-window (helm-window) + ;; Don't try to display helm-buffer + ;; in a dedicated window. + (get-window-with-predicate + (lambda (w) (not (window-dedicated-p w))) + 1 cur-frame))) + (w2size (window-total-size w2 split-state)) + (b2 (window-buffer w2)) ; probably helm-current-buffer + (s2 (window-start w2)) + resize) + (with-selected-frame (window-frame w1) + (helm-replace-buffer-in-window w1 b1 b2) + (helm-replace-buffer-in-window w2 b2 b1) + (setq resize + (cond ( ;; helm-window is smaller than other window. + (< w1size w2size) + (- (- (max w2size w1size) + (min w2size w1size)))) + ( ;; helm-window is larger than other window. + (> w1size w2size) + (- (max w2size w1size) + (min w2size w1size))) + ( ;; windows have probably same size. + t nil))) + ;; Maybe resize the window holding helm-buffer. + (and resize (window-resize w2 resize split-state)) + (set-window-start w1 s2 t) + (set-window-start w2 s1 t)) + (setq helm--window-side-state (helm--get-window-side-state))))) (defun helm--get-window-side-state () "Return the position of `helm-window' from `helm-current-buffer'. @@ -4042,7 +4042,7 @@ Otherwise goto the end of minibuffer." (interactive) (if (eolp) (helm-select-nth-action 1) - (end-of-line))) + (end-of-line))) ;; Utility: Persistent Action (defmacro with-helm-display-same-window (&rest body) @@ -4083,8 +4083,8 @@ and keep its visibility." (save-selected-window (if no-split (helm-select-persistent-action-window) - (helm-select-persistent-action-window - (or split-onewindow helm-onewindow-p))) + (helm-select-persistent-action-window + (or split-onewindow helm-onewindow-p))) (helm-log-eval (current-buffer)) (let ((helm-in-persistent-action t)) (with-helm-display-same-window @@ -4157,7 +4157,7 @@ Argument ACTION if present will be used as second argument of `display-buffer'." (with-selected-window (if (or special-display-regexps special-display-buffer-names) (minibuffer-window) - (selected-window)) + (selected-window)) ;; Be sure window of BUF is not dedicated. (set-window-dedicated-p (get-buffer-window buf) nil) (display-buffer buf action)))) @@ -4220,7 +4220,7 @@ Argument ACTION if present will be used as second argument of `display-buffer'." (let ((o (make-overlay (point-at-bol) (if (helm-pos-multiline-p) (helm-get-next-candidate-separator-pos) - (1+ (point-at-eol)))))) + (1+ (point-at-eol)))))) (overlay-put o 'face 'helm-visible-mark) (overlay-put o 'source (assoc-default 'name (helm-get-current-source))) (overlay-put o 'string (buffer-substring (overlay-start o) (overlay-end o))) @@ -4237,11 +4237,11 @@ Argument ACTION if present will be used as second argument of `display-buffer'." (let ((nomark (assq 'nomark (helm-get-current-source)))) (if nomark (message "Marking not allowed in this source") - (helm-aif (helm-this-visible-mark) - (helm-delete-visible-mark it) - (helm-make-visible-mark)) - (unless (helm-end-of-source-p) - (helm-next-line)))))) + (helm-aif (helm-this-visible-mark) + (helm-delete-visible-mark it) + (helm-make-visible-mark)) + (unless (helm-end-of-source-p) + (helm-next-line)))))) ;;;###autoload (defun helm-mark-all () @@ -4252,39 +4252,39 @@ Argument ACTION if present will be used as second argument of `display-buffer'." (let ((nomark (assq 'nomark (helm-get-current-source)))) (if nomark (message "Marking not allowed in this source") - (save-excursion - (goto-char (helm-get-previous-header-pos)) - (helm-next-line) - (let* ((next-head (helm-get-next-header-pos)) - (end (and next-head - (save-excursion - (goto-char next-head) - (forward-line -1) - (point)))) - (maxpoint (or end (point-max)))) - (while (< (point) maxpoint) - (helm-mark-current-line) - (let* ((prefix (get-text-property (point-at-bol) 'display)) - (cand (helm-get-selection)) - (bn (and (helm-file-completion-source-p) - (helm-basename cand))) - (src (assoc-default 'name (helm-get-current-source)))) - (when (and (not (helm-this-visible-mark)) - (not (or (string= prefix "[?]") - (string= prefix "[@]")))) - ;; Don't mark possibles directories ending with . or .. - ;; autosave files/links and non--existent file. - (unless - (and (or (helm-file-completion-source-p) - (equal src "Files from Current Directory")) - (or (string-match "^[.]?#.*#?$\\|[^#]*[.]\\{1,2\\}$" bn) - ;; We need to test here when not using a transformer - ;; that tag prefix (i.e on tramp) - (not (file-exists-p cand)))) - (helm-make-visible-mark)))) - (forward-line 1) (end-of-line)))) - (helm-mark-current-line) - (message "%s candidates marked" (length helm-marked-candidates)))))) + (save-excursion + (goto-char (helm-get-previous-header-pos)) + (helm-next-line) + (let* ((next-head (helm-get-next-header-pos)) + (end (and next-head + (save-excursion + (goto-char next-head) + (forward-line -1) + (point)))) + (maxpoint (or end (point-max)))) + (while (< (point) maxpoint) + (helm-mark-current-line) + (let* ((prefix (get-text-property (point-at-bol) 'display)) + (cand (helm-get-selection)) + (bn (and (helm-file-completion-source-p) + (helm-basename cand))) + (src (assoc-default 'name (helm-get-current-source)))) + (when (and (not (helm-this-visible-mark)) + (not (or (string= prefix "[?]") + (string= prefix "[@]")))) + ;; Don't mark possibles directories ending with . or .. + ;; autosave files/links and non--existent file. + (unless + (and (or (helm-file-completion-source-p) + (equal src "Files from Current Directory")) + (or (string-match "^[.]?#.*#?$\\|[^#]*[.]\\{1,2\\}$" bn) + ;; We need to test here when not using a transformer + ;; that tag prefix (i.e on tramp) + (not (file-exists-p cand)))) + (helm-make-visible-mark)))) + (forward-line 1) (end-of-line)))) + (helm-mark-current-line) + (message "%s candidates marked" (length helm-marked-candidates)))))) ;;;###autoload (defun helm-unmark-all () @@ -4308,7 +4308,7 @@ visible or invisible in all sources of current helm session" (if (and (>= (length marked) 1) (with-helm-window helm-visible-mark-overlays)) (helm-unmark-all) - (helm-mark-all)))) + (helm-mark-all)))) ;;;###autoload (defun helm-display-all-visible-marks () @@ -4363,28 +4363,28 @@ When key WITH-WILDCARD is specified try to expand a wilcard if some." ;; that the one stored in overlay. (and (string= (overlay-get o 'real) real) (move-overlay o (point-at-bol 0) (1+ (point-at-eol 0)))) - (move-overlay o (point-at-bol 0) (1+ (point-at-eol 0))))))))) + (move-overlay o (point-at-bol 0) (1+ (point-at-eol 0))))))))) (add-hook 'helm-update-hook 'helm-revive-visible-mark) (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 - 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)))) + ;; 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 i)) + points)))) ;;;###autoload (defun helm-next-visible-mark (&optional prev) @@ -4465,12 +4465,12 @@ This will enable `helm-follow-mode' automatically in `helm-source-buffers-list'. (eq (cdr fol-attr) 1)))) (if (eq (cdr fol-attr) 'never) (message "helm-follow-mode not allowed in this source") - (helm-attrset 'follow (if enabled -1 1) src) - (setq helm-follow-mode (eq (cdr (assq 'follow src)) 1)) - (message "helm-follow-mode is %s" - (if helm-follow-mode - "enabled" "disabled")) - (helm-display-mode-line src)) + (helm-attrset 'follow (if enabled -1 1) src) + (setq helm-follow-mode (eq (cdr (assq 'follow src)) 1)) + (message "helm-follow-mode is %s" + (if helm-follow-mode + "enabled" "disabled")) + (helm-display-mode-line src)) ;; Make follow attr persistent for this session. (when (and helm-follow-mode-persistent sym) (set (car `(,sym)) src))))) |