Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
On Sat, Feb 12 2011, Matt Lundin wrote: I tried org-contacts with my rather large agenda files, but because it uses org-scan-tags instead of regexp searches, queries are slow. E.g., org-contacts-filter takes approximately 15-20 seconds. Yeah, it's hard to use if you contacts are accross large agenda files. It's slow. Using the anniversary code is currently impossible if you do not use a single small contact file. I plan to improve that later. Also, the function org-contacts uses a tags/property search and then a skip function. Would it perhaps be quicker to use org-search-view to match against two regexps (the name and the contacts email property)? Maybe. Anyhow I've a lot of ideas for that. Considers the current version as a quick hack. :) -- Julien Danjou ❱ http://julien.danjou.info pgpd5Xms4y0Ul.pgp Description: PGP signature ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
On Sat, Feb 12 2011, Tassilo Horn wrote: @Julien: Here's a patch for org-contacts.el which uses Stefan's suggestion to fix the completion in the case-insensitive case. Patch merged, and soon to be pushed. -- Julien Danjou ❱ http://julien.danjou.info pgp0SQsXh2iGF.pgp Description: PGP signature ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
Stefan Monnier monn...@iro.umontreal.ca writes: Hi Stefan Julien, Hm, why not simply add a property :ignore-case to the PROPS a function in `completion-at-point-functions' may return in addition to the existing :predicate and :annotation-function? That could work as well, but it's more complexity in completion-at-point, compared to completion-table-case-fold which can be added without touching any existing code. You are right. I've implemented and tested your approach, and it works just fine. Thanks a ton! @Julien: Here's a patch for org-contacts.el which uses Stefan's suggestion to fix the completion in the case-insensitive case. Bye, Tassilo --8---cut here---start-8--- From 4195d4cd3a63df06e52465e4519863ef2a7933e7 Mon Sep 17 00:00:00 2001 From: Tassilo Horn tass...@member.fsf.org Date: Sat, 12 Feb 2011 19:36:51 +0100 Subject: [PATCH] Fix case-insensitive completion --- org-contacts.el | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/org-contacts.el b/org-contacts.el index 8513117..4c99ca9 100644 --- a/org-contacts.el +++ b/org-contacts.el @@ -114,6 +114,12 @@ If both match values are nil, return all contacts. (add-to-list 'result (list (org-get-heading t) marker (org-entry-properties marker 'all))) +(when (not (fboundp 'completion-table-case-fold)) + ;; That function is new in Emacs 24... + (defun completion-table-case-fold (table string pred action) +(let ((completion-ignore-case t)) + (complete-with-action action table string pred + (defun org-contacts-complete-name (optional start) Complete text at START with a user name and email. (let* ((end (point)) @@ -167,7 +173,9 @@ If both match values are nil, return all contacts. ;; If the user has an email address, append USER EMAIL. if email collect (concat contact-name email )) , ) -(list start end completion-list))) +(list start end (if org-contacts-completion-ignore-case + (apply-partially #'completion-table-case-fold completion-list) + completion-list (defun org-contacts-message-complete-function () Function used in `completion-at-point-functions' in `message-mode'. -- 1.7.4 --8---cut here---end---8--- ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
Stefan Monnier monn...@iro.umontreal.ca writes: Hi Stefan, Typing 'a' complete to 'aA' (instead of 'Anne mailaddress') and then does nothing since aA is not valid. I'm not sure completion-at-point-functions is correctly usable in this same condition as message/bbdb completion was. The latter used to return a function which is marked as decouraged in `completion-at-point-functions' docstring. So org-contacts does not use it. OTOH, returning a (START END COLLECTION) triplet is not very usable since if you return a collection that start with a different character set than (buffer-substring start end), it does not work. I don't fully understand what you're saying, probably for lack of context, but at least it's not true that if you return a collection that start with a different character set than (buffer-substring start end), it doesn't work. That simply depends on completion-styles (and completion-ignore-case of course). I've just edebugged Juliens function, and if I try to complete To: Stefan Monnier monn...@iro.umontreal.ca, atab in this message buffer, his function returns (376 377 (#(Andreas XXX xxx@xxx.invalid 0 12 (org-category contacts fontified nil which is correct. Case didn't get accounted, and that's the only possible completion. However, what gets inserted after the a is only a TAB character. The value of `completion-styles' in the current message buffer is (basic initials partial-completion), which should be ok for that kind of completion. But the global value of completion-ignore-case is nil. So the problem seems to be that Julien's completion at point functions respects the value of his own `org-contacts-completion-ignore-case' variable when *calculating* completions, but it is not considered anymore when the completion style *applies* the completions. When I do (set (make-local-variable 'completion-ignore-case) t) in the current message buffer and try again, then atab is correctly completed to the Andreas Julien's function calculated. However, I want case insensitive completion only for contact completion in the headers, but not in the message body. So the question is: how can the completion-ignore-case value be propagated from the completion gathering function in `completion-at-point-functions' to the function that actually applies this completion, without having to modify the global or buffer local value of `completion-ignore-case'? Bye, Tassilo ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
So the question is: how can the completion-ignore-case value be propagated from the completion gathering function in `completion-at-point-functions' to the function that actually applies this completion, without having to modify the global or buffer local value of `completion-ignore-case'? Assuming you have a completion table in variable `table', you should be able to construct a new completion table that's case-insensitive with something like the untested code below: (defun completion-table-case-fold (table string pred action) (let ((completion-ignore-case t)) (complete-with-action action table string pred))) [...] (let ((newtable (apply-partially #'completion-table-case-fold table))) [...]) where completion-table-case-fold is an auxiliary function which (c|sh)ould be added to minibuffer.el. The case-sensitivity of the completion code is indeed problematic. Here's for example an excerpt from minibuffer.el: ;; - case-sensitivity currently confuses two issues: ;; - whether or not a particular completion table should be case-sensitive ;; (i.e. whether strings that differ only by case are semantically ;; equivalent) ;; - whether the user wants completion to pay attention to case. ;; e.g. we may want to make it possible for the user to say first try ;; completion case-sensitively, and if that fails, try to ignore case. Stefan ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
Stefan Monnier monn...@iro.umontreal.ca writes: Hi Stefan, So the question is: how can the completion-ignore-case value be propagated from the completion gathering function in `completion-at-point-functions' to the function that actually applies this completion, without having to modify the global or buffer local value of `completion-ignore-case'? Assuming you have a completion table in variable `table', you should be able to construct a new completion table that's case-insensitive with something like the untested code below: (defun completion-table-case-fold (table string pred action) (let ((completion-ignore-case t)) (complete-with-action action table string pred))) [...] (let ((newtable (apply-partially #'completion-table-case-fold table))) [...]) where completion-table-case-fold is an auxiliary function which (c|sh)ould be added to minibuffer.el. Hm, why not simply add a property :ignore-case to the PROPS a function in `completion-at-point-functions' may return in addition to the existing :predicate and :annotation-function? Then `completion-at-point' could simply bind `completion-ignore-case' according to that property when calling `completion-in-region'. Bye, Tassilo ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
So the question is: how can the completion-ignore-case value be propagated from the completion gathering function in `completion-at-point-functions' to the function that actually applies this completion, without having to modify the global or buffer local value of `completion-ignore-case'? Assuming you have a completion table in variable `table', you should be able to construct a new completion table that's case-insensitive with something like the untested code below: (defun completion-table-case-fold (table string pred action) (let ((completion-ignore-case t)) (complete-with-action action table string pred))) [...] (let ((newtable (apply-partially #'completion-table-case-fold table))) [...]) where completion-table-case-fold is an auxiliary function which (c|sh)ould be added to minibuffer.el. Hm, why not simply add a property :ignore-case to the PROPS a function in `completion-at-point-functions' may return in addition to the existing :predicate and :annotation-function? Then `completion-at-point' could simply bind `completion-ignore-case' according to that property when calling `completion-in-region'. That could work as well, but it's more complexity in completion-at-point, compared to completion-table-case-fold which can be added without touching any existing code. Another reason why doing it inside the completion table is right is because of the comment I quoted: in your case, it is really a property of the completion table you return, rather than some user preference that's locally overridden. For more complex cases, there is also the issue of what to do when some parts of the completion are case-sensitive and other parts aren't (e.g. completion of case-sensitive envvars in case-insensitive file names), although this is less important for completion-at-point than for minibuffer completion since you don't have to return a table that covers the completion of the whole field (composed of file names and env-vars, for example), and instead you can just limit the completion to the particular subfield. Stefan ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
On Thu, Feb 10 2011, Dan Griswold wrote: This is pretty neat. I would like to use this eventually, as bbdb exhibits some strange behaviors occasionally, and the data is kind of locked into bbdb's own peculiar format. What I would need to see before I could make org-contacts part of my workings system is an analogue to bbdb/gnus-split-method, that is, an org-contacts function that would hook into nnimap-split-rule so incoming messages could be deposited into folders based on a specific property, for example, gnus-private. Yeah, this has been already asked. I don't know this mechanism well, but I'll try to study it and implement such a thing. It shouldn't be too hard. -- Julien Danjou ❱ http://julien.danjou.info pgpKLEQg4Rmm9.pgp Description: PGP signature ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
On Thu, Feb 10 2011, Dan Davison wrote: Hi Julien, I'm using it (with gnus). Looks great and seems to work very nicely so far. One little thing: I don't seem to be getting case-insensitive completion, despite having org-contacts-completion-ignore-case set to t. Your the second one to report that to me, but it does work for me with Emacs 24 at least. -- Julien Danjou ❱ http://julien.danjou.info pgpV1ZZLhiVQf.pgp Description: PGP signature ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
On Thu, Feb 10 2011, Tassilo Horn wrote: I'm also using Emacs 24, and for me it doesn't work. Ok. Anyway I've just double checked, and it worst than that. Typing 'a' complete to 'aA' (instead of 'Anne mailaddress') and then does nothing since aA is not valid. I'm not sure completion-at-point-functions is correctly usable in this same dondition as message/bbdb completion was. The latter used to return a function which is marked as decouraged in `completion-at-point-functions' docstring. So org-contacts does not use it. OTOH, returning a (START END COLLECTION) triplet is not very usable since if you return a collection that start with a different character set than (buffer-substring start end), it does not work. (Cc'ing emacs-devel, in case someone has an advice on that.) -- Julien Danjou ❱ http://julien.danjou.info pgpthYbUUMptR.pgp Description: PGP signature ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
This is amazing; if you export as HTML, it even preserves the color-scheme from the theme! I think I need to do this: C-x C-r Read the fine org manual RET Thank you! Marcelo. On Wed, Feb 9, 2011 at 3:10 PM, Russell Adams rlad...@adamsinfoserv.com wrote: On Wed, Feb 09, 2011 at 09:43:33PM +0100, Julien Danjou wrote: On Wed, Feb 09 2011, S??bastien Vauban wrote: From skimming on the available docs, would I be right to state that the only missing *features set* (vs bbdb) is the *scanning done on the incoming mails*: detecting a new email address, asking to add it, eventually as the primary one, detecting the Organization field and storing it, parsing the X-Face and storing it, etc.? Would such features be added in the future? Or do we have to choose for the simplicity of the new format, eventually losing some minor features? Snarffing info from known contacts and adding other mail addresses email, faces, etc is planned. -- Julien Danjou ??? http://julien.danjou.info I currently have lbdb caching incoming addresses to it's own format, not Org. Then I have my contacts in Org, and I have a perl plugin for lbdb to find my Org contacts when I trigger a quick lookup from mutt. If there's interest, I'll post the relevant portions. Thanks. -- Russell Adams rlad...@adamsinfoserv.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3 ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
I'm also using Emacs 24, and for me it doesn't work. Ok. Anyway I've just double checked, and it worst than that. Typing 'a' complete to 'aA' (instead of 'Anne mailaddress') and then does nothing since aA is not valid. I'm not sure completion-at-point-functions is correctly usable in this same condition as message/bbdb completion was. The latter used to return a function which is marked as decouraged in `completion-at-point-functions' docstring. So org-contacts does not use it. OTOH, returning a (START END COLLECTION) triplet is not very usable since if you return a collection that start with a different character set than (buffer-substring start end), it does not work. I don't fully understand what you're saying, probably for lack of context, but at least it's not true that if you return a collection that start with a different character set than (buffer-substring start end), it doesn't work. That simply depends on completion-styles (and completion-ignore-case of course). Stefan ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
I can confirm, but it's flaky. For example, with the default settings, it worked (M-x org-contacts + dave = Dave). But I just changed my rule to this: |- in org-contacts.el ,- | (defcustom org-contacts-company-property Company | (defcustom org-contacts-matcher (concat org-contacts-company-property \\) `- I don't always have an email property, but I always have a :Company: property. Once I did that... the case insensitivity disappeared. I now have to be case explicit when searching (only Dave works). John On Thu, Feb 10, 2011 at 8:56 AM, Julien Danjou jul...@danjou.info wrote: On Thu, Feb 10 2011, Dan Davison wrote: Hi Julien, I'm using it (with gnus). Looks great and seems to work very nicely so far. One little thing: I don't seem to be getting case-insensitive completion, despite having org-contacts-completion-ignore-case set to t. Your the second one to report that to me, but it does work for me with Emacs 24 at least. -- Julien Danjou ❱ http://julien.danjou.info ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
On Wed, Feb 09 2011, Sébastien Vauban wrote: From skimming on the available docs, would I be right to state that the only missing *features set* (vs bbdb) is the *scanning done on the incoming mails*: detecting a new email address, asking to add it, eventually as the primary one, detecting the Organization field and storing it, parsing the X-Face and storing it, etc.? Would such features be added in the future? Or do we have to choose for the simplicity of the new format, eventually losing some minor features? Snarffing info from known contacts and adding other mail addresses email, faces, etc is planned. -- Julien Danjou ❱ http://julien.danjou.info pgpIN6v5gs085.pgp Description: PGP signature ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
On Wed, Feb 09, 2011 at 09:43:33PM +0100, Julien Danjou wrote: On Wed, Feb 09 2011, S??bastien Vauban wrote: From skimming on the available docs, would I be right to state that the only missing *features set* (vs bbdb) is the *scanning done on the incoming mails*: detecting a new email address, asking to add it, eventually as the primary one, detecting the Organization field and storing it, parsing the X-Face and storing it, etc.? Would such features be added in the future? Or do we have to choose for the simplicity of the new format, eventually losing some minor features? Snarffing info from known contacts and adding other mail addresses email, faces, etc is planned. -- Julien Danjou ??? http://julien.danjou.info I currently have lbdb caching incoming addresses to it's own format, not Org. Then I have my contacts in Org, and I have a perl plugin for lbdb to find my Org contacts when I trigger a quick lookup from mutt. If there's interest, I'll post the relevant portions. Thanks. -- Russell Adamsrlad...@adamsinfoserv.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint:1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3 ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode