emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/helm 55d9a2e897 1/2: Add helm-fd-mode-line-function custom


From: ELPA Syncer
Subject: [nongnu] elpa/helm 55d9a2e897 1/2: Add helm-fd-mode-line-function customization
Date: Mon, 24 Oct 2022 01:58:55 -0400 (EDT)

branch: elpa/helm
commit 55d9a2e8972d2d0e89c8d6bfcb02c45b28fb93f9
Author: Romain Leroux <romain@leroux.dev>
Commit: Romain Leroux <romain@leroux.dev>

    Add helm-fd-mode-line-function customization
---
 helm-fd.el | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/helm-fd.el b/helm-fd.el
index 8b10d12fb3..d20fb74c2e 100644
--- a/helm-fd.el
+++ b/helm-fd.el
@@ -1,6 +1,6 @@
 ;;; helm-fd.el --- helm interface for fd command line tool. -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto 
+;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -30,6 +30,11 @@
   :type '(repeat string)
   :group 'helm-files)
 
+(defcustom helm-fd-mode-line-function 'helm-fd-default-mode-line
+  "Function called when `fd' process is finished to format mode-line."
+  :type 'function
+  :group 'helm-files)
+
 (defface helm-fd-finish
   `((t ,@(and (>= emacs-major-version 27) '(:extend t))
        :foreground "Green"))
@@ -92,20 +97,25 @@
        proc (lambda (_process event)
               (if (string= event "finished\n")
                   (with-helm-window
-                    (setq mode-line-format
-                          `(" " mode-line-buffer-identification " "
-                            (:eval (format "L%s" 
(helm-candidate-number-at-point))) " "
-                            (:eval (propertize
-                                    (format
-                                     "[%s process finished in %.2fs - (%s 
results)] "
-                                     ,fd-version
-                                     ,(- (float-time) start-time)
-                                     (helm-get-candidate-number))
-                                    'face 'helm-fd-finish))))
-                    (force-mode-line-update))
+                    (when helm-fd-mode-line-function
+                      (funcall helm-fd-mode-line-function start-time 
fd-version)
+                      (force-mode-line-update)))
                 (helm-log "helm-fd-process sentinel" "Error: Fd %s"
                           (replace-regexp-in-string "\n" "" event))))))))
 
+(defun helm-fd-default-mode-line (start-time fd-version)
+  "Format mode-line with START-TIME and FD-VERSION, as well as `fd' results."
+  (setq mode-line-format
+        `(" " mode-line-buffer-identification " "
+          (:eval (format "L%s" (helm-candidate-number-at-point))) " "
+          (:eval (propertize
+                  (format
+                   "[%s process finished in %.2fs - (%s results)] "
+                   ,fd-version
+                   ,(- (float-time) start-time)
+                   (helm-get-candidate-number))
+                  'face 'helm-fd-finish)))))
+
 (defun helm-fd-fct (candidates _source)
   "The filtered-candidate-transformer function for helm-fd."
   (cl-loop for i in candidates



reply via email to

[Prev in Thread] Current Thread [Next in Thread]