girzel / ebdb

An EIEIO port of BBDB, Emacs' contact-management package
67 stars 12 forks source link

[Question] Possible to use ebdb outside MUA? #83

Open poulpoulsen opened 4 years ago

poulpoulsen commented 4 years ago

Hello, after some time i successfully managed it to run ebdb inside gnus. Now i thought about using ebdb inside normal text in Org-mode, e.g. to insert adresses, names or similar. Is it possible?

Second question is: Is it possible to insert new fields in the database, e.g. to provide other information. My idea is to create a database with plants. Therefore i want to save some information inside fields about my plants. Any suggestions?

Regards Poul

girzel commented 4 years ago

Hi there. Yes, one of the design goals of EBDB is that it should be usable with a wide variety of other software packages -- for historical reasons the code refers to "MUA"s, but really it should be possible to integrate it with anything, and Org is definitely an important target.

Right now there's an option to have an EBDB buffer pop up when you do a tag-type Agenda search: that will display any contacts you've tagged with that tag. You can insert a link to a record using the normal link insertion routine. There's also the command ebdb-cite-records, which will prompt for a record and insert a mailto: link to it.

I'm happy to provide further integration -- what sort of stuff would you be interested in seeing?

It's possible to create new fields for the database, the manual has some basic instructions under "Hacking EBDB -> Field Classes". You might take a look at that, and feel free to ask me if you have questions or need help implementing things.

Also, if integration with Gnus was particularly difficult or confusing, is there any way it could be improved, do you think?

poulpoulsen commented 4 years ago

Hello, OK i See. Then i will explain my ideas and wishes:

  1. I do not have real problems with the configuration of ebdb inside Gnus. Because i use icicles for completion, i have to use ebdb-complete-enable inside Gnus Hooks. Otherwise completion does not work. Both use the tab-key ... One question: how could i change the window dimensions, from ebdb-buffer after completion with tab-key? It is always maximized .

  2. My idea for a database is born out of gardening. I will save all my plants with their different properties, e.g. dimensions, color.

  3. Because I often write stories with org-mode, I want to save my persons, ideas and other different things with all the properties I need.

  4. I want to insert the details from a saved person dataset into my text.

  5. I want to link the name inside the text with the ebdb dataset (like org-store-link).

  6. I want to select a person / plant dataset via autocomplete inside my text in org-mode.

All these ideas are heavyweighted, i think... I'm not a developer, but right now, i can do these things inside my wordprocessor (called Papyrus or Scrivener). My dream is to switch to Emacs Org-mode :-)

Do I explain my ideas a little clearer?

Regards Poul

girzel commented 4 years ago

For your first question: Do you mean that, after you complete a mail record with TAB in message-mode, and the EBDB buffer pops up, it takes over the entire frame, so you can't even see your message composition buffer anymore? It certainly shouldn't do that!

For the rest... Something tells me that EBDB won't be the right fit for keeping a plant database. You could probably make it work, but that's not what it's designed for, and I doubt it would ever feel "right". Perhaps you could just start using Org headings with properties? That is simple, but doesn't scale well. Otherwise, maybe using a proper database in SQLite?

Using Org instead of Papyrus/Scrivener is very interesting! I am aware of both of those programs, and have also thought a bit about how to use Org to replace them (I am a translator of fiction and also use Org to translate entire novels). To be honest, it never occurred to me that EBDB could be used to keep track of fictional characters, but that's a great idea.

I think that Org could replace Scrivener, but I think it would take quite a bit of work -- and probably require a minor-mode defined on top of Org. I don't have time to do that right now, unfortunately.

In the meantime, EBDB can do some of this: you can already insert links to EBDB records, either by storing a link in an EBDB buffer, or using org-insert-link in an Org buffer and then typing ebdb: <TAB> to get completion. Then if you hit "<RET>" on a record link, it will pop up an EBDB buffer showing that record. It's also possible to create Org links that search and display multiple records.

Completing text on record names is doable, but would require a bit more coding, and as I said, maybe a minor mode.

poulpoulsen commented 4 years ago

For your first question: Do you mean that, after you complete a mail record with TAB in message-mode, and the EBDB buffer pops up, it takes over the entire frame, so you can't even see your message composition buffer anymore? It certainly shouldn't do that!

Yes exactly. I create a mail with key m put cursor in field to: some letters and or TAB pops up the ebdb buffer maximized. if i select an adress and push RET, i 'm back in message buffer.

For the rest... Something tells me that EBDB won't be the right fit for keeping a plant database. You could probably make it work, but that's not what it's designed for, and I doubt it would ever feel "right". Perhaps you could just start using Org headings with properties? That is simple, but doesn't scale well. Otherwise, maybe using a proper database in SQLite?

But is there any implemantation for Org-mode and SQL?

