* A few small patches
@ 2009-10-20 2:51 James TD Smith
2009-10-20 2:51 ` [PATCH 1/3] Add a missing entry, and fix some formatting in the changelog James TD Smith
0 siblings, 1 reply; 9+ messages in thread
From: James TD Smith @ 2009-10-20 2:51 UTC (permalink / raw)
To: emacs-orgmode
A few small patches for org-mode.
--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] Add a missing entry, and fix some formatting in the changelog.
2009-10-20 2:51 A few small patches James TD Smith
@ 2009-10-20 2:51 ` James TD Smith
2009-10-20 2:51 ` [PATCH 2/3] Add a way to display names for tag groups in fast tag selection James TD Smith
2009-10-21 8:39 ` [PATCH 1/3] Add a missing entry, and fix some formatting in the changelog Carsten Dominik
0 siblings, 2 replies; 9+ messages in thread
From: James TD Smith @ 2009-10-20 2:51 UTC (permalink / raw)
To: emacs-orgmode
---
lisp/ChangeLog | 19 ++++---------------
1 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 822bd57..47b44cd 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -983,21 +983,10 @@
* org-remember.el (org-remember-finalize): Avoid buffer-modified
messages.
+2009-08-06 James TD Smith <ahktenzero@mohorovi.cc>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ * org-plot.el (org-plot/gnuplot): Stop datafile from being deleted
+ before gnuplot can read it.
2009-08-05 Carsten Dominik <carsten.dominik@gmail.com>
@@ -5455,7 +5444,7 @@
(org-clock-special-range): Also undertand yesterday, lastweek etc.
2008-06-18 Glenn Morris <rgm@gnu.org>
- * org.el (org-map-entries): Let-bind `file'.
+ * org.el (org-map-entries): Let-bind `file'.
2008-06-19 Carsten Dominik <dominik@science.uva.nl>
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] Add a way to display names for tag groups in fast tag selection.
2009-10-20 2:51 ` [PATCH 1/3] Add a missing entry, and fix some formatting in the changelog James TD Smith
@ 2009-10-20 2:51 ` James TD Smith
2009-10-20 2:51 ` [PATCH 3/3] Some small fixes in org-registry James TD Smith
2009-10-21 8:43 ` [PATCH 2/3] Add a way to display names for tag groups in fast tag selection Carsten Dominik
2009-10-21 8:39 ` [PATCH 1/3] Add a missing entry, and fix some formatting in the changelog Carsten Dominik
1 sibling, 2 replies; 9+ messages in thread
From: James TD Smith @ 2009-10-20 2:51 UTC (permalink / raw)
To: emacs-orgmode
If the nil term in the start or end group cells are replaced by strings, these
are displayed before or after the brackets for the group.
---
lisp/ChangeLog | 6 ++++++
lisp/org.el | 12 ++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 47b44cd..83af7a4 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -29,6 +29,12 @@
(org-mobile-create-index-file): Sort the files to be listed in
index.org.
+2009-10-17 James TD Smith <ahktenzero@mohorovi.cc>
+
+ * org.el (org-fast-tag-selection): Add a way to display a
+ description for a tag group. This is done by adding a string to
+ either the startgroup or endgroup cell.
+
2009-10-17 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-resolve, org-resolve-clocks)
diff --git a/lisp/org.el b/lisp/org.el
index a394443..3f8bbee 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11542,15 +11542,15 @@ Returns the new tags string, or nil to not change the current settings."
(setq tbl fulltable char ?a cnt 0)
(while (setq e (pop tbl))
(cond
- ((equal e '(:startgroup))
+ ((equal (car e) :startgroup)
(push '() groups) (setq ingroup t)
(when (not (= cnt 0))
(setq cnt 0)
(insert "\n"))
- (insert "{ "))
- ((equal e '(:endgroup))
+ (insert (if (cdr e) (format "%s: " (cdr e)) "") "{ "))
+ ((equal (car e) :endgroup)
(setq ingroup nil cnt 0)
- (insert "}\n"))
+ (insert "}" (if (cdr e) (format " (%s) " (cdr e)) "") "\n"))
((equal e '(:newline))
(when (not (= cnt 0))
(setq cnt 0)
@@ -11595,8 +11595,8 @@ Returns the new tags string, or nil to not change the current settings."
(setq rtn
(catch 'exit
(while t
- (message "[a-z..]:Toggle [SPC]:clear [RET]:accept [TAB]:free%s%s"
- (if groups " [!] no groups" " [!]groups")
+ (message "[a-z..]:Toggle [SPC]:clear [RET]:accept [TAB]:free [!] %sgroups%s"
+ (if (not groups) "no " "")
(if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi")))
(setq c (let ((inhibit-quit t)) (read-char-exclusive)))
(cond
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] Some small fixes in org-registry.
2009-10-20 2:51 ` [PATCH 2/3] Add a way to display names for tag groups in fast tag selection James TD Smith
@ 2009-10-20 2:51 ` James TD Smith
2009-10-21 8:43 ` Carsten Dominik
2009-10-21 8:43 ` [PATCH 2/3] Add a way to display names for tag groups in fast tag selection Carsten Dominik
1 sibling, 1 reply; 9+ messages in thread
From: James TD Smith @ 2009-10-20 2:51 UTC (permalink / raw)
To: emacs-orgmode
org-registry-assoc-all removed matching links from the registry. This meant
subsequent calls with the same parameters would return nothing.
Add another function for finding entries in the register, which used find-if to
get entries satisfying a predicate.
---
contrib/ChangeLog | 9 +++++++--
contrib/lisp/org-registry.el | 40 ++++++++++++++++++++++++----------------
2 files changed, 31 insertions(+), 18 deletions(-)
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index e30c28f..8524c9f 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,10 @@
+2009-10-19 James TD Smith <ahktenzero@mohorovi.cc>
+
+ * lisp/org-registry.el (org-registry-assoc-all): Stop this from
+ deleting the links it finds from the registry.
+ (org-registry-find-all): Add a new function which returns all
+ registry entries which satisfy a test function.
+
2009-10-02 Carsten Dominik <carsten.dominik@gmail.com>
* lisp/org-special-blocks.el (org-special-blocks-ignore-regexp):
@@ -284,5 +291,3 @@
* lisp/org-irc.el: New file.
* ChangeLog: New file.
-
-
diff --git a/contrib/lisp/org-registry.el b/contrib/lisp/org-registry.el
index f8d3d61..01b2fc8 100644
--- a/contrib/lisp/org-registry.el
+++ b/contrib/lisp/org-registry.el
@@ -39,25 +39,25 @@
;;
;; This is were org-registry comes in handy.
;;
-;; M-x org-registry-show will tell you the name of the file
+;; M-x org-registry-show will tell you the name of the file
;; C-u M-x org-registry-show will directly jump to the file
;;
-;; In case there are several files where the link lives in:
+;; In case there are several files where the link lives in:
;;
;; M-x org-registry-show will display them in a new window
;; C-u M-x org-registry-show will prompt for a file to visit
;;
;; Add this to your Org configuration:
-;;
+;;
;; (require 'org-registry)
;; (org-registry-initialize)
;;
;; If you want to update the registry with newly inserted links in the
;; current buffer: M-x org-registry-update
-;;
+;;
;; If you want this job to be done each time you save an Org buffer,
;; hook 'org-registry-update to the local 'after-save-hook in org-mode:
-;;
+;;
;; (org-registry-insinuate)
;;; Code:
@@ -94,7 +94,7 @@ buffer."
(match-string-no-properties 1 blink)))
(desc (or (and (string-match org-bracket-link-regexp blink)
(match-string-no-properties 3 blink)) "No description"))
- (files (org-registry-assoc-all link))
+ (files (org-registry-assoc-all link))
file point selection tmphist)
(cond ((and files visit)
;; result(s) to visit
@@ -103,7 +103,7 @@ buffer."
(setq tmphist (mapcar (lambda(entry)
(format "%s (%d) [%s]"
(nth 3 entry) ; file
- (nth 2 entry) ; point
+ (nth 2 entry) ; point
(nth 1 entry))) files))
(setq selection (completing-read "File: " tmphist
nil t nil 'tmphist))
@@ -123,7 +123,7 @@ buffer."
;; result(s) to display
(cond ((eq 1 (length files))
;; show one file
- (message "Link in file %s (%d) [%s]"
+ (message "Link in file %s (%d) [%s]"
(nth 3 (car files))
(nth 2 (car files))
(nth 1 (car files))))
@@ -132,25 +132,33 @@ buffer."
(defun org-registry-display-files (files link)
"Display files in a separate window."
- (switch-to-buffer-other-window
+ (switch-to-buffer-other-window
(get-buffer-create " *Org registry info*"))
(erase-buffer)
(insert (format "Files pointing to %s:\n\n" link))
(let (file)
(while (setq file (pop files))
- (insert (format "%s (%d) [%s]\n" (nth 3 file)
+ (insert (format "%s (%d) [%s]\n" (nth 3 file)
(nth 2 file) (nth 1 file)))))
(shrink-window-if-larger-than-buffer)
(other-window 1))
(defun org-registry-assoc-all (link &optional registry)
"Return all associated entries of LINK in the registry."
- (let ((reg (or org-registry-alist registry)) entry output)
+ (let ((reg (copy-list (or org-registry-alist registry))) entry output)
(while (setq entry (assoc link reg))
(add-to-list 'output entry)
(setq reg (delete entry reg)))
(nreverse output)))
+(defun org-registry-find-all (test &optional registry)
+ "Return all entries satisfying `test' in the registry."
+ (let ((reg (copy-list (or org-registry-alist registry))) entry output)
+ (while (setq entry (find-if test reg))
+ (add-to-list 'output entry)
+ (setq reg (delete entry reg)))
+ (nreverse output)))
+
;;;###autoload
(defun org-registry-visit ()
"If an Org file contains a link to the current location, visit
@@ -160,7 +168,7 @@ this file."
;;;###autoload
(defun org-registry-initialize (&optional from-scratch)
- "Initialize `org-registry-alist'.
+ "Initialize `org-registry-alist'.
If FROM-SCRATCH is non-nil or the registry does not exist yet,
create a new registry from scratch and eval it. If the registry
exists, eval `org-registry-file' and make it the new value for
@@ -174,7 +182,7 @@ exists, eval `org-registry-file' and make it the new value for
(mapc (lambda (entry)
(add-to-list 'org-registry-alist entry))
(org-registry-get-entries file)))
- (when from-scratch
+ (when from-scratch
(org-registry-create org-registry-alist)))
;; eval the registry file
(with-temp-buffer
@@ -186,8 +194,8 @@ exists, eval `org-registry-file' and make it the new value for
"Call `org-registry-update' after saving in Org-mode.
Use with caution. This could slow down things a bit."
(interactive)
- (add-hook 'org-mode-hook
- (lambda() (add-hook 'after-save-hook
+ (add-hook 'org-mode-hook
+ (lambda() (add-hook 'after-save-hook
'org-registry-update t t))))
(defun org-registry-get-entries (file)
@@ -231,7 +239,7 @@ Use with caution. This could slow down things a bit."
(re-search-forward "^(\"" nil t)
(goto-char (match-beginning 0))
(mapc (lambda (elem)
- (insert (with-output-to-string (prin1 elem)) "\n"))
+ (insert (with-output-to-string (prin1 elem)) "\n"))
new-entries)
(save-buffer)
(kill-buffer (current-buffer)))
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] Add a missing entry, and fix some formatting in the changelog.
2009-10-20 2:51 ` [PATCH 1/3] Add a missing entry, and fix some formatting in the changelog James TD Smith
2009-10-20 2:51 ` [PATCH 2/3] Add a way to display names for tag groups in fast tag selection James TD Smith
@ 2009-10-21 8:39 ` Carsten Dominik
1 sibling, 0 replies; 9+ messages in thread
From: Carsten Dominik @ 2009-10-21 8:39 UTC (permalink / raw)
To: James TD Smith; +Cc: emacs-orgmode
Applied, thanks
- Carsten
On Oct 20, 2009, at 4:51 AM, James TD Smith wrote:
> ---
> lisp/ChangeLog | 19 ++++---------------
> 1 files changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index 822bd57..47b44cd 100755
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -983,21 +983,10 @@
> * org-remember.el (org-remember-finalize): Avoid buffer-modified
> messages.
>
> +2009-08-06 James TD Smith <ahktenzero@mohorovi.cc>
>
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> + * org-plot.el (org-plot/gnuplot): Stop datafile from being deleted
> + before gnuplot can read it.
>
> 2009-08-05 Carsten Dominik <carsten.dominik@gmail.com>
>
> @@ -5455,7 +5444,7 @@
> (org-clock-special-range): Also undertand yesterday, lastweek etc.
>
> 2008-06-18 Glenn Morris <rgm@gnu.org>
> - * org.el (org-map-entries): Let-bind `file'.
> + * org.el (org-map-entries): Let-bind `file'.
>
> 2008-06-19 Carsten Dominik <dominik@science.uva.nl>
>
> --
> 1.6.3.3
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] Add a way to display names for tag groups in fast tag selection.
2009-10-20 2:51 ` [PATCH 2/3] Add a way to display names for tag groups in fast tag selection James TD Smith
2009-10-20 2:51 ` [PATCH 3/3] Some small fixes in org-registry James TD Smith
@ 2009-10-21 8:43 ` Carsten Dominik
1 sibling, 0 replies; 9+ messages in thread
From: Carsten Dominik @ 2009-10-21 8:43 UTC (permalink / raw)
To: James TD Smith; +Cc: emacs-orgmode
Applied, thanks.
- Carsten
On Oct 20, 2009, at 4:51 AM, James TD Smith wrote:
> If the nil term in the start or end group cells are replaced by
> strings, these
> are displayed before or after the brackets for the group.
> ---
> lisp/ChangeLog | 6 ++++++
> lisp/org.el | 12 ++++++------
> 2 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index 47b44cd..83af7a4 100755
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -29,6 +29,12 @@
> (org-mobile-create-index-file): Sort the files to be listed in
> index.org.
>
> +2009-10-17 James TD Smith <ahktenzero@mohorovi.cc>
> +
> + * org.el (org-fast-tag-selection): Add a way to display a
> + description for a tag group. This is done by adding a string to
> + either the startgroup or endgroup cell.
> +
> 2009-10-17 Carsten Dominik <carsten.dominik@gmail.com>
>
> * org-clock.el (org-clock-resolve, org-resolve-clocks)
> diff --git a/lisp/org.el b/lisp/org.el
> index a394443..3f8bbee 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -11542,15 +11542,15 @@ Returns the new tags string, or nil to not
> change the current settings."
> (setq tbl fulltable char ?a cnt 0)
> (while (setq e (pop tbl))
> (cond
> - ((equal e '(:startgroup))
> + ((equal (car e) :startgroup)
> (push '() groups) (setq ingroup t)
> (when (not (= cnt 0))
> (setq cnt 0)
> (insert "\n"))
> - (insert "{ "))
> - ((equal e '(:endgroup))
> + (insert (if (cdr e) (format "%s: " (cdr e)) "") "{ "))
> + ((equal (car e) :endgroup)
> (setq ingroup nil cnt 0)
> - (insert "}\n"))
> + (insert "}" (if (cdr e) (format " (%s) " (cdr e)) "") "\n"))
> ((equal e '(:newline))
> (when (not (= cnt 0))
> (setq cnt 0)
> @@ -11595,8 +11595,8 @@ Returns the new tags string, or nil to not
> change the current settings."
> (setq rtn
> (catch 'exit
> (while t
> - (message "[a-z..]:Toggle [SPC]:clear [RET]:accept [TAB]:free%s%s"
> - (if groups " [!] no groups" " [!]groups")
> + (message "[a-z..]:Toggle [SPC]:clear [RET]:accept [TAB]:free [!]
> %sgroups%s"
> + (if (not groups) "no " "")
> (if expert " [C-c]:window" (if exit-after-next " [C-c]:single"
> " [C-c]:multi")))
> (setq c (let ((inhibit-quit t)) (read-char-exclusive)))
> (cond
> --
> 1.6.3.3
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] Some small fixes in org-registry.
2009-10-20 2:51 ` [PATCH 3/3] Some small fixes in org-registry James TD Smith
@ 2009-10-21 8:43 ` Carsten Dominik
2009-10-21 23:47 ` Andreas Burtzlaff
0 siblings, 1 reply; 9+ messages in thread
From: Carsten Dominik @ 2009-10-21 8:43 UTC (permalink / raw)
To: James TD Smith; +Cc: emacs-orgmode
Applied, thanks.
- Carsten
On Oct 20, 2009, at 4:51 AM, James TD Smith wrote:
> org-registry-assoc-all removed matching links from the registry.
> This meant
> subsequent calls with the same parameters would return nothing.
>
> Add another function for finding entries in the register, which used
> find-if to
> get entries satisfying a predicate.
> ---
> contrib/ChangeLog | 9 +++++++--
> contrib/lisp/org-registry.el | 40 +++++++++++++++++++++++
> +----------------
> 2 files changed, 31 insertions(+), 18 deletions(-)
>
> diff --git a/contrib/ChangeLog b/contrib/ChangeLog
> index e30c28f..8524c9f 100644
> --- a/contrib/ChangeLog
> +++ b/contrib/ChangeLog
> @@ -1,3 +1,10 @@
> +2009-10-19 James TD Smith <ahktenzero@mohorovi.cc>
> +
> + * lisp/org-registry.el (org-registry-assoc-all): Stop this from
> + deleting the links it finds from the registry.
> + (org-registry-find-all): Add a new function which returns all
> + registry entries which satisfy a test function.
> +
> 2009-10-02 Carsten Dominik <carsten.dominik@gmail.com>
>
> * lisp/org-special-blocks.el (org-special-blocks-ignore-regexp):
> @@ -284,5 +291,3 @@
> * lisp/org-irc.el: New file.
>
> * ChangeLog: New file.
> -
> -
> diff --git a/contrib/lisp/org-registry.el b/contrib/lisp/org-
> registry.el
> index f8d3d61..01b2fc8 100644
> --- a/contrib/lisp/org-registry.el
> +++ b/contrib/lisp/org-registry.el
> @@ -39,25 +39,25 @@
> ;;
> ;; This is were org-registry comes in handy.
> ;;
> -;; M-x org-registry-show will tell you the name of the file
> +;; M-x org-registry-show will tell you the name of the file
> ;; C-u M-x org-registry-show will directly jump to the file
> ;;
> -;; In case there are several files where the link lives in:
> +;; In case there are several files where the link lives in:
> ;;
> ;; M-x org-registry-show will display them in a new window
> ;; C-u M-x org-registry-show will prompt for a file to visit
> ;;
> ;; Add this to your Org configuration:
> -;;
> +;;
> ;; (require 'org-registry)
> ;; (org-registry-initialize)
> ;;
> ;; If you want to update the registry with newly inserted links in the
> ;; current buffer: M-x org-registry-update
> -;;
> +;;
> ;; If you want this job to be done each time you save an Org buffer,
> ;; hook 'org-registry-update to the local 'after-save-hook in org-
> mode:
> -;;
> +;;
> ;; (org-registry-insinuate)
>
> ;;; Code:
> @@ -94,7 +94,7 @@ buffer."
> (match-string-no-properties 1 blink)))
> (desc (or (and (string-match org-bracket-link-regexp blink)
> (match-string-no-properties 3 blink)) "No description"))
> - (files (org-registry-assoc-all link))
> + (files (org-registry-assoc-all link))
> file point selection tmphist)
> (cond ((and files visit)
> ;; result(s) to visit
> @@ -103,7 +103,7 @@ buffer."
> (setq tmphist (mapcar (lambda(entry)
> (format "%s (%d) [%s]"
> (nth 3 entry) ; file
> - (nth 2 entry) ; point
> + (nth 2 entry) ; point
> (nth 1 entry))) files))
> (setq selection (completing-read "File: " tmphist
> nil t nil 'tmphist))
> @@ -123,7 +123,7 @@ buffer."
> ;; result(s) to display
> (cond ((eq 1 (length files))
> ;; show one file
> - (message "Link in file %s (%d) [%s]"
> + (message "Link in file %s (%d) [%s]"
> (nth 3 (car files))
> (nth 2 (car files))
> (nth 1 (car files))))
> @@ -132,25 +132,33 @@ buffer."
>
> (defun org-registry-display-files (files link)
> "Display files in a separate window."
> - (switch-to-buffer-other-window
> + (switch-to-buffer-other-window
> (get-buffer-create " *Org registry info*"))
> (erase-buffer)
> (insert (format "Files pointing to %s:\n\n" link))
> (let (file)
> (while (setq file (pop files))
> - (insert (format "%s (%d) [%s]\n" (nth 3 file)
> + (insert (format "%s (%d) [%s]\n" (nth 3 file)
> (nth 2 file) (nth 1 file)))))
> (shrink-window-if-larger-than-buffer)
> (other-window 1))
>
> (defun org-registry-assoc-all (link &optional registry)
> "Return all associated entries of LINK in the registry."
> - (let ((reg (or org-registry-alist registry)) entry output)
> + (let ((reg (copy-list (or org-registry-alist registry))) entry
> output)
> (while (setq entry (assoc link reg))
> (add-to-list 'output entry)
> (setq reg (delete entry reg)))
> (nreverse output)))
>
> +(defun org-registry-find-all (test &optional registry)
> + "Return all entries satisfying `test' in the registry."
> + (let ((reg (copy-list (or org-registry-alist registry))) entry
> output)
> + (while (setq entry (find-if test reg))
> + (add-to-list 'output entry)
> + (setq reg (delete entry reg)))
> + (nreverse output)))
> +
> ;;;###autoload
> (defun org-registry-visit ()
> "If an Org file contains a link to the current location, visit
> @@ -160,7 +168,7 @@ this file."
>
> ;;;###autoload
> (defun org-registry-initialize (&optional from-scratch)
> - "Initialize `org-registry-alist'.
> + "Initialize `org-registry-alist'.
> If FROM-SCRATCH is non-nil or the registry does not exist yet,
> create a new registry from scratch and eval it. If the registry
> exists, eval `org-registry-file' and make it the new value for
> @@ -174,7 +182,7 @@ exists, eval `org-registry-file' and make it the
> new value for
> (mapc (lambda (entry)
> (add-to-list 'org-registry-alist entry))
> (org-registry-get-entries file)))
> - (when from-scratch
> + (when from-scratch
> (org-registry-create org-registry-alist)))
> ;; eval the registry file
> (with-temp-buffer
> @@ -186,8 +194,8 @@ exists, eval `org-registry-file' and make it the
> new value for
> "Call `org-registry-update' after saving in Org-mode.
> Use with caution. This could slow down things a bit."
> (interactive)
> - (add-hook 'org-mode-hook
> - (lambda() (add-hook 'after-save-hook
> + (add-hook 'org-mode-hook
> + (lambda() (add-hook 'after-save-hook
> 'org-registry-update t t))))
>
> (defun org-registry-get-entries (file)
> @@ -231,7 +239,7 @@ Use with caution. This could slow down things a
> bit."
> (re-search-forward "^(\"" nil t)
> (goto-char (match-beginning 0))
> (mapc (lambda (elem)
> - (insert (with-output-to-string (prin1 elem)) "\n"))
> + (insert (with-output-to-string (prin1 elem)) "\n"))
> new-entries)
> (save-buffer)
> (kill-buffer (current-buffer)))
> --
> 1.6.3.3
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] Some small fixes in org-registry.
2009-10-21 8:43 ` Carsten Dominik
@ 2009-10-21 23:47 ` Andreas Burtzlaff
2009-10-22 13:24 ` Carsten Dominik
0 siblings, 1 reply; 9+ messages in thread
From: Andreas Burtzlaff @ 2009-10-21 23:47 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode
Here's a clean rewrite of org-registry-assoc-all and
org-registry-find-all that also fixes a small bug:
---
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 8524c9f..313fc74 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-22 Andreas Burtzlaff <andy13@gmx.net>
+
+ * lisp/org-registry.el (org-registry-assoc-all): Clean rewrite
+ (org-org-registry-find-all): Clean rewrite
+
2009-10-19 James TD Smith <ahktenzero@mohorovi.cc>
* lisp/org-registry.el (org-registry-assoc-all): Stop this from
diff --git a/contrib/lisp/org-registry.el b/contrib/lisp/org-registry.el
index 01b2fc8..ad382f0 100644
--- a/contrib/lisp/org-registry.el
+++ b/contrib/lisp/org-registry.el
@@ -145,19 +145,16 @@ buffer."
(defun org-registry-assoc-all (link &optional registry)
"Return all associated entries of LINK in the registry."
- (let ((reg (copy-list (or org-registry-alist registry))) entry
output)
- (while (setq entry (assoc link reg))
- (add-to-list 'output entry)
- (setq reg (delete entry reg)))
- (nreverse output)))
+ (org-registry-find-all
+ (lambda (entry) (string= link (car entry)))
+ registry))
(defun org-registry-find-all (test &optional registry)
"Return all entries satisfying `test' in the registry."
- (let ((reg (copy-list (or org-registry-alist registry))) entry
output)
- (while (setq entry (find-if test reg))
- (add-to-list 'output entry)
- (setq reg (delete entry reg)))
- (nreverse output)))
+ (delq nil
+ (mapcar
+ (lambda (x) (and (funcall test x) x))
+ (or registry org-registry-alist))))
;;;###autoload
(defun org-registry-visit ()
---
On Wed, 21 Oct 2009 10:43:13 +0200
Carsten Dominik <carsten.dominik@gmail.com> wrote:
> Applied, thanks.
>
> - Carsten
>
> On Oct 20, 2009, at 4:51 AM, James TD Smith wrote:
>
> > org-registry-assoc-all removed matching links from the registry.
> > This meant
> > subsequent calls with the same parameters would return nothing.
> >
> > Add another function for finding entries in the register, which used
> > find-if to
> > get entries satisfying a predicate.
> > ---
> > contrib/ChangeLog | 9 +++++++--
> > contrib/lisp/org-registry.el | 40 +++++++++++++++++++++++
> > +----------------
> > 2 files changed, 31 insertions(+), 18 deletions(-)
> >
> > diff --git a/contrib/ChangeLog b/contrib/ChangeLog
> > index e30c28f..8524c9f 100644
> > --- a/contrib/ChangeLog
> > +++ b/contrib/ChangeLog
> > @@ -1,3 +1,10 @@
> > +2009-10-19 James TD Smith <ahktenzero@mohorovi.cc>
> > +
> > + * lisp/org-registry.el (org-registry-assoc-all): Stop this from
> > + deleting the links it finds from the registry.
> > + (org-registry-find-all): Add a new function which returns all
> > + registry entries which satisfy a test function.
> > +
> > 2009-10-02 Carsten Dominik <carsten.dominik@gmail.com>
> >
> > * lisp/org-special-blocks.el (org-special-blocks-ignore-regexp):
> > @@ -284,5 +291,3 @@
> > * lisp/org-irc.el: New file.
> >
> > * ChangeLog: New file.
> > -
> > -
> > diff --git a/contrib/lisp/org-registry.el b/contrib/lisp/org-
> > registry.el
> > index f8d3d61..01b2fc8 100644
> > --- a/contrib/lisp/org-registry.el
> > +++ b/contrib/lisp/org-registry.el
> > @@ -39,25 +39,25 @@
> > ;;
> > ;; This is were org-registry comes in handy.
> > ;;
> > -;; M-x org-registry-show will tell you the name of the file
> > +;; M-x org-registry-show will tell you the name of the file
> > ;; C-u M-x org-registry-show will directly jump to the file
> > ;;
> > -;; In case there are several files where the link lives in:
> > +;; In case there are several files where the link lives in:
> > ;;
> > ;; M-x org-registry-show will display them in a new window
> > ;; C-u M-x org-registry-show will prompt for a file to visit
> > ;;
> > ;; Add this to your Org configuration:
> > -;;
> > +;;
> > ;; (require 'org-registry)
> > ;; (org-registry-initialize)
> > ;;
> > ;; If you want to update the registry with newly inserted links in the
> > ;; current buffer: M-x org-registry-update
> > -;;
> > +;;
> > ;; If you want this job to be done each time you save an Org buffer,
> > ;; hook 'org-registry-update to the local 'after-save-hook in org-
> > mode:
> > -;;
> > +;;
> > ;; (org-registry-insinuate)
> >
> > ;;; Code:
> > @@ -94,7 +94,7 @@ buffer."
> > (match-string-no-properties 1 blink)))
> > (desc (or (and (string-match org-bracket-link-regexp blink)
> > (match-string-no-properties 3 blink)) "No description"))
> > - (files (org-registry-assoc-all link))
> > + (files (org-registry-assoc-all link))
> > file point selection tmphist)
> > (cond ((and files visit)
> > ;; result(s) to visit
> > @@ -103,7 +103,7 @@ buffer."
> > (setq tmphist (mapcar (lambda(entry)
> > (format "%s (%d) [%s]"
> > (nth 3 entry) ; file
> > - (nth 2 entry) ; point
> > + (nth 2 entry) ; point
> > (nth 1 entry))) files))
> > (setq selection (completing-read "File: " tmphist
> > nil t nil 'tmphist))
> > @@ -123,7 +123,7 @@ buffer."
> > ;; result(s) to display
> > (cond ((eq 1 (length files))
> > ;; show one file
> > - (message "Link in file %s (%d) [%s]"
> > + (message "Link in file %s (%d) [%s]"
> > (nth 3 (car files))
> > (nth 2 (car files))
> > (nth 1 (car files))))
> > @@ -132,25 +132,33 @@ buffer."
> >
> > (defun org-registry-display-files (files link)
> > "Display files in a separate window."
> > - (switch-to-buffer-other-window
> > + (switch-to-buffer-other-window
> > (get-buffer-create " *Org registry info*"))
> > (erase-buffer)
> > (insert (format "Files pointing to %s:\n\n" link))
> > (let (file)
> > (while (setq file (pop files))
> > - (insert (format "%s (%d) [%s]\n" (nth 3 file)
> > + (insert (format "%s (%d) [%s]\n" (nth 3 file)
> > (nth 2 file) (nth 1 file)))))
> > (shrink-window-if-larger-than-buffer)
> > (other-window 1))
> >
> > (defun org-registry-assoc-all (link &optional registry)
> > "Return all associated entries of LINK in the registry."
> > - (let ((reg (or org-registry-alist registry)) entry output)
> > + (let ((reg (copy-list (or org-registry-alist registry))) entry
> > output)
> > (while (setq entry (assoc link reg))
> > (add-to-list 'output entry)
> > (setq reg (delete entry reg)))
> > (nreverse output)))
> >
> > +(defun org-registry-find-all (test &optional registry)
> > + "Return all entries satisfying `test' in the registry."
> > + (let ((reg (copy-list (or org-registry-alist registry))) entry
> > output)
> > + (while (setq entry (find-if test reg))
> > + (add-to-list 'output entry)
> > + (setq reg (delete entry reg)))
> > + (nreverse output)))
> > +
> > ;;;###autoload
> > (defun org-registry-visit ()
> > "If an Org file contains a link to the current location, visit
> > @@ -160,7 +168,7 @@ this file."
> >
> > ;;;###autoload
> > (defun org-registry-initialize (&optional from-scratch)
> > - "Initialize `org-registry-alist'.
> > + "Initialize `org-registry-alist'.
> > If FROM-SCRATCH is non-nil or the registry does not exist yet,
> > create a new registry from scratch and eval it. If the registry
> > exists, eval `org-registry-file' and make it the new value for
> > @@ -174,7 +182,7 @@ exists, eval `org-registry-file' and make it the
> > new value for
> > (mapc (lambda (entry)
> > (add-to-list 'org-registry-alist entry))
> > (org-registry-get-entries file)))
> > - (when from-scratch
> > + (when from-scratch
> > (org-registry-create org-registry-alist)))
> > ;; eval the registry file
> > (with-temp-buffer
> > @@ -186,8 +194,8 @@ exists, eval `org-registry-file' and make it the
> > new value for
> > "Call `org-registry-update' after saving in Org-mode.
> > Use with caution. This could slow down things a bit."
> > (interactive)
> > - (add-hook 'org-mode-hook
> > - (lambda() (add-hook 'after-save-hook
> > + (add-hook 'org-mode-hook
> > + (lambda() (add-hook 'after-save-hook
> > 'org-registry-update t t))))
> >
> > (defun org-registry-get-entries (file)
> > @@ -231,7 +239,7 @@ Use with caution. This could slow down things a
> > bit."
> > (re-search-forward "^(\"" nil t)
> > (goto-char (match-beginning 0))
> > (mapc (lambda (elem)
> > - (insert (with-output-to-string (prin1 elem)) "\n"))
> > + (insert (with-output-to-string (prin1 elem)) "\n"))
> > new-entries)
> > (save-buffer)
> > (kill-buffer (current-buffer)))
> > --
> > 1.6.3.3
> >
> >
> >
> > _______________________________________________
> > Emacs-orgmode mailing list
> > Remember: use `Reply All' to send replies to the list.
> > Emacs-orgmode@gnu.org
> > http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> - Carsten
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] Some small fixes in org-registry.
2009-10-21 23:47 ` Andreas Burtzlaff
@ 2009-10-22 13:24 ` Carsten Dominik
0 siblings, 0 replies; 9+ messages in thread
From: Carsten Dominik @ 2009-10-22 13:24 UTC (permalink / raw)
To: Andreas Burtzlaff; +Cc: emacs-orgmode
Applied, thanks.
- Carsten
On Oct 22, 2009, at 1:47 AM, Andreas Burtzlaff wrote:
>
> Here's a clean rewrite of org-registry-assoc-all and
> org-registry-find-all that also fixes a small bug:
>
> ---
> diff --git a/contrib/ChangeLog b/contrib/ChangeLog
> index 8524c9f..313fc74 100644
> --- a/contrib/ChangeLog
> +++ b/contrib/ChangeLog
> @@ -1,3 +1,8 @@
> +2009-10-22 Andreas Burtzlaff <andy13@gmx.net>
> +
> + * lisp/org-registry.el (org-registry-assoc-all): Clean rewrite
> + (org-org-registry-find-all): Clean rewrite
> +
> 2009-10-19 James TD Smith <ahktenzero@mohorovi.cc>
>
> * lisp/org-registry.el (org-registry-assoc-all): Stop this from
> diff --git a/contrib/lisp/org-registry.el b/contrib/lisp/org-
> registry.el
> index 01b2fc8..ad382f0 100644
> --- a/contrib/lisp/org-registry.el
> +++ b/contrib/lisp/org-registry.el
> @@ -145,19 +145,16 @@ buffer."
>
> (defun org-registry-assoc-all (link &optional registry)
> "Return all associated entries of LINK in the registry."
> - (let ((reg (copy-list (or org-registry-alist registry))) entry
> output)
> - (while (setq entry (assoc link reg))
> - (add-to-list 'output entry)
> - (setq reg (delete entry reg)))
> - (nreverse output)))
> + (org-registry-find-all
> + (lambda (entry) (string= link (car entry)))
> + registry))
>
> (defun org-registry-find-all (test &optional registry)
> "Return all entries satisfying `test' in the registry."
> - (let ((reg (copy-list (or org-registry-alist registry))) entry
> output)
> - (while (setq entry (find-if test reg))
> - (add-to-list 'output entry)
> - (setq reg (delete entry reg)))
> - (nreverse output)))
> + (delq nil
> + (mapcar
> + (lambda (x) (and (funcall test x) x))
> + (or registry org-registry-alist))))
>
> ;;;###autoload
> (defun org-registry-visit ()
> ---
>
> On Wed, 21 Oct 2009 10:43:13 +0200
> Carsten Dominik <carsten.dominik@gmail.com> wrote:
>
>> Applied, thanks.
>>
>> - Carsten
>>
>> On Oct 20, 2009, at 4:51 AM, James TD Smith wrote:
>>
>>> org-registry-assoc-all removed matching links from the registry.
>>> This meant
>>> subsequent calls with the same parameters would return nothing.
>>>
>>> Add another function for finding entries in the register, which used
>>> find-if to
>>> get entries satisfying a predicate.
>>> ---
>>> contrib/ChangeLog | 9 +++++++--
>>> contrib/lisp/org-registry.el | 40 +++++++++++++++++++++++
>>> +----------------
>>> 2 files changed, 31 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/contrib/ChangeLog b/contrib/ChangeLog
>>> index e30c28f..8524c9f 100644
>>> --- a/contrib/ChangeLog
>>> +++ b/contrib/ChangeLog
>>> @@ -1,3 +1,10 @@
>>> +2009-10-19 James TD Smith <ahktenzero@mohorovi.cc>
>>> +
>>> + * lisp/org-registry.el (org-registry-assoc-all): Stop this from
>>> + deleting the links it finds from the registry.
>>> + (org-registry-find-all): Add a new function which returns all
>>> + registry entries which satisfy a test function.
>>> +
>>> 2009-10-02 Carsten Dominik <carsten.dominik@gmail.com>
>>>
>>> * lisp/org-special-blocks.el (org-special-blocks-ignore-regexp):
>>> @@ -284,5 +291,3 @@
>>> * lisp/org-irc.el: New file.
>>>
>>> * ChangeLog: New file.
>>> -
>>> -
>>> diff --git a/contrib/lisp/org-registry.el b/contrib/lisp/org-
>>> registry.el
>>> index f8d3d61..01b2fc8 100644
>>> --- a/contrib/lisp/org-registry.el
>>> +++ b/contrib/lisp/org-registry.el
>>> @@ -39,25 +39,25 @@
>>> ;;
>>> ;; This is were org-registry comes in handy.
>>> ;;
>>> -;; M-x org-registry-show will tell you the name of the file
>>> +;; M-x org-registry-show will tell you the name of the file
>>> ;; C-u M-x org-registry-show will directly jump to the file
>>> ;;
>>> -;; In case there are several files where the link lives in:
>>> +;; In case there are several files where the link lives in:
>>> ;;
>>> ;; M-x org-registry-show will display them in a new window
>>> ;; C-u M-x org-registry-show will prompt for a file to visit
>>> ;;
>>> ;; Add this to your Org configuration:
>>> -;;
>>> +;;
>>> ;; (require 'org-registry)
>>> ;; (org-registry-initialize)
>>> ;;
>>> ;; If you want to update the registry with newly inserted links in
>>> the
>>> ;; current buffer: M-x org-registry-update
>>> -;;
>>> +;;
>>> ;; If you want this job to be done each time you save an Org buffer,
>>> ;; hook 'org-registry-update to the local 'after-save-hook in org-
>>> mode:
>>> -;;
>>> +;;
>>> ;; (org-registry-insinuate)
>>>
>>> ;;; Code:
>>> @@ -94,7 +94,7 @@ buffer."
>>> (match-string-no-properties 1 blink)))
>>> (desc (or (and (string-match org-bracket-link-regexp blink)
>>> (match-string-no-properties 3 blink)) "No description"))
>>> - (files (org-registry-assoc-all link))
>>> + (files (org-registry-assoc-all link))
>>> file point selection tmphist)
>>> (cond ((and files visit)
>>> ;; result(s) to visit
>>> @@ -103,7 +103,7 @@ buffer."
>>> (setq tmphist (mapcar (lambda(entry)
>>> (format "%s (%d) [%s]"
>>> (nth 3 entry) ; file
>>> - (nth 2 entry) ; point
>>> + (nth 2 entry) ; point
>>> (nth 1 entry))) files))
>>> (setq selection (completing-read "File: " tmphist
>>> nil t nil 'tmphist))
>>> @@ -123,7 +123,7 @@ buffer."
>>> ;; result(s) to display
>>> (cond ((eq 1 (length files))
>>> ;; show one file
>>> - (message "Link in file %s (%d) [%s]"
>>> + (message "Link in file %s (%d) [%s]"
>>> (nth 3 (car files))
>>> (nth 2 (car files))
>>> (nth 1 (car files))))
>>> @@ -132,25 +132,33 @@ buffer."
>>>
>>> (defun org-registry-display-files (files link)
>>> "Display files in a separate window."
>>> - (switch-to-buffer-other-window
>>> + (switch-to-buffer-other-window
>>> (get-buffer-create " *Org registry info*"))
>>> (erase-buffer)
>>> (insert (format "Files pointing to %s:\n\n" link))
>>> (let (file)
>>> (while (setq file (pop files))
>>> - (insert (format "%s (%d) [%s]\n" (nth 3 file)
>>> + (insert (format "%s (%d) [%s]\n" (nth 3 file)
>>> (nth 2 file) (nth 1 file)))))
>>> (shrink-window-if-larger-than-buffer)
>>> (other-window 1))
>>>
>>> (defun org-registry-assoc-all (link &optional registry)
>>> "Return all associated entries of LINK in the registry."
>>> - (let ((reg (or org-registry-alist registry)) entry output)
>>> + (let ((reg (copy-list (or org-registry-alist registry))) entry
>>> output)
>>> (while (setq entry (assoc link reg))
>>> (add-to-list 'output entry)
>>> (setq reg (delete entry reg)))
>>> (nreverse output)))
>>>
>>> +(defun org-registry-find-all (test &optional registry)
>>> + "Return all entries satisfying `test' in the registry."
>>> + (let ((reg (copy-list (or org-registry-alist registry))) entry
>>> output)
>>> + (while (setq entry (find-if test reg))
>>> + (add-to-list 'output entry)
>>> + (setq reg (delete entry reg)))
>>> + (nreverse output)))
>>> +
>>> ;;;###autoload
>>> (defun org-registry-visit ()
>>> "If an Org file contains a link to the current location, visit
>>> @@ -160,7 +168,7 @@ this file."
>>>
>>> ;;;###autoload
>>> (defun org-registry-initialize (&optional from-scratch)
>>> - "Initialize `org-registry-alist'.
>>> + "Initialize `org-registry-alist'.
>>> If FROM-SCRATCH is non-nil or the registry does not exist yet,
>>> create a new registry from scratch and eval it. If the registry
>>> exists, eval `org-registry-file' and make it the new value for
>>> @@ -174,7 +182,7 @@ exists, eval `org-registry-file' and make it the
>>> new value for
>>> (mapc (lambda (entry)
>>> (add-to-list 'org-registry-alist entry))
>>> (org-registry-get-entries file)))
>>> - (when from-scratch
>>> + (when from-scratch
>>> (org-registry-create org-registry-alist)))
>>> ;; eval the registry file
>>> (with-temp-buffer
>>> @@ -186,8 +194,8 @@ exists, eval `org-registry-file' and make it the
>>> new value for
>>> "Call `org-registry-update' after saving in Org-mode.
>>> Use with caution. This could slow down things a bit."
>>> (interactive)
>>> - (add-hook 'org-mode-hook
>>> - (lambda() (add-hook 'after-save-hook
>>> + (add-hook 'org-mode-hook
>>> + (lambda() (add-hook 'after-save-hook
>>> 'org-registry-update t t))))
>>>
>>> (defun org-registry-get-entries (file)
>>> @@ -231,7 +239,7 @@ Use with caution. This could slow down things a
>>> bit."
>>> (re-search-forward "^(\"" nil t)
>>> (goto-char (match-beginning 0))
>>> (mapc (lambda (elem)
>>> - (insert (with-output-to-string (prin1 elem)) "\n"))
>>> + (insert (with-output-to-string (prin1 elem)) "\n"))
>>> new-entries)
>>> (save-buffer)
>>> (kill-buffer (current-buffer)))
>>> --
>>> 1.6.3.3
>>>
>>>
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Remember: use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>> - Carsten
>>
>>
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-10-22 13:24 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-20 2:51 A few small patches James TD Smith
2009-10-20 2:51 ` [PATCH 1/3] Add a missing entry, and fix some formatting in the changelog James TD Smith
2009-10-20 2:51 ` [PATCH 2/3] Add a way to display names for tag groups in fast tag selection James TD Smith
2009-10-20 2:51 ` [PATCH 3/3] Some small fixes in org-registry James TD Smith
2009-10-21 8:43 ` Carsten Dominik
2009-10-21 23:47 ` Andreas Burtzlaff
2009-10-22 13:24 ` Carsten Dominik
2009-10-21 8:43 ` [PATCH 2/3] Add a way to display names for tag groups in fast tag selection Carsten Dominik
2009-10-21 8:39 ` [PATCH 1/3] Add a missing entry, and fix some formatting in the changelog Carsten Dominik
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).