emacs-helm / helm

Emacs incremental completion and selection narrowing framework
https://emacs-helm.github.io/helm/
GNU General Public License v3.0
3.37k stars 389 forks source link

Helm and BBDB creation issue #78

Closed Jiehong closed 12 years ago

Jiehong commented 12 years ago

When I use bbdb-create to create a new contact, at one point, when I need to select the address description, helm gives me the previous one I used before, which is great.

However, when I want to keep going and when I don't want to add a new address, I should type RET to continue but that select the first helm proposition… which is very annoying. I have to disable helm in order to use bbdb-create then.

I haven't found a way to disable bbdb on the run just for that proposition. Is there a way to do that that I haven't found yet?

thierryvolpiatto commented 12 years ago

Jiehong reply@reply.github.com writes:

When I use bbdb-create to create a new contact, at one point, when I need to select the address description, helm gives me the previous one I used before, which is great. I am not using anymore bbdb since long time now, so I will not be able to fix that but my guess is you are using helm-mode and you use M-x bbdb-create, right?

Why dont you use M-x helm-bbdb to use bbdb instead?

However, when I want to keep going and when I don't want to add a new address, I should type RET to continue but that select the first helm proposition… which is very annoying. I have to disable helm in order to use bbdb-create then. You mean (helm-mode -1) right?

I haven't found a way to disable bbdb on the run just for that proposition. Is there a way to do that that I haven't found yet? Maybe try to customize helm-completing-read-handlers-alist by adding a nil entry to bbdb-create i.e (bbdb-create . nil). Not sure it will work as it depend on how is written the completing-read in bbdb-create.


Reply to this email directly or view it on GitHub: https://github.com/emacs-helm/helm/issues/78

Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Jiehong commented 12 years ago

You're right about your guess. I use helm and M-x bbdb-create.

M-x helm-bbdb is nice for searching an already created contact and send him/her an email or to see his/her informations. However, if the contact does not exist, helm offers to add it to the contacts list, which is nice, but it doesn't follow bbdb-create. Indeed, it only offers a few fields, like name, company, email and notes. Whereas bbdb-create offers many address with a different IDs, phones… and birthdays since I've added it.