In the meantime, EBDB can do some of this: you can already insert links to EBDB records, either by storing a link in an EBDB buffer, or using org-insert-link in an Org buffer and then typing ebdb: to get completion. Then if you hit "" on a record link, it will pop up an EBDB buffer showing that record. It's also possible to create Org links that search and display multiple records. I will check that.

Completing text on record names is doable, but would require a bit more coding, and as I said, maybe a minor mode.

OK, i will see, what icicle could do.

Regards Poul

girzel commented 4 years ago

For your first question: Do you mean that, after you complete a mail record with TAB in message-mode, and the EBDB buffer pops up, it takes over the entire frame, so you can't even see your message composition buffer anymore? It certainly shouldn't do that!

Yes exactly. I create a mail with key m put cursor in field to: some letters and or TAB pops up the ebdb buffer maximized. if i select an adress and push RET, i 'm back in message buffer.

Can you tell me if you've loaded 'ebdb-complete, and/or 'ebdb-message? Have you run the function ebdb-complete-enable? That might cause this kind of behavior.

For the rest... Something tells me that EBDB won't be the right fit for keeping a plant database. You could probably make it work, but that's not what it's designed for, and I doubt it would ever feel "right". Perhaps you could just start using Org headings with properties? That is simple, but doesn't scale well. Otherwise, maybe using a proper database in SQLite?

But is there any implemantation for Org-mode and SQL?

There is! Check out https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sqlite.html for some information on how to interface with SQLite.

poulpoulsen commented 4 years ago

Can you tell me if you've loaded 'ebdb-complete, and/or 'ebdb-message? Have you run the function ebdb-complete-enable? That might cause this kind of behavior.

Hello, yes i load ebdb-complete and i run ebdb-complete-enable with gnus-message-setup-hook. should i reconfigure anything?

And thanks for the link. i will check this.

Regards Poul

girzel commented 4 years ago

ebdb-complete-enable is a sort of non-standard completion approach, which is meant to pop up a whole EBDB buffer to allow you to choose a contact. If you've loaded "ebdb-message", the pop up command should know to split the message-mode buffer rather than taking it over completely. Can you make sure you've required the 'ebdb-message library?

poulpoulsen commented 4 years ago

Eric Abrahamsen notifications@github.com writes:

Hello, yes i think i've loaded the required libraries. here is my config:

(require 'ebdb) (require 'ebdb-gnus) (require 'ebdb-message) (require 'ebdb-migrate) (require 'ebdb-org) (require 'ebdb-pgp) (require 'ebdb-snarf) (require 'ebdb-ispell) (require 'ebdb-html) (require 'ebdb-complete) ;; (setq mu4e-compose-complete-addresses nil) ;;(setq ebdb-complete-mail 'capf) (setq ebdb-join-atomic-windows nil) (setq ebdb-mua-pop-up nil) (setq ebdb-user-mail-address-re 'message) (setq ebdb-message-try-all-headers t) (setq ebdb-sources (list "~/.emacs.d/ebdb.gpg")) (setq ebdb-complete-mail t) (setq ebdb-complete-mail-allow-cycling t) (setq ebdb-gnus-window-configuration (quote (article (vertical 1.0 (summary 0.25 point) (horizontal 1.0 (article 1.0) (ebdb-gnus 0.3))))))

and this is from my .gnus file: (add-hook 'gnus-message-setup-hook 'ebdb-complete-enable)

that's all.

should i change anything?

Regards Poul

ebdb-complete-enable is a sort of non-standard completion approach, which is meant to pop up a whole EBDB buffer to allow you to choose a contact. If you've loaded "ebdb-message", the pop up command should know to split the message-mode buffer rather than taking it over completely. Can you make sure you've required the 'ebdb-message library?

girzel commented 4 years ago

Okay, that ought to work, let me experiment with this. (Btw, it shouldn't be necessary to load 'ebdb-migrate once you've migrated the first time -- the relevant functions are also autoloaded.)

As usual, the hardest part of writing an Emacs package is the window management!

poulpoulsen commented 4 years ago

Thanks for that. I will wait to See. Btw: if i use ebdb-Complete-mail, then the problem is gone, but selected address from the ebdb-buffer unfortunately replaces the content of my unsent message buffer. So i use ebdb-Complete.

Regards Poul

-------- Ursprüngliche Nachricht -------- Von: Eric Abrahamsen notifications@github.com Gesendet: 20. Dezember 2019 20:17:49 MEZ An: girzel/ebdb ebdb@noreply.github.com CC: poulpoulsen sammelpost@holnishaus.de, Author author@noreply.github.com Betreff: Re: [girzel/ebdb] [Question] Possible to use ebdb outside MUA? (#83)

Okay, that ought to work, let me experiment with this. (Btw, it shouldn't be necessary to load 'ebdb-migrate once you've migrated the first time -- the relevant functions are also autoloaded.)

As usual, the hardest part of writing an Emacs package is the window management!

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/girzel/ebdb/issues/83#issuecomment-568051973 -- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.