Permalink
Browse files

Merge pull request #233 from emacs-helm/bookmark-show-fname

Issue #232 Implement bookmark show filename
  • Loading branch information...
2 parents a2ecf8c + 2fbaccc commit 0ddef7a277a865ada119ed450427fb00ff611979 @thierryvolpiatto thierryvolpiatto committed Apr 4, 2013
Showing with 167 additions and 183 deletions.
  1. +0 −12 helm-aliases.el
  2. +44 −70 helm-bmkext.el
  3. +121 −99 helm-bookmark.el
  4. +2 −2 helm-config.el
View
@@ -267,8 +267,6 @@
(make-obsolete 'helm-c-bookmark-info-setup-alist 'helm-bookmark-info-setup-alist "1.5.1")
(defalias 'helm-c-ratpoison-commands-execute 'helm-ratpoison-commands-execute)
(make-obsolete 'helm-c-ratpoison-commands-execute 'helm-ratpoison-commands-execute "1.5.1")
-(defalias 'helm-c-collect-bookmarks 'helm-collect-bookmarks)
-(make-obsolete 'helm-c-collect-bookmarks 'helm-collect-bookmarks "1.5.1")
(defalias 'helm-c-ucs-persistent-backward 'helm-ucs-persistent-backward)
(make-obsolete 'helm-c-ucs-persistent-backward 'helm-ucs-persistent-backward "1.5.1")
(defalias 'helm-c-info-pages-init 'helm-info-pages-init)
@@ -331,8 +329,6 @@
(make-obsolete 'helm-c-top-sh 'helm-top-sh "1.5.1")
(defalias 'helm-c-bbdb-get-record 'helm-bbdb-get-record)
(make-obsolete 'helm-c-bbdb-get-record 'helm-bbdb-get-record "1.5.1")
-(defalias 'helm-c-bookmark-root-logged-p 'helm-bookmark-root-logged-p)
-(make-obsolete 'helm-c-bookmark-root-logged-p 'helm-bookmark-root-logged-p "1.5.1")
(defalias 'helm-c-persistent-xfont-action 'helm-persistent-xfont-action)
(make-obsolete 'helm-c-persistent-xfont-action 'helm-persistent-xfont-action "1.5.1")
(defalias 'helm-c-latex-math-candidates 'helm-latex-math-candidates)
@@ -497,8 +493,6 @@
(make-obsolete 'helm-c-find-file-or-marked 'helm-find-file-or-marked "1.5.1")
(defalias 'helm-c-query-replace-regexp 'helm-query-replace-regexp)
(make-obsolete 'helm-c-query-replace-regexp 'helm-query-replace-regexp "1.5.1")
-(defalias 'helm-c-bookmark-ssh-files-setup-alist 'helm-bookmark-ssh-files-setup-alist)
-(make-obsolete 'helm-c-bookmark-ssh-files-setup-alist 'helm-bookmark-ssh-files-setup-alist "1.5.1")
(defalias 'helm-c-describe-variable 'helm-describe-variable)
(make-obsolete 'helm-c-describe-variable 'helm-describe-variable "1.5.1")
(defalias 'helm-c-advice-persistent-action 'helm-advice-persistent-action)
@@ -547,8 +541,6 @@
(make-obsolete 'helm-c-xrandr-info 'helm-xrandr-info "1.5.1")
(defalias 'helm-c-stringify 'helm-stringify)
(make-obsolete 'helm-c-stringify 'helm-stringify "1.5.1")
-(defalias 'helm-c-bookmark-su-files-setup-alist 'helm-bookmark-su-files-setup-alist)
-(make-obsolete 'helm-c-bookmark-su-files-setup-alist 'helm-bookmark-su-files-setup-alist "1.5.1")
(defalias 'helm-c-goto-precedent-file 'helm-goto-precedent-file)
(make-obsolete 'helm-c-goto-precedent-file 'helm-goto-precedent-file "1.5.1")
(defalias 'helm-c-apt-cache-show 'helm-apt-cache-show)
@@ -732,8 +724,6 @@
(make-obsolete-variable 'helm-c-eldoc-in-minibuffer-show-fn 'helm-eldoc-in-minibuffer-show-fn "1.5.1")
(defvaralias 'helm-c-google-suggest-search-url 'helm-google-suggest-search-url)
(make-obsolete-variable 'helm-c-google-suggest-search-url 'helm-google-suggest-search-url "1.5.1")
-(defvaralias 'helm-c-source-bookmark-su-files&dirs 'helm-source-bookmark-su-files&dirs)
-(make-obsolete-variable 'helm-c-source-bookmark-su-files&dirs 'helm-source-bookmark-su-files&dirs "1.5.1")
(defvaralias 'helm-c-source-bmkext-addressbook 'helm-source-bmkext-addressbook)
(make-obsolete-variable 'helm-c-source-bmkext-addressbook 'helm-source-bmkext-addressbook "1.5.1")
(defvaralias 'helm-c-source-ctags 'helm-source-ctags)
@@ -778,8 +768,6 @@
(make-obsolete-variable 'helm-c-grep-use-ioccur-style-keys 'helm-grep-use-ioccur-style-keys "1.5.1")
(defvaralias 'helm-c-ctags-modes 'helm-ctags-modes)
(make-obsolete-variable 'helm-c-ctags-modes 'helm-ctags-modes "1.5.1")
-(defvaralias 'helm-c-source-bookmark-ssh-files&dirs 'helm-source-bookmark-ssh-files&dirs)
-(make-obsolete-variable 'helm-c-source-bookmark-ssh-files&dirs 'helm-source-bookmark-ssh-files&dirs "1.5.1")
(defvaralias 'helm-c-source-moccur 'helm-source-moccur)
(make-obsolete-variable 'helm-c-source-moccur 'helm-source-moccur "1.5.1")
(defvaralias 'helm-c-source-w3m-bookmarks 'helm-source-w3m-bookmarks)
View
@@ -15,6 +15,11 @@
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+;; Dependency: https://github.com/thierryvolpiatto/emacs-bmk-ext
+;; If you want to enable google-maps in addressbook you will need
+;; Julien Danjou google-maps-el package available here:
+;; http://julien.danjou.info/google-maps-el.html
+
;;; Code:
(eval-when-compile (require 'cl))
(require 'helm)
@@ -23,11 +28,9 @@
(declare-function bookmark-get-filename "bookmark" (bookmark-name-or-record))
-;; Dependency: https://github.com/thierryvolpiatto/emacs-bmk-ext
-;; If you want to enable google-maps in addressbook you will need
-;; Julien Danjou google-maps-el package available here:
-;; http://julien.danjou.info/google-maps-el.html
-
+
+;;; Filter functions
+;;
(defun helm-bmkext-filter-setup-alist (fn &rest args)
"Return a filtered `bookmark-alist' sorted alphabetically."
(loop
@@ -36,7 +39,7 @@
(funcall fn))
for i in alist
for b = (car i)
- collect b into sa
+ collect (propertize b 'location (bookmark-location b)) into sa
finally return (sort sa 'string-lessp)))
;;;###autoload
@@ -45,6 +48,7 @@
(interactive)
(helm-quit-and-execute-action 'bmkext-edit-bookmark))
+
;;; Addressbook.
;;
;;
@@ -57,6 +61,8 @@
'global
(helm-bmkext-addressbook-setup-alist))))
(candidates-in-buffer)
+ (search helm-bookmark-search-fn)
+ (match-part . helm-pp-bookmark-match-fn)
(persistent-action
. (lambda (candidate)
(let ((bmk (helm-bookmark-get-bookmark-from-name
@@ -131,7 +137,9 @@
"Specialized filter function for bookmarks w3m."
(helm-bmkext-filter-setup-alist 'bmkext-addressbook-alist-only))
-;; W3m bookmarks from bookmark-extensions.
+
+;;; W3m bookmarks from bookmark-extensions.
+;;
(defvar helm-source-bookmark-w3m
'((name . "Bookmark W3m")
(init . (lambda ()
@@ -140,6 +148,8 @@
(helm-init-candidates-in-buffer
'global (helm-bookmark-w3m-setup-alist))))
(candidates-in-buffer)
+ (search helm-bookmark-search-fn)
+ (match-part . helm-pp-bookmark-match-fn)
(filtered-candidate-transformer
helm-adaptive-sort
helm-highlight-bookmark)
@@ -149,7 +159,9 @@
"Specialized filter function for bookmarks w3m."
(helm-bmkext-filter-setup-alist 'bmkext-w3m-alist-only))
-;; Images
+
+;;; Images
+;;
(defvar helm-source-bookmark-images
'((name . "Bookmark Images")
(init . (lambda ()
@@ -158,6 +170,8 @@
(helm-init-candidates-in-buffer
'global (helm-bookmark-images-setup-alist))))
(candidates-in-buffer)
+ (search helm-bookmark-search-fn)
+ (match-part . helm-pp-bookmark-match-fn)
(filtered-candidate-transformer
helm-adaptive-sort
helm-highlight-bookmark)
@@ -167,7 +181,9 @@
"Specialized filter function for images bookmarks."
(helm-bmkext-filter-setup-alist 'bmkext-image-file-alist-only))
-;; Woman Man
+
+;;; Woman Man
+;;
(defvar helm-source-bookmark-man
'((name . "Bookmark Woman&Man")
(init . (lambda ()
@@ -176,6 +192,8 @@
(helm-init-candidates-in-buffer
'global (helm-bookmark-man-setup-alist))))
(candidates-in-buffer)
+ (search helm-bookmark-search-fn)
+ (match-part . helm-pp-bookmark-match-fn)
(filtered-candidate-transformer
helm-adaptive-sort
helm-highlight-bookmark)
@@ -186,7 +204,9 @@
(append (helm-bmkext-filter-setup-alist 'bmkext-man-alist-only)
(helm-bmkext-filter-setup-alist 'bmkext-woman-alist-only)))
-;; Gnus
+
+;;; Gnus
+;;
(defvar helm-source-bookmark-gnus
'((name . "Bookmark Gnus")
(init . (lambda ()
@@ -195,6 +215,8 @@
(helm-init-candidates-in-buffer
'global (helm-bookmark-gnus-setup-alist))))
(candidates-in-buffer)
+ (search helm-bookmark-search-fn)
+ (match-part . helm-pp-bookmark-match-fn)
(filtered-candidate-transformer
helm-adaptive-sort
helm-highlight-bookmark)
@@ -204,7 +226,9 @@
"Specialized filter function for bookmarks gnus."
(helm-bmkext-filter-setup-alist 'bmkext-gnus-alist-only))
-;; Info
+
+;;; Info
+;;
(defvar helm-source-bookmark-info
'((name . "Bookmark Info")
(init . (lambda ()
@@ -213,6 +237,8 @@
(helm-init-candidates-in-buffer
'global (helm-bookmark-info-setup-alist))))
(candidates-in-buffer)
+ (search helm-bookmark-search-fn)
+ (match-part . helm-pp-bookmark-match-fn)
(filtered-candidate-transformer
helm-adaptive-sort
helm-highlight-bookmark)
@@ -222,7 +248,9 @@
"Specialized filter function for bookmarks info."
(helm-bmkext-filter-setup-alist 'bmkext-info-alist-only))
-;; Local Files&directories
+
+;;; Files and directories
+;;
(defvar helm-source-bookmark-files&dirs
'((name . "Bookmark Files&Directories")
(init . (lambda ()
@@ -231,70 +259,18 @@
(helm-init-candidates-in-buffer
'global (helm-bookmark-local-files-setup-alist))))
(candidates-in-buffer)
+ (search helm-bookmark-search-fn)
+ (match-part . helm-pp-bookmark-match-fn)
(filtered-candidate-transformer
helm-adaptive-sort
helm-highlight-bookmark)
(type . bookmark)))
(defun helm-bookmark-local-files-setup-alist ()
"Specialized filter function for bookmarks locals files."
- (helm-bmkext-filter-setup-alist 'bmkext-local-file-alist-only))
-
-;; Su Files&directories
-(defvar helm-source-bookmark-su-files&dirs
- '((name . "Bookmark Root-Files&Directories")
- (init . (lambda ()
- (require 'bookmark-extensions)
- (bookmark-maybe-load-default-file)
- (helm-init-candidates-in-buffer
- 'global (helm-bookmark-su-files-setup-alist))))
- (candidates-in-buffer)
- (filtered-candidate-transformer
- helm-adaptive-sort
- helm-highlight-bookmark-su)
- (type . bookmark)))
-
-(defun helm-bookmark-su-files-setup-alist ()
- "Specialized filter function for bookmarks su/sudo files."
- (declare (special bmkext-su-or-sudo-regexp))
- (loop
- with l = (helm-bmkext-filter-setup-alist 'bmkext-remote-file-alist-only)
- for i in l
- for isfile = (bookmark-get-filename i)
- for istramp = (and isfile (boundp 'tramp-file-name-regexp)
- (save-match-data
- (string-match tramp-file-name-regexp isfile)))
- for issu = (and istramp
- (string-match bmkext-su-or-sudo-regexp isfile))
- if issu
- collect i))
-
-;; Ssh Files&directories
-(defvar helm-source-bookmark-ssh-files&dirs
- '((name . "Bookmark Ssh-Files&Directories")
- (init . (lambda ()
- (require 'bookmark-extensions)
- (bookmark-maybe-load-default-file)
- (helm-init-candidates-in-buffer
- 'global (helm-bookmark-ssh-files-setup-alist))))
- (candidates-in-buffer)
- (filtered-candidate-transformer . helm-adaptive-sort)
- (type . bookmark)))
-
-(defun helm-bookmark-ssh-files-setup-alist ()
- "Specialized filter function for bookmarks ssh files."
- (loop
- with l = (helm-bmkext-filter-setup-alist 'bmkext-remote-file-alist-only)
- for i in l
- for isfile = (bookmark-get-filename i)
- for istramp = (and isfile (boundp 'tramp-file-name-regexp)
- (save-match-data
- (string-match tramp-file-name-regexp isfile)))
- for isssh = (and istramp
- (string-match "/ssh:" isfile))
- if isssh
- collect i))
+ (helm-bmkext-filter-setup-alist 'bmkext-file-alist-only))
+
;;;###autoload
(defun helm-bookmark-ext ()
"Preconfigured `helm' for bookmark-extensions sources.
@@ -312,8 +288,6 @@ Contain also `helm-source-google-suggest'."
helm-source-bookmark-info
helm-source-bookmark-man
helm-source-bookmark-images
- helm-source-bookmark-su-files&dirs
- helm-source-bookmark-ssh-files&dirs
helm-source-bookmark-set)
:prompt "SearchBookmark: "
:buffer "*helm bmkext*"
Oops, something went wrong.

0 comments on commit 0ddef7a

Please sign in to comment.