branch: elpa/helm commit 4c44ee2a2e4ef1bd1fd8d4059044635bc6ef31aa Author: Thierry Volpiatto <thie...@posteo.net> Commit: Thierry Volpiatto <thie...@posteo.net>
Rename helm-in-buffer-make-separator to helm-make-separator and allow using it in any sources. When longest is < of candidate length default to candidate length instead of defaulting to 0. --- helm-core.el | 13 +++++++------ helm-elisp.el | 2 +- helm-mode.el | 12 ++++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/helm-core.el b/helm-core.el index 5ea0954e7b..eeb395e013 100644 --- a/helm-core.el +++ b/helm-core.el @@ -6899,15 +6899,16 @@ It is useful to align extra informations after candidates in `helm-buffer'.") (get-buffer it)) 0)) -(defun helm-in-buffer-make-separator (cand &optional longest) - "Create a separator to align candidates in `helm-source-in-buffer'. -Longest candidate should have been modified at initialization of -source, otherwise LONGEST can be used to specify longest candidate." +(defun helm-make-separator (cand &optional longest) + "Create a separator to align candidates. +Longest candidate should have been calculated at initialization +of `helm-source-in-buffer' by `helm-init-candidates-in-buffer' , otherwise +LONGEST can be used to specify longest candidate." (let ((lgst (or longest (helm-in-buffer-get-longest-candidate))) (len (length cand))) (make-string (1+ (if (> lgst len) - (- lgst (length cand)) - 0)) + (- lgst len) + len)) ? ))) (defun helm-init-candidates-in-buffer (buffer-spec data &optional force-longest) diff --git a/helm-elisp.el b/helm-elisp.el index 7522a51f63..517ef18c09 100644 --- a/helm-elisp.el +++ b/helm-elisp.el @@ -948,7 +948,7 @@ a prefix arg." for c in candidates for count from 0 for bn = (helm-basename c 2) - for sep = (helm-in-buffer-make-separator bn lgst) + for sep = (helm-make-separator bn lgst) for path = (or (assoc-default bn helm--locate-library-cache) (let ((p (find-library-name bn))) (push (cons bn p) helm--locate-library-cache) diff --git a/helm-mode.el b/helm-mode.el index 30c6653b1c..b135f0efef 100644 --- a/helm-mode.el +++ b/helm-mode.el @@ -1154,7 +1154,7 @@ is used." (helm-in-buffer-get-longest-candidate))) (sep (if (or (null max-len) (zerop max-len)) " --" ; Default separator. - (helm-in-buffer-make-separator comp max-len))) + (helm-make-separator comp max-len))) (doc (ignore-errors (helm-get-first-line-documentation sym))) (symbol-class (help--symbol-class sym)) @@ -1202,7 +1202,7 @@ is used." (desc (if built-in (aref (assoc-default sym package--builtins) 2) (and id (package-desc-summary id)))) - (sep (helm-in-buffer-make-separator comp))) + (sep (helm-make-separator comp))) (list comp (propertize (if status @@ -1217,7 +1217,7 @@ is used." (defun helm-completion-theme-affixation (_completions) (lambda (comp) (let* ((sym (intern-soft comp)) - (sep (helm-in-buffer-make-separator comp)) + (sep (helm-make-separator comp)) (doc (if (custom-theme-p sym) (helm-get-first-line-documentation sym) (helm--get-theme-doc-1 sym)))) @@ -1262,7 +1262,7 @@ is used." (let ((doc (with-output-to-string (with-current-buffer standard-output (print-coding-system-briefly (intern comp) 'tightly)))) - (sep (helm-in-buffer-make-separator comp))) + (sep (helm-make-separator comp))) (list comp "" (helm-aand (replace-regexp-in-string "^ *" "" doc) (replace-regexp-in-string "[\n]" "" it) (propertize it 'face 'helm-completions-detailed) @@ -1270,7 +1270,7 @@ is used." (defun helm-completion-color-affixation (_comps) (lambda (comp) - (let ((sep (helm-in-buffer-make-separator comp)) + (let ((sep (helm-make-separator comp)) (rgb (condition-case nil (helm-acase comp ("foreground at point" (with-helm-current-buffer @@ -1294,7 +1294,7 @@ is used." ;; behavior of find-library-include-other-files remove them for the benefit ;; of everybody. (unless (string-match "\\(\\.elc\\|/\\)\\'" comp) - (let* ((sep (helm-in-buffer-make-separator comp)) + (let* ((sep (helm-make-separator comp)) (path (or (assoc-default comp helm--locate-library-cache) (let ((p (find-library-name comp))) (push (cons comp p) helm--locate-library-cache)