~mathrick/dvc/trunk

« back to all changes in this revision

Viewing changes to lisp/dvc-bookmarks.el

  • Committer: Stefan Reichoer
  • Date: 2009-11-29 20:01:53 UTC
  • Revision ID: stefan@xsteve.at-20091129200153-d57zlhbioax72npf
Patch from Thierry Volpiatto: dvc-bookmarks.el: dvc-bookmarks-show-or-hide-subtree is now a toggle command H==>hide H==> show.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1163
1163
(defvar dvc-bookmarks-hidden-subtree nil
1164
1164
  "List of all hidden subtrees")
1165
1165
 
1166
 
(defun dvc-bookmarks-show-or-hide-subtree (&optional show)
1167
 
  "Hide subtree when called with no argument
1168
 
show subtree when called with prefix argument (C-u)"
1169
 
  (interactive "P")
 
1166
(defun dvc-bookmarks-show-or-hide-subtree ()
 
1167
  "Toggle subtree visibility."
 
1168
  (interactive)
1170
1169
  (let ((current-tree (aref (dvc-bookmarks-current-bookmark) 1))
1171
 
        (parent))
1172
 
    (when (member (assoc current-tree dvc-bookmark-alist) dvc-bookmark-alist) ;check if we are really on a tree
1173
 
      (if current-prefix-arg
 
1170
        (pos (point))
 
1171
        parent)
 
1172
    (when (member (assoc current-tree dvc-bookmark-alist)
 
1173
                  dvc-bookmark-alist) ; Check if we are really on a tree.
 
1174
      (if (member current-tree dvc-bookmarks-hidden-subtree)
1174
1175
          (progn
1175
 
            (setq dvc-bookmarks-hidden-subtree (remove current-tree dvc-bookmarks-hidden-subtree))
1176
 
            (dvc-bookmarks))
1177
 
        (add-to-list 'dvc-bookmarks-hidden-subtree current-tree))
1178
 
      (ewoc-filter dvc-bookmarks-cookie #'(lambda (x)
1179
 
                                            (setq parent (dvc-get-parent-elm (aref x 1) dvc-bookmark-alist))
1180
 
                                            (if (not (member parent dvc-bookmarks-hidden-subtree))
1181
 
                                                t
1182
 
                                              nil))))))
 
1176
            (setq dvc-bookmarks-hidden-subtree
 
1177
                  (remove current-tree dvc-bookmarks-hidden-subtree))
 
1178
              (dvc-bookmarks))
 
1179
          (add-to-list 'dvc-bookmarks-hidden-subtree current-tree))
 
1180
      (ewoc-filter dvc-bookmarks-cookie
 
1181
                   #'(lambda (x)
 
1182
                       (setq parent
 
1183
                             (dvc-get-parent-elm (aref x 1) dvc-bookmark-alist))
 
1184
                       (if (not (member parent dvc-bookmarks-hidden-subtree)) t nil))))
 
1185
    (goto-char pos)))
1183
1186
 
1184
1187
(defvar dvc-bookmarks-tmp-yank-item '("hg" (local-tree "~/work/hg/hg")))
1185
1188