[137938] users/chunyang/helm-ls-svn.el/helm-ls-svn.el
chunyang at macports.org
chunyang at macports.org
Tue Jun 23 08:45:04 PDT 2015
Revision: 137938
https://trac.macports.org/changeset/137938
Author: chunyang at macports.org
Date: 2015-06-23 08:45:04 -0700 (Tue, 23 Jun 2015)
Log Message:
-----------
users/chunyang: helm-ls-svn.el: Support 'helm-ff-toggle-basename'
Modified Paths:
--------------
users/chunyang/helm-ls-svn.el/helm-ls-svn.el
Modified: users/chunyang/helm-ls-svn.el/helm-ls-svn.el
===================================================================
--- users/chunyang/helm-ls-svn.el/helm-ls-svn.el 2015-06-23 12:53:37 UTC (rev 137937)
+++ users/chunyang/helm-ls-svn.el/helm-ls-svn.el 2015-06-23 15:45:04 UTC (rev 137938)
@@ -76,10 +76,16 @@
;; get my email address).
;;
;;
+;; Note
+;; ====
+;;
+;; The code of `helm-ls-svn.el' is based on `helm-ls-git.el'
+;; <https://github.com/emacs-helm/helm-ls-git>
+;;
+;;
;; TODO
;; ====
;;
-;; - Allow showing base name (or related to project root path) for a clean look.
;; - Handle conflict status, think about it, may or may not needed.
@@ -103,6 +109,14 @@
:link '(emacs-library-link :tag "lisp file" "helm-ls-svn.el")
:link '(url-link :tag "MELPA" "http://melpa.org/#/helm-ls-svn"))
+(defcustom helm-ls-svn-show-abs-or-relative 'absolute
+ "Show full path or relative path to repo when using `helm-ff-toggle-basename'.
+Valid values are symbol 'abs (default) or 'relative."
+ :group 'helm-ls-svn
+ :type '(radio :tag "Show full path or relative path to Svn repo when toggling"
+ (const :tag "Show full path" absolute)
+ (const :tag "Show relative path" relative)))
+
(defcustom helm-ls-svn-status-command 'vc-dir
"Favorite svn-status command for Emacs."
:group 'helm-ls-svn
@@ -242,11 +256,32 @@
"Revert file(s)" #'helm-ls-svn-revert)))
(t actions))))
+(defun helm-ls-svn-transformer (candidates)
+ "Toggle abs and relative path for CANDIDATES."
+ (cl-loop with root = (helm-ls-svn-root-dir)
+ for i in candidates
+ for abs = (expand-file-name i root)
+ for disp = (if (and helm-ff-transformer-show-only-basename
+ (not (string-match "[.]\\{1,2\\}$" i)))
+ (helm-basename i)
+ (cl-case helm-ls-svn-show-abs-or-relative
+ (absolute abs)
+ (relative (file-relative-name i root))))
+ collect
+ (cons (propertize disp 'face 'helm-ff-file) abs)))
+
+(defun helm-ls-svn-sort-fn (candidates)
+ "Transformer for sorting CANDIDATES."
+ (helm-ff-sort-candidates candidates nil))
+
(defclass helm-ls-svn-source (helm-source-in-buffer)
((header-name :initform 'helm-ls-svn-header-name)
(data :initform 'helm-ls-svn-collect-data)
(keymap :initform helm-ls-svn-map)
(help-message :initform helm-generic-file-help-message)
+ (mode-line :initform helm-generic-file-mode-line-string)
+ (candidate-transformer :initform '(helm-ls-svn-transformer
+ helm-ls-svn-sort-fn))
(candidate-number-limit :initform 9999)
(action :initform (helm-actions-from-type-file))))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150623/37b6c397/attachment.html>
More information about the macports-changes
mailing list