I have tried to change helm-c-bbdb-create-contact in my .emac file to tell it to use bbdb-create instead, but it's not taken into account, I don't know why. Here is what I've written in my .emacs after helm and BBDB initialization:

  (defun helm-c-bbdb-create-contact (actions candidate)
    "Action transformer that returns only an entry to add the
  current `helm-pattern' as new contact. All other actions are
  removed."
    (if (string= candidate "*Add to contacts*")
        '(("Add to contacts" . (lambda (actions)
                                 (bbdb-read-new-record))))
      actions))

This isn't perfect since we need to type the name again.

Anyway, I have customized helm-completing-read-handlers-alist as you offers to do by adding this to my .emacs:

(add-to-list 'helm-completing-read-handlers-alist
             '(bbdb-create . nil))

However, it doesn't work. Maybe because it's not taken into account either, and I don't know why.

I'm wondering something: I have installed helm through ELPA, but BBDB is installed locally (through my distro package system: pacman), maybe it does change something?

Jiehong commented 12 years ago

Update: As I still don't know why this functions in my .emacs aren't taken into account, I have decided to change the helm files directly.

So, if I change helm-c-bbdb-create-contact to what I posted in the last comment, helm-bbdb uses bbdb-create so it's better in a way. There are some places for improvement though.

I have also added (bbdb-create . nil) to helm-completing-read-handlers-alist in helm-mode.el, but this doesn't work, and I helm still offers me previous address IDs and there is no way to finish a contact creation…

By the way, you've mentionned that you don't use BBDB anymore, may I ask what you use now instead (if it's on Emacs)?

thierryvolpiatto commented 12 years ago

Jiehong reply@reply.github.com writes:

Update: As I still don't know why this functions in my .emacs aren't taken into account, I have decided to change the helm files directly.

So, if I change helm-c-bbdb-create-contact to what I posted in the last comment, helm-bbdb uses bbdb-create so it's better in a way. There are some places for improvement though.

I have also added (bbdb-create . nil) to helm-completing-read-handlers-alist in helm-mode.el, but this doesn't work, Can you give me an url where I can get bbdd in the same version you use. I would like to see how bbdb call completing-read', possibly it run its owncompleting-read'?

and I helm still offers me previous address IDs and there is no way to finish a contact creation…

By the way, you've mentionned that you don't use BBDB anymore, may I ask what you use now instead (if it's on Emacs)? I use my own stuff based on bookmark, it is less featured than bbdb, but enough for me. https://github.com/thierryvolpiatto/emacs-bmk-ext


Reply to this email directly or view it on GitHub: https://github.com/emacs-helm/helm/issues/78#issuecomment-6757555

Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Jiehong commented 12 years ago

I'm using BBDB 2.35 (the current stable version). You can download it directly from the official repository: http://bbdb.sourceforge.net/bbdb-2.35.tar.gz

I'll give a closer look at emacs-bmk-ext later, thanks for the link.

thierryvolpiatto commented 12 years ago

Thanks for the link I will have a look these days.

Basically emacs-bmk-ext provide:

thierryvolpiatto commented 12 years ago

@Jiehong Please have a look at these last changes. Is it ok for you?

Jiehong commented 12 years ago

I have just tried and it's a lot better to me. However, helm-bbdb, now, doesn't provide any thing in more than a simple bbdb-create.

Indeed, having a helm-buffer displaying already in use address descriptions is quite nice (Maybe for phones too?). Do you think it's possible?

thierryvolpiatto commented 12 years ago

I don't understand, actually when you enter a contact that doesn't exist, all other contacts (don't match) disapear from buffer and you end up with a buffer with add contact, so it seem impossible to add a contact already existing. For phones, I don't know what can be done.

Jiehong commented 12 years ago

I'm sorry if I wasn't clear enough. What I meant is that yes, when no contacts matches then helm-bbdb offers to create a new one, which is right, but during this creation process, when it comes to the address and phones, helm could provide a buffer in which we can select address names (like Home, Second house… names that appears in BBDB).

If you don't see what I mean, just launch bbdb-create. Here is what will be asked:

  1. Name:
  2. Company:
  3. Network address:
  4. Address description [RET when no more]: At this time, a helm buffer pops up with choices for address description. This is what I was speaking about.

helm-bbdb, when creating a new contact, doesn't provide this feature. It's also where it's a problem since this buffer doesn't provide a nil choice to leave the address description loop (Just try to finish the contact creation in bbdb-create, you'll see what I mean).

Is that clearer? If not, just let me know.

By the way, I was wondering if helm-bbdb, when adding a new contact, could just call bbdb-read-new-record? This way, you don't need to re-implement a contact creation structure and leave the hand to this function. This woudn't solve the issue, but it would allow not to code a new version in helm just for creating a contact.

thierryvolpiatto commented 12 years ago

Jiehong reply@reply.github.com writes:

I'm sorry if I wasn't clear enough. What I meant is that yes, when no contacts matches then helm-bbdb offers to create a new one, which is right, but during this creation process, when it comes for the address and phones, helm could provide a buffer in which we can select address names (like Home, Second house… names that appears in BBDB).

If you don't see what I mean, just launch bbdb-create. Here is what will be asked:

  1. Name:
  2. Company:
  3. Network address:
  4. Address description [RET when no more]: At this time, a helm buffer pops up with choices for address description. This is what I was speaking about.

Ok, I think I understand, please try last changes. If that's ok, I will do the same for phone entries, though you have a description in prompt for this one.

helm-bbdb, when creating a new contact, doesn't provide this feature. It's also where it's a problem since this buffer doesn't provide a nil choice to leave the address description loop (Just try to finish the contact creation in bbdb-create, you'll see what I mean).

Is that clearer?

Yes thanks I see.

By the way, I was wondering if helm-bbdb, when adding a new contact, could just call bbdb-read-new-record?

No, we would hit the same problem than with bbdb-create. The only thing to do that would be modifying bbdb source code.


Reply to this email directly or view it on GitHub: https://github.com/emacs-helm/helm/issues/78#issuecomment-6777524

Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997

thierryvolpiatto commented 12 years ago

So yes, I need to fix the phone selection as we actually enter something in home, work to finally access to mobile or other. So don't look too much at it just try address stuff, I will implement the phone selection in the same way.

Jiehong commented 12 years ago

I have just tried it, and it's quite nice.

Maybe 2 litle things:

I would like to say thank you for your reactivity and also for your time. This is really nice.

thierryvolpiatto commented 12 years ago

Jiehong reply@reply.github.com writes:

I have just tried it, and it's quite nice.

Maybe 2 litle things:

  • we are prompted many email address (why not) I think this is good, don't you think?
  • address descriptions are hard coded… whereas with bbdb-create the helm buffer shows address descriptions used in your .bbdb file. Could it be possible too? No, I noticed bbdb send many unrelated things in completion which is no good. I would prefer creating defcustom for those two list, WDYT?

I would like to say thank you for your reactivity and also for your time. This is really nice. Youre welcome, thanks for reporting.


Reply to this email directly or view it on GitHub: https://github.com/emacs-helm/helm/issues/78#issuecomment-6783430

Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997

thierryvolpiatto commented 12 years ago

Ok, I created the defcustoms, I close this issue, feel free to reopen if something wrong. Thanks.

Jiehong commented 12 years ago

Indeed, you're right about asking for more than one email addresses.

For the completion buffer, bbdb actually provides a good function that returns the possible completion list for a specified field. Here it is for addresses: (bbdb-label-completion-list "addresses") This function returns the default list at least. In my Emacs, it returns a list: ("Home" "Office" "Mobile" "Other" "Parents" "School"…). The first 4 ones are the default ones if I'm right.

I think you can use it to create the helm-buffer instead of using a hard coded list or a defcustom. What do you think?

You can get the same thing for phones with: (bbdb-label-completion-list "phones")

Jiehong commented 12 years ago

or and I don't have the rights to reopen this issue by the way.

thierryvolpiatto commented 12 years ago

Jiehong reply@reply.github.com writes:

I think you can use it to create the helm-buffer instead of using a hard coded list or a defcustom. What do you think? I think it is very good, thanks, applied.

Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997

thierryvolpiatto commented 12 years ago

I let you close the issue if it is ok.

Jiehong commented 12 years ago

Thanks. So far it looks just great so thanks again!

behrica commented 9 years ago

I am not sure, if my comment is still relevant.

I had the same problem as described in the first comment here.

The workaround is to type SPACE Return. So entering a 'blank'. This let you get out of the endless loop.

thierryvolpiatto commented 9 years ago

behrica notifications@github.com writes:

I am not sure, if my comment is still relevant.

I had the same problem as described in the first comment here.

The workaround is to type SPACE Return. So entering a 'blank'. This let you get out of the endless loop.

helm-bbdb is no more maintained in helm, it is here actually:

https://github.com/thierryvolpiatto/helm-bbdb

It is broken with new bbdb, it working only with old bbdb. As I don't use myself bbdb, I am waiting for somebody to fix it (and maintain it).

Thierry https://emacs-helm.github.io/helm/

michael-heerdegen commented 9 years ago

I didn't read all of the thread carefully, but I think all @Jiehong was missing was to hit C-RET to enter an empty string, instead of RET being mentioned in the prompt. I know that very well because I asked the very same question two years ago or so. Remember @thierryvolpiatto? You said something like "Damn, look at the mode-line, it clearly says you should..." etc. at that time, and closed the issue.

I have used bbdb frequently since then, including bbdb-create, and it worked without a problem, once you have got to know to you have to use C-RET instead of RET.

So I didn't have a look at the recent changes. Should I? Do they make sense after what I have said?

michael-heerdegen commented 9 years ago

Oops, I totally missed the most of the thread is three years old.

michael-heerdegen commented 9 years ago

FWIW, I can fix helm-bbdb to get it work again if this is wanted, but I don't want to maintain it, too.

thierryvolpiatto commented 9 years ago

Michael Heerdegen notifications@github.com writes:

I have used bbdb frequently since then, including bbdb-create, and it worked without a problem, once you have got to know to you have to use C-RET instead of RET.

Are you sure you are using helm-bbdb and not just the original bbdb commands helmized by helm-mode ?

Thierry https://emacs-helm.github.io/helm/

thierryvolpiatto commented 9 years ago

Michael Heerdegen notifications@github.com writes:

FWIW, I can fix helm-bbdb to get it work again if this is wanted, but I don't want to maintain it, too.

If you are using bbdb version 3+ it would be welcome. The problem is just the new bbdb is not backward compatible with old version and I don't know which functions to use with new bbdb, not being a bbdb user myself.

For maintainance, once the switch to bbdb 3 is done and fully fixed, the incoming bugs should be more locals to helm-bbdb or related to helm, and I could fix them if necessary (users can send PR too).

Thanks.

Thierry https://emacs-helm.github.io/helm/

michael-heerdegen commented 9 years ago

Thierry Volpiatto notifications@github.com writes:

Are you sure you are using helm-bbdb and not just the original bbdb commands helmized by helm-mode ?

Yes, I meant the helmized bbdb commands. I never used helm-bbdb.

michael-heerdegen commented 9 years ago

Thierry Volpiatto notifications@github.com writes:

If you are using bbdb version 3+ it would be welcome. The problem is just the new bbdb is not backward compatible with old version and I don't know which functions to use with new bbdb, not being a bbdb user myself.

It doesn't seem to be difficult, I got most of the stuff working again after switching to the new names of some functions. Will make a PR soon.

michael-heerdegen commented 9 years ago

@thierryvolpiatto I updated helm-bbdb and fixed some small issues; it seems to work again. Anybody here: if you want to give it a try it...please do.

Then I guess we can add it to Melpa again.