Re: SQLite for contacts and relations to Org - Re: contact management in emacs

2022-10-11 Thread Jean Louis
* Sébastien Rey-Coyrehourcq  
[2022-10-11 08:56]:
> Hi Jean Louis,
> 
> First i want to thank you for this very detailled explanation, this is very 
> valuable for someone that start in elisp like me.
> 
> Secondly, i found the idea of using sqlite for contacts very interesting, and 
> i think a lot on this solution on my side the last weeks. With the new emacs 
> interface to sql, it was easy i suppose to create a “both-way” syncing tool 
> between org-contact (to easily maintain info, linking to notes, agenda, etc.) 
> and a database that anyone could reuse, move, send also using mobile phone.
> 
> I use org-roam that use both of the two world, database and org, in the light 
> of recent discussion, why we cannot do the same things for org-contact ? 
> Linking / syncing properties with unique hash/id also stored in a database. 
> If you have 15 contact, with 15 unique ID, and if you want to create 
> an org-contact file/propertie into an org document, that’s probably easy to 
> inject and maintain some sort of syncing (like org-roam do) between the info 
> in database and the info into some properties block no ?

That is exactly the point. Why keep well structured information such
as phone numbers, emails, addresses, in Org file, when structured
information by its type belong into structured forms like databases.

Keeping it in Org or any text files is not scalable, not usable, not
shareable. To tell people to use text files to keep information is
detrimental for people who listen to it. They can't know it
immediately, but one day they will realize that it does not fly.

Why email clients like Thunderbird have contacts features built-in?
For reason that contacts are related to communication and
information. Communication is connection in every relation between
people. Information is written because it fosters communication and
thus relations.

Org contacts try to store contacts into Org file. I don't know the
rest. I have looked inside the Org contacts code and I do not agree
with the design. It is not scalable.

>From code:

,
| To enter new contacts, you can use `org-capture' and a minimal
| template just like..
`

;; this:

;; ("c" "Contacts" entry (file "~/Org/contacts.org")
;;  "* %(org-contacts-template-name)
;; :PROPERTIES:
;; :EMAIL: %(org-contacts-template-email)
;; :END:")))
;;
;; You can also use a complex template, for example:
;;
;; ("c" "Contacts" entry (file "~/Org/contacts.org")
;;  "* %(org-contacts-template-name)
;; :PROPERTIES:
;; :EMAIL: %(org-contacts-template-email)
;; :PHONE:
;; :ALIAS:
;; :NICKNAME:
;; :IGNORE:
;; :ICON:
;; :NOTE:
;; :ADDRESS:
;; :BIRTHDAY:
;; :END:")))

 Usage:

;; How to search?
;; - You can use [M-x org-contacts] command to search.

I would not bother using that. Why? Because of experience.

- many people have many various emails, not just one. 

- by using email as reference, I quickly jump to list of conversations
  with that person

- if email is invalid, I still need the conversation retained

- I must know if email is for work or private, it needs more structure

- phones, I am sending SMS, I must know in structured way, if the
  phone belongs to provider ABC or XYZ, as that decides on routing on
  how to send SMS messages. Nobody likes spending money by using wrong
  providers. 

- fax is phone line, mobile phone and fixed lines are not same, I must
  know type of phone line;

- aliases and nicknames belong to identities,

- single note about contact is not enough, contact may be related to
  many notes.

- address must be structured, otherwise it is really difficult to use
  it programmatically:

 ID   198333
   Date created   "2022-10-11 21:28:42.565176"
  Date modified   nil
   User created   "maddox"
  User modified   "maddox"
 Person   "Joe Doe"
   Type   "Default address"
   Address Name   "Address in Germany"
Line #1   ""
Line #2   ""
Line #3   ""
   City   ""
 Region   ""
  Post code   ""
Country   "GERMANY"
 Date validated   nil
   Location   nil
Description   nil
   Inactive   nil
Default   nil

There is no option but to keep structured information in structured
databases. I have working system with PostgreSQL and decentralized
collaboration, but I am now making SQLite minimized version, so when
package is finished I will let you know.

Package preparation:
https://gnu.support/images/2022/10/2022-10-11/Screenshot-2022-10-11-22-50-03-955596051.png

Editing of entry:
https://gnu.support/images/2022/10/2022-10-11/Screenshot-2022-10-11-22-57-51-793932307.png


-- 
Jean

Take action in F

Re: SQLite for contacts and relations to Org - Re: contact management in emacs

2022-10-10 Thread Sébastien Rey-Coyrehourcq
Hi Jean Louis,

First i want to thank you for this very detailled explanation, this is very 
valuable for someone that start in elisp like me.

Secondly, i found the idea of using sqlite for contacts very interesting, and i 
think a lot on this solution on my side the last weeks. With the new emacs 
interface to sql, it was easy i suppose to create a “both-way” syncing tool 
between org-contact (to easily maintain info, linking to notes, agenda, etc.) 
and a database that anyone could reuse, move, send also using mobile phone.

I use org-roam that use both of the two world, database and org, in the light 
of recent discussion, why we cannot do the same things for org-contact ? 
Linking / syncing properties with unique hash/id also stored in a database. If 
you have 15 contact, with 15 unique ID, and if you want to create an 
org-contact file/propertie into an org document, that’s probably easy to inject 
and maintain some sort of syncing (like org-roam do) between the info in 
database and the info into some properties block no ?

Best regards,
SR

Jean Louis  writes:

> * Sébastien Rey-Coyrehourcq  
> [2022-09-09 ven. 19:12]:
>> Hi,
>>
>> After some search today on the web, like Alan i try to compare all
>> possibility to manage my contact + mail using emacs, mu4e, and org.
>
> I will describe you how to manage contacts with Emacs in the reverse
> example reverse of what org-contacts tries to do for you.
>
> Org contacts try to keep people in Org file. Emacs 29 has a built-in
> SQLite database which allows every Emacs user to keep information in
> ordered, structured manner in the relational database.
>
> For people who do not use latest development Emacs version, there are
> SQLite Emacs packages that allow immediate usage of file based
> single-user access database, see 
>
> In Emacs 29, here is how I create the SQLite database, or open the existing 
> one:
>
> (setq my-db (sqlite-open “~/my-people”))
>
> This is database handle:
>
> my-db ⇒ # name=/home/data1/protected/my-org-properties>
>
> This is how to create a table of `people’ in the database. The
> structure of the table `people’ is thus pretty much individual,
> one can record any kind of entries and be sure if the the entry
> is there or not. It does not allow vague guessing with text files
> like in Org or Hyrolo in Hyperbole.
>
> This is example table, one can build upon it. This one contains emails only.
>
> (sqlite-execute my-db “CREATE TABLE people1 (people_id INTEGER PRIMARY KEY,
>people_firstname TEXT,
>people_middlenames TEXT,
>people_name TEXT NOT NULL DEFAULT 
> ’>>>UNKNOWN<<<‘,
>people_email TEXT,
>people_description TEXT)”)
>
> This is how to get all queries from the table:
>
> (sqlite-select my-db “SELECT * FROM people”) ⇒ nil
>
> This is how to insert new entry programmatically:
>
> (sqlite-execute my-db “INSERT INTO people (people_firstname, people_name, 
> people_email)
>   VALUES (?, ?, ?)
>RETURNING people_id”
>   ’(“Robert” “Weiner” “r...@gnu.org”))
>
> Get information back from database, programmatically. Do with information 
> what you wish.
>
> (sqlite-select my-db “SELECT * FROM people”) ⇒ ((1 “Robert” nil “Weiner” 
> “r...@gnu.org” nil) (2 “Robert” nil “Weiner” “r...@gnu.org” nil))
>
> Delete everything in the database.
>
> (sqlite-execute my-db “DELETE FROM people”) ⇒ 0
>
> ;; Backup?
>
> Backup database by simple copy of the file “~/my-people”
>
> (sqlite-select my-db “SELECT * FROM people”) ⇒ nil
>
> Make nicer function to add new people:
>
> (defun my-people-add ()
>   (interactive)
>   (let* ((first-name (read-string “First name: ”))
>(middle-names (read-string “Middles names: ”))
>(name-or-last-name (let ((result))
> (while (not result)
>   (setq result (apply ’read-string ’(“Last name: 
> ”
> result))
>(email (read-string “Email: ”))
>(description (read-string “Description: ”)))
> (sqlite-execute my-db “INSERT INTO people (people_firstname, 
> people_middlenames, people_name, people_email, people_description)
>VALUES (?, ?, ?, ?, ?) RETURNING people_id”
>   (list first-name middle-names name-or-last-name 
> description
>
> Run the function by using (my-people-add) or M-x my-people-add
>
> Verify that person was added:
>
> (sqlite-select my-db “SELECT * FROM people”) ⇒ ((1 “Joe” “” “Doe” nil nil))
>
> Entries are returned as list, get the first list entry:
>
> (caar (sqlite-select my-db “SELECT people_id FROM people WHERE people_id = 
> 1”)) ⇒ 1
>
> My database structure is ALWAYS as so that for TABLE I always
> have primar

Re: SQLite for contacts and relations to Org - Re: contact management in emacs

2022-10-10 Thread Robert Weiner
You want a CRM system which to me is a very different creature and much more 
complex than a contact manager, meant to lookup fairly static information about 
people.  HyRolo was built to allow freeform contact management and to 
specifically avoid the typical, limiting field-based techniques in common use.

It would be a small extensio  to allow you to apply operations to a set of 
filtered contacts you have found.

-- Bob

> On Oct 10, 2022, at 7:39 PM, Jean Louis  wrote:
> 
> 
> 
> When anyway structured information such as people names, properties,
> their communication lines



Re: SQLite for contacts and relations to Org - Re: contact management in emacs

2022-10-10 Thread Jean Louis
* Robert Weiner  [2022-10-11 01:31]:
> 1. Although I understand you do a great many things with your
> database-backed Hyperscope system and I work with RDBMSes every day, I
> don't really see great value in what you have shown in the context of
> contact management when compared to the already existing HyRolo or
> org-contacts.  We can easily add, delete, import and export contacts, we
> just follow very simple conventions in creating our contacts.  We can
> easily email contact files and have people apply text processing tools to
> them, so it would help if you just showed examples of something that Emacs
> really lacks before suggesting wrapping everything into a database system,
> as I know you are a very smart guy.

For org-contacts, I have nothing to say, as that is as limited as it
can be. 

When anyway structured information such as people names, properties,
their communication lines, addresses are in the separate database like
SQLite, that fact liberates information from single software like
HyRolo, and allows users to access, process information freely with
any programming languages and plethora of variety of tools for
inspection, analysis, exports, and sharing of such information.

For HyRolo, that is text. One cannot build upon it.

I am constantly sending SMS from Emacs and importing SMS from mobile
phones to contacts. When I send SMS I want to see which SMS was sent
and received by which contact at what time, by which phone number. It
is something not imaginable with text files. Similar is with
information sent to people, how am I supposed to know what information
I have sent, what not. There is no automated tracking in text files
like HyRolo. It is one example among way too many.

Adding properties to people, objects, it is much easier by using
selection that one can click onto, or use arrows, or just C-p for
previous one. Rather that, then writing with hand each time, error
prone, some skills of people in order to find people by skills.

Skill like "C programmer" I would need to add too many times and then
use find by regexp. 

All good and find, but not scalable. Of course that I have use text
files long ago to store contacts, but that was 28 years ago. I have
now 240106 entries of people and their groups.

Unspoken of marketing campaign, imagine when I paid $73 and got in 23
hours 1200+ leads for recruitment in specific sector. How would I
enter them in HyRolo? Automate some web server program to add them in
similar fashion like Org heading. It could work. But then how could I
send to those people in ordered fashion series of 3-10 training emails
that automates the process of recruitment and selection? Would HyRolo
help me track who received what at what time? There is no foundation
for such features in text files.

> 2. Years ago as part of my stab at an Emacs-based IDE, InfoDock (find it on
> Sourceforge),

Is it this one?

https://sourceforge.net/projects/infodock/

I cannot see how to start anything with it. Do you have screenshots?

> I also wrote an in-memory, file-based but fully relational database.
> The main point of which was to demonstrate direct manipulation
> querying of relational tables via simple mouse clicks/key presses on
> screen.  For simple queries, I found this very powerful and dirt
> simple for people to do.  If that were of interest, someone could
> take the existing code under infodock/id-lisp/rdb and interface it
> to SQLite pretty easily I would expect and then you would have an
> interesting Emacs interface without having to master SQL for basic
> table analysis.

Is it this one?

lib/infodock-4.0.8/i486-pc-sysv5/  
lib/infodock-4.0.8/i486-pc-sysv5/make-path 
lib/infodock-4.0.8/i486-pc-sysv5/wakeup
lib/infodock-4.0.8/i486-pc-sysv5/profile   
lib/infodock-4.0.8/i486-pc-sysv5/make-docfile  
lib/infodock-4.0.8/i486-pc-sysv5/digest-doc
lib/infodock-4.0.8/i486-pc-sysv5/sorted-doc
lib/infodock-4.0.8/i486-pc-sysv5/movemail  
lib/infodock-4.0.8/i486-pc-sysv5/cvtmail   
lib/infodock-4.0.8/i486-pc-sysv5/fakemail  
lib/infodock-4.0.8/i486-pc-sysv5/yow   
lib/infodock-4.0.8/i486-pc-sysv5/hexl  
lib/infodock-4.0.8/i486-pc-sysv5/gnuserv   
lib/infodock-4.0.8/i486-pc-sysv5/mmencode  
lib/infodock-4.0.8/i486-pc-sysv5/rcs2log   
lib/infodock-4.0.8/i486-pc-sysv5/vcdiff
lib/infodock-4.0.8/i486-pc-sysv5/gzip-el.sh
lib/infodock-4.0.8/i486-pc-sysv5/add-big-package.sh
lib/infodock-4.0.8/i486-pc-sysv5/config.values 
lib/infodock-4.0.8/i486-pc-sysv5/DOC   
bin/i386-intel-sco7/   
bin/i386-intel-sco7/etags  
bin/i386-intel-sco7/ctags  
bin/i386-intel-sco7/b2m
bin/i386-intel-sco7/gnuclient  
bin/i386-intel-sco7/ootags 
bin/i386-intel-sco7/rcs-checkin
b

Re: SQLite for contacts and relations to Org - Re: contact management in emacs

2022-10-10 Thread Robert Weiner
Hi Jean:

A few thoughts.

1. Although I understand you do a great many things with your
database-backed Hyperscope system and I work with RDBMSes every day, I
don't really see great value in what you have shown in the context of
contact management when compared to the already existing HyRolo or
org-contacts.  We can easily add, delete, import and export contacts, we
just follow very simple conventions in creating our contacts.  We can
easily email contact files and have people apply text processing tools to
them, so it would help if you just showed examples of something that Emacs
really lacks before suggesting wrapping everything into a database system,
as I know you are a very smart guy.

2. Years ago as part of my stab at an Emacs-based IDE, InfoDock (find it on
Sourceforge), I also wrote an in-memory, file-based but fully relational
database.  The main point of which was to demonstrate direct manipulation
querying of relational tables via simple mouse clicks/key presses on
screen.  For simple queries, I found this very powerful and dirt simple for
people to do.  If that were of interest, someone could take the existing
code under infodock/id-lisp/rdb and interface it to SQLite pretty easily I
would expect and then you would have an interesting Emacs interface without
having to master SQL for basic table analysis.

-- rsw



On Mon, Oct 10, 2022 at 6:12 AM Jean Louis  wrote:

> * Quiliro Ordóñez  [2022-10-09 22:10]:
> > I agree.  But the end-user did not construct this program.  It was you.
> > I coould learn how to install it.  Then, I should teach the end-user to
> > use it.  But the program was not made or installed by the end-user.  I
> > might be able to teach the end-user to modify it.  But I doubt it.
>
> I will make a package so that you just install it and can start
> managing people.
>
> > What I mean is that end-users must have an easy entry point.  Of course
> > that ease must not hide innner workings because that would disempower
> > the end-user.  How do you propose it could be implemented? (if you agree
> > it should be done this way, of course)
>
> Inner workings are pretty much hidden unless user is programmer. Emacs
> is difficult, then there is underlying Emacs Lisp, then C language,
> then operating system, and stuff.
>
> Maybe you mean somthing else with inner workings?
>
> > > I have actually shown to you how it works, so you have to imagine that
> > > all that may be part of the package. Especially with SQLite databases
> > > there is nothing to configure.
> >
> > Not much to do.  Just installing SQLite and then the program you
> > propose.
>
> I did not try any SQLite package, just used the built-in functions in
> Emacs development version. Which packag did you install?
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> In support of Richard M. Stallman
> https://stallmansupport.org/
>
>


Re: SQLite for contacts and relations to Org - Re: contact management in emacs

2022-10-10 Thread Jean Louis
* Quiliro Ordóñez  [2022-10-09 22:10]:
> I agree.  But the end-user did not construct this program.  It was you. 
> I coould learn how to install it.  Then, I should teach the end-user to
> use it.  But the program was not made or installed by the end-user.  I
> might be able to teach the end-user to modify it.  But I doubt it.

I will make a package so that you just install it and can start
managing people. 

> What I mean is that end-users must have an easy entry point.  Of course
> that ease must not hide innner workings because that would disempower
> the end-user.  How do you propose it could be implemented? (if you agree
> it should be done this way, of course) 

Inner workings are pretty much hidden unless user is programmer. Emacs
is difficult, then there is underlying Emacs Lisp, then C language,
then operating system, and stuff.

Maybe you mean somthing else with inner workings?

> > I have actually shown to you how it works, so you have to imagine that
> > all that may be part of the package. Especially with SQLite databases
> > there is nothing to configure.
> 
> Not much to do.  Just installing SQLite and then the program you
> propose.

I did not try any SQLite package, just used the built-in functions in
Emacs development version. Which packag did you install?

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: SQLite for contacts and relations to Org - Re: contact management in emacs

2022-10-09 Thread Quiliro Ordóñez
El 2022-10-09 11:59, Jean Louis escribió:
> * Quiliro Ordóñez  [2022-10-09 18:22]:
>> El 2022-10-09 05:40, Jean Louis escribió:
>>
>> > But I can as well edit my contacts by using external tools and
>> > exchange information with other software.
>> >
>> > Do you wish to share your contacts? That is easy, one can simple send
>> > the full file to somebody.
>> >
>> > By followed the thought patterns described one shall understand that
>> > contacts may be separated from single mode (Org) and separated from
>> > single software (Emacs) and that it will not minimize or limit you but
>> > rather widen the capacities and usefulness for human.
>>
>> This is a great summary about the use of database to hold information.
>> But it requires experience configuring databases for end-users.
> 
> We speak of what? User experience? We are in Emacs environment, that
> means you run your application either by using mouse click or by M-x
> or key binding.
> 
> In the provided example you as user need nothing else but
> that. Hypothetically basic actions are just add, modify, delete,
> search for contacts. You do that by key binding in Emacs, or by mouse,
> or by M-x
> 
> In the example provided user need do nothing but that. Even the file
> can be automatically stored like in ~/.emacs.d/people.sqlite or
> otherwise configured to be somewhere else.

I agree.  But the end-user did not construct this program.  It was you. 
I coould learn how to install it.  Then, I should teach the end-user to
use it.  But the program was not made or installed by the end-user.  I
might be able to teach the end-user to modify it.  But I doubt it.

What I mean is that end-users must have an easy entry point.  Of course
that ease must not hide innner workings because that would disempower
the end-user.  How do you propose it could be implemented? (if you agree
it should be done this way, of course) 

> I have actually shown to you how it works, so you have to imagine that
> all that may be part of the package. Especially with SQLite databases
> there is nothing to configure.

Not much to do.  Just installing SQLite and then the program you
propose.



Re: SQLite for contacts and relations to Org - Re: contact management in emacs

2022-10-09 Thread Jean Louis
* Quiliro Ordóñez  [2022-10-09 18:22]:
> El 2022-10-09 05:40, Jean Louis escribió:
> 
> > But I can as well edit my contacts by using external tools and
> > exchange information with other software.
> > 
> > Do you wish to share your contacts? That is easy, one can simple send
> > the full file to somebody.
> > 
> > By followed the thought patterns described one shall understand that
> > contacts may be separated from single mode (Org) and separated from
> > single software (Emacs) and that it will not minimize or limit you but
> > rather widen the capacities and usefulness for human.
> 
> This is a great summary about the use of database to hold information. 
> But it requires experience configuring databases for end-users.

We speak of what? User experience? We are in Emacs environment, that
means you run your application either by using mouse click or by M-x
or key binding.

In the provided example you as user need nothing else but
that. Hypothetically basic actions are just add, modify, delete,
search for contacts. You do that by key binding in Emacs, or by mouse,
or by M-x

In the example provided user need do nothing but that. Even the file
can be automatically stored like in ~/.emacs.d/people.sqlite or
otherwise configured to be somewhere else.

How many options does Org have? The example I have provided may be
option free. 

There is nothing to do but to add, modify, delete, search for
contacts, export, and so on; all by using M-x, key binding or mouse.

> It could work if the database was set up by someone else or if the
> fields were easy to define by the end-user by some kind of
> interface.

I have actually shown to you how it works, so you have to imagine that
all that may be part of the package. Especially with SQLite databases
there is nothing to configure.

This is what defines where the database is:

(defcustom rcd-people-sqlite-file (concat (expand-file-name 
user-emacs-directory) "rcd-people.sqlite")
  "SQLite database file location."
  :type 'file
  :group 'rcd)

We evaluate it:

rcd-people-sqlite-file ⇒ "/home/data1/protected/.emacs.d/rcd-people.sqlite"

The above variable is part of the package. There is nothing for
user to think about it. There is nothing to configure but user
is free to customize it.

Fields or columns in preset database tables are designed by
programmer.

It is not hard to have options to add column, delete column or
rename column. That is exactly what I am doing on the fly during
Emacs sessions.
  
> On the other hand, there is a movement to use plain text for everything.
> I know you disagree.

There are movements for each and everything. Why should I
disagree with movements, I let them be. 

What I do not agree is to claim strongly that it is useful to
keep plain text or clay tables with Cuneiform for every type of
information.

> But here is some information about accounting
> this way: https://plaintextaccounting.org

The huge amount of work necessary to create plain text accounting
can't be compared to database work and efforts. I guess I have
implemented accounting with database about 4 times in my life
and I use it in various contexts. Standard accounting is simple.

Accounting types (pasted straight from Emacs view of database
list):

 1  Asset
 2  Liability
 3  Equity
 4  Income
 5  Expenses

Sample account defined:
 ID   1
   Date created   "2022-02-27 18:36:28.690616"
  Date modified   "2022-02-27 18:36:39.372512"
   User created   "maddox"
  User modified   "maddox"
  Hyperdocument   "2022-02-27 Transactions for Joe Doe"
   Account Type   "Asset"
 Person   "Jean Louis"
   Currency   "UGX - Ugandan shilling"
   Name   "Jean Louis"
Description   nil
   Code   nil

It belongs to Hyperdocument which has type of accounting. There
may be multiple companies, multiple accounting sets or parents
to which accounts belong. No need to open a "new file" for each
new company.

And then there is journal entry:

-[ RECORD 1 
]--+---
journal_id | 4
journal_datecreated| 2019-06-12 00:08:04.409559
journal_datemodified   | 
journal_usercreated| maddox
journal_usermodified   | maddox
journal_cashentrytypes | 1
journal_code   | 
journal_description| food
journal_debit  | 5
journal_credit | 7
journal_amount | 4000
journal_signature  | 
journal_date   | 2019-06-10

The entry debits account ID 5, credits account ID 7.

> I learned a lot of elisp by reading your long explanation about how to
> construct a contact database directly on Emacs 29 without adding
> anything else.  Thank you very much!

Well that is really good, thank you.


-- 
Jean

Take action in Free Softw

Re: SQLite for contacts and relations to Org - Re: contact management in emacs

2022-10-09 Thread Quiliro Ordóñez
El 2022-10-09 05:40, Jean Louis escribió:

> But I can as well edit my contacts by using external tools and
> exchange information with other software.
> 
> Do you wish to share your contacts? That is easy, one can simple send
> the full file to somebody.
> 
> By followed the thought patterns described one shall understand that
> contacts may be separated from single mode (Org) and separated from
> single software (Emacs) and that it will not minimize or limit you but
> rather widen the capacities and usefulness for human.

This is a great summary about the use of database to hold information. 
But it requires experience configuring databases for end-users.  It
could work if the database was set up by someone else or if the fields
were easy to define by the end-user by some kind of interface.

On the other hand, there is a movement to use plain text for everything.
 I know you disagree.  But here is some information about accounting
this way: https://plaintextaccounting.org

I learned a lot of elisp by reading your long explanation about how to
construct a contact database directly on Emacs 29 without adding
anything else.  Thank you very much!



SQLite for contacts and relations to Org - Re: contact management in emacs

2022-10-09 Thread Jean Louis
* Sébastien Rey-Coyrehourcq  
[2022-09-09 19:12]:
> Hi,
> 
> After some search today on the web, like Alan i try to compare all
> possibility to manage my contact + mail using emacs, mu4e, and org.

I will describe you how to manage contacts with Emacs in the reverse
example reverse of what org-contacts tries to do for you.

Org contacts try to keep people in Org file. Emacs 29 has a built-in
SQLite database which allows every Emacs user to keep information in
ordered, structured manner in the relational database.

For people who do not use latest development Emacs version, there are
SQLite Emacs packages that allow immediate usage of file based
single-user access database, see https://www.sqlite.org

In Emacs 29, here is how I create the SQLite database, or open the existing one:

(setq my-db (sqlite-open "~/my-people"))

This is database handle:

my-db ⇒ #

This is how to create a table of `people' in the database. The
structure of the table `people' is thus pretty much individual,
one can record any kind of entries and be sure if the the entry
is there or not. It does not allow vague guessing with text files
like in Org or Hyrolo in Hyperbole.

This is example table, one can build upon it. This one contains emails only.

(sqlite-execute my-db "CREATE TABLE people1 (people_id INTEGER PRIMARY KEY,
   people_firstname TEXT,
   people_middlenames TEXT,
   people_name TEXT NOT NULL DEFAULT 
'>>>UNKNOWN<<<',
   people_email TEXT,
   people_description TEXT)")

This is how to get all queries from the table:

(sqlite-select my-db "SELECT * FROM people") ⇒ nil

This is how to insert new entry programmatically:

(sqlite-execute my-db "INSERT INTO people (people_firstname, people_name, 
people_email)
  VALUES (?, ?, ?)
   RETURNING people_id" 
'("Robert" "Weiner" "r...@gnu.org"))

Get information back from database, programmatically. Do with information what 
you wish.

(sqlite-select my-db "SELECT * FROM people") ⇒ ((1 "Robert" nil "Weiner" 
"r...@gnu.org" nil) (2 "Robert" nil "Weiner" "r...@gnu.org" nil))

Delete everything in the database. 

(sqlite-execute my-db "DELETE FROM people") ⇒ 0

;; Backup?

Backup database by simple copy of the file "~/my-people"

(sqlite-select my-db "SELECT * FROM people") ⇒ nil

Make nicer function to add new people:

(defun my-people-add ()
  (interactive)
  (let* ((first-name (read-string "First name: "))
 (middle-names (read-string "Middles names: "))
 (name-or-last-name (let ((result))
  (while (not result)
(setq result (apply 'read-string '("Last name: 
"
  result))
 (email (read-string "Email: "))
 (description (read-string "Description: ")))
(sqlite-execute my-db "INSERT INTO people (people_firstname, 
people_middlenames, people_name, people_email, people_description)
   VALUES (?, ?, ?, ?, ?) RETURNING people_id" 
(list first-name middle-names name-or-last-name 
description

Run the function by using (my-people-add) or M-x my-people-add

Verify that person was added:

(sqlite-select my-db "SELECT * FROM people") ⇒ ((1 "Joe" "" "Doe" nil nil))

Entries are returned as list, get the first list entry:

(caar (sqlite-select my-db "SELECT people_id FROM people WHERE people_id = 1")) 
⇒ 1

My database structure is ALWAYS as so that for TABLE I always
have primary key named TABLE_id. That principle allows to
simplify things.

Then I can make generic function to fetch from database DB, from
TABLE and COLUMN by using ID:

(defun sqlite-db-get-entry (table column id db)
  "Return value for the TABLE, COLUMN, ID from the database PG."
  (let* ((sql (format "SELECT %s FROM %s WHERE %s_id = %s" column table table 
id))
 (value (caar (sqlite-select db sql
value))

(sqlite-db-get-entry "people" "people_id" 1 my-db) ⇒ 1

(sqlite-db-get-entry "people" "people_name" 1 my-db) ⇒ "Doe"

(sqlite-db-get-entry "people" "people_email" 1 my-db) ⇒ "j...@example.com"

Make it exportable to Org:

(defun my-people-to-org-single (id)
  (let* ((first-name (sqlite-db-get-entry "people" "people_firstname" id my-db))
 (middle-names (sqlite-db-get-entry "people" "people_middlenames" id 
my-db))
 (last-name (sqlite-db-get-entry "people" "people_lastname" id my-db))
 (email (sqlite-db-get-entry "people" "people_email" id my-db))
 (description (sqlite-db-get-entry "people" "people_description" id 
my-db))
 (heading (list first-name middle-names last-name))
 (heading (mapcar (lambda (e) (cond ((seq-empty-p e) nil)
(t e)))
  heading))
 

Re: contact management in emacs

2022-09-09 Thread Ihor Radchenko
Sébastien Rey-Coyrehourcq 
writes:

> Moving from org-contrib to https://repo.or.cz/org-contacts.git , 
> accessible with melpa,  the documentation is mostly into the source-code 
> actually, i found few example on the web .
>
> What property field are correct :MOBILE:, :PHONE:, :BIRTHDAY: , and ?

First, remember that org-contacts is built on top of generic Org
search.

org-contacts.el considers Org headline to be a contact record when it
contains any of
org-contacts-email-property
org-contacts-alias-property
org-contacts-tel-property
org-contacts-address-property
org-contacts-birthday-property

properties.

All the variables can be changed to your preference.

> I config like that (org-contacts-file (file-expand-wildcards 
> "~/my-org-roam-folder/contact/*.org.gpg))
>
> It's slow because everything need to be unencrypted before (this is 
> another problem ...) but something i don't understand is how matching 
> work :
> calling "M-x org-contacts", i try multiple patterns, so i'm interested 
> by a working org/org-roam contact example.

M-x org-contacts does a simple regexp matching across contacts.

If you want integration with org-roam, you may probably want a custom
org-roam matches equivalent to org-contacts-matcher.

There is also M-x org-contacts-completing-read

For the slowness of opening the contacts, you may consider doing
M-x profiler-start .. M-x profiler-report to see what exactly is being
slow.

> I found some alternatives to test next week :
>
> - org-vcard (on github) compatible with org-contacts, focusing on 
> import/export of vcard files
> - mu4e-contacts (on gitlab) using helm / mu4e, inspired by org-contacts
> - org-ql query ?

org-ql may be an option though it works best for a single large Org
file. You may have better luck using org-roam built-in search. I think
that the most straightforward way to integrate with org-roam would be
adding a "contact" tag to your contact records and then using the
standard org-roam search.

Hope it helps.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



Re: contact management in emacs

2022-09-09 Thread Sébastien Rey-Coyrehourcq

Hi,

After some search today on the web, like Alan i try to compare all 
possibility to manage my contact + mail using emacs, mu4e, and org.


Since Alan Schmitt message, i think many people jump into the great 
*org-roam* wagon to manage notes, bibliography, links, everything...


I'm into this *crazy* wagon, trying now to manage contact, with this 
workflow :


- one file/node by contact,
- stored into the org-roam specific folder "/myorgroamfolder/contact/ 
with this encrypted org pattern to protect files "*.org.gpg"

- using into mu4e

There are some post exploring part of this use case on the web, but i 
first focus to *org-contacts*, because it's well integrated with mu4e 
auto-completion :


Moving from org-contrib to https://repo.or.cz/org-contacts.git , 
accessible with melpa,  the documentation is mostly into the source-code 
actually, i found few example on the web .


What property field are correct :MOBILE:, :PHONE:, :BIRTHDAY: , and ?

I found some information about configuration in Terencio Agozzino 
dotfiles (https://github.com/rememberYou/.emacs.d) but when i try to 
adapt to this use case,
that don't work, probably because i misunderstand something, about 
properties name, or localization into the .org.gpg files.


I config like that (org-contacts-file (file-expand-wildcards 
"~/my-org-roam-folder/contact/*.org.gpg))


It's slow because everything need to be unencrypted before (this is 
another problem ...) but something i don't understand is how matching 
work :
calling "M-x org-contacts", i try multiple patterns, so i'm interested 
by a working org/org-roam contact example.


I found some alternatives to test next week :

- org-vcard (on github) compatible with org-contacts, focusing on 
import/export of vcard files

- mu4e-contacts (on gitlab) using helm / mu4e, inspired by org-contacts
- org-ql query ?

Best,

Sebastien R.C



Le 27/02/2021 à 12:08, Alan Schmitt a écrit :

Hello,

This may be slightly off-topic for the list, but as I’m considering
org-contacts for my question, I hope it will be of interest here.

I would like to migrate my contact management to emacs, as I’m already
using it for email. My requirements are the following ones:
- address completion in emacs email clients (I currently use notmuch)
- support for multiple email addresses and custom fields
- creation of org links to contacts
- export to vcard format for synchronization to my mobile phone (using
vdirsyncer)
- keep the data under version control

I have looked at two tools, which almost seem fit for the job.
- ebdb does most of this, with the exception of vcard export (it seems
to be worked on, https://github.com/girzel/ebdb/issues/60), and I’m not
sure using version control on an sqlite file is a good idea.
- org-contacts also seem to have all the required features, including
vcard export (and if not sufficient there is
https://github.com/novoid/org-contacts2vcard). I was worried it was
unmaintained when looking at the copyright line, but I see in
https://code.orgmode.org/bzg/org-mode/commits/master/contrib/lisp/org-contacts.el
that there are recent commits to the file.

Do you manage your contacts in emacs? And if so, what tools or workflow
do you recommend?

Best,

Alan




Re: contact management in emacs

2021-03-10 Thread Jean Louis
* John Kitchin  [2021-03-08 23:06]:
> This question is going to go a little off the original topic. I wonder
> how far you can push your model of replacing the org-file with a
> database.

Those functions which I use most often I can fully replace with the
database work. The visual stuff is handled by tabulated-list-mode, so
I cannot currently see the contents of a simple heading unless I press
a key. But I am sure that database based Org style editing is possible
in general.

What I mean is that one could have an Org file displayed but
internally all of its structures could be translated on the fly into
the database. This would allow collaboration with many users and
finely based version control of each elements of the structure.

I think that automatic update and version control of each contents of
a heading could be saved to database, or it could be saved to database
by using key or by switching from one heading to other heading.

If user switches to other heading, would that other heading be edited
by other user in the same time, that other heading could be
automatically updated.

I was making simple functions to move Org headings into the database,
and functions to move database entries into Org files on the fly.

IMHO, what Org does is either intentionally or not intentionally, or
mixed-wise related to Doug Engelbart's work. 

TECHNOLOGY TEMPLATE PROJECT OHS Framework 
https://www.dougengelbart.org/content/view/110/460/

> This question is going to go a little off the original topic. I wonder
> how far you can push your model of replacing the org-file with a
> database.

After that introduction, and I hope you understand what I wrote (as I
am not sure if I have expressed myself well enough), then I can answer
how far it may be pushed. I have defined in my software Hyperscope
that each node can have different type. All nodes have its ID
numbers. So now I could say that nodes have various finely grained
types such as:

- Subtree (This could be considered either heading or title in Org
  editing), it contains other nodes. 

- headings or subtrees within subtree are similar to sub-headings in
  Org editing

- I can define Org Babel-like nodes, for example now I have SQL
  output, I can enter SQL SELECT and get the report. That type of node
  definition is alternative to Org Babel. I did not work much on it,
  but it is not hard to define. As soon as the node type is defined,
  inside of the node type there could be defined, even inside of the
  database, on how to run or execute that code block. Right now I am
  hardcoding that.

- then I can go finely grained, I could say: this node is
  paragraph. But I need not do that.

- then I could go more finely grained, I could say this node is a list
  of items, but I could also say this node is one item within a list.

- I could say this is one line as node, or this is one sentence as
  node.

- I could say this is one word within a sentence.

That means I can defined "Elementary objects" as defined here:
https://www.dougengelbart.org/content/view/110/460/#2a1a

Objects are basic content packets of an arbitrary, user and developer
extensible nature. Types of elementary objects could contain text,
graphics, equations, tables, spreadsheets, canned-images, video,
sound, code elements, etc.

Now you can imagine that those paragraphs could be reused in various
Org files, reusing such paragraphs becomes trivial. There is no copy
and paste any more, just one time definition where some paragraph
shall be inserted:

- edit subtree of nodes
- decide where to insert some other existing node
- insert it and forget about it

This then allows editing of the subtree (Org equivalent) node A or
node B, and each time that paragraph is edited it is also changed in
the other subtree. Copying subtrees so that they do not synchronize is
naturally possible.

Finely grained definition of nodes allows for finely grained
referencing to those nodes what is currently not possible with Org
mode. I have researched that option.

Review this page: https://www.dougengelbart.org/content/view/110/460/
and you will see how each paragraph is finely referenced on that
page. Specific referencing enhances educational capabilities in
specialization on specific subject. It saves times, efforts, also a
lot of money.

Imagine group of 20 miners and their 3 administrators who are supposed
to work on a lead mine, they did finish their general education, but
now they are faced with specialized subject of "lead mining". Having a
very precise set of references to lead mining saves money, as
education of miners and administrators is paid in their salaries, if
they are reading irrelevant instructions or if they are offered whole
books to read and find references themselves, that would spend 20
times plus 3 times more money for their time to gain that special
knowledge. Having a finely grained set of references that has to be
read by those specific people specializes those people to the specific
subject of know

Re: contact management in emacs

2021-03-10 Thread Jean Louis
* Jose E. Marchesi  [2021-03-08 11:12]:
> 
> >> I am recommending that you start using PostgreSQL database. I can
> >> guide you. My software is not so finished for public, but I can guide
> >> you personally and you will get stable system that lasts for years.
> >
> > Thank you for the suggestion, but for the moment I think I will
> > experiment with text-based solutions.
> 
> I use a recfile [1] to manage contacts.

Please send some samples of how it looks like.




Re: contact management in emacs

2021-03-08 Thread John Kitchin
This question is going to go a little off the original topic. I wonder
how far you can push your model of replacing the org-file with a
database. It looks like it would be easy to extend to something like a
shared bibliography.

How far could you push it for something like a shared set of documents,
e.g. a shared notebook on a project? How feasible would it be to access
tables or src blocks in these if they were in a database? or to build an
agenda from entries in the database?



Jean Louis  writes:

> * Russell Adams  [2021-02-28 12:07]:
>> The only reason I don't use BBDB is I want to use Org to allow me to
>> maintain notes about contacts (ie: CRM). Yes, I get that I could have
>> a CRM file and link in BBDB contacts, but that feels like adding
>> layers.
>
> I have replaced using Org file as the central system with the `people`
> database as the central system. This may sound confusing. Instead of
> using exclusively Org file, I am using the database and addint notes
> to people in the database. A note can have any major or minor mode,
> thus it could be text or Org file or markdown file, enriched mode or
> restructured text, asciidoc, or similar.
>
> My workflow is to find the person first, then press N to see notes, or
> M-n to create a new note. Concepts I am explaining may serve some
> people to create their own workflows.
>
> Using database for that allows easily collaboration in real time with
> other team members and inclusion or insertion of new contacts during
> marketing activities without interruption. Org files are not suitable
> for such collaborative updates.
>
>> The stumbling point for me has been exporting to my mobile phone. I'm
>> fine with a one way sync from my BBDB/Org solution to the phone, but
>> I feel like I never found a good option.
>
> bbdb-vcard package is here:
> https://melpa.org/packages/bbdb-vcard-20201016.1902.tar
>
> Jean


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



Re: contact management in emacs

2021-03-08 Thread Jose E. Marchesi


>> I am recommending that you start using PostgreSQL database. I can
>> guide you. My software is not so finished for public, but I can guide
>> you personally and you will get stable system that lasts for years.
>
> Thank you for the suggestion, but for the moment I think I will
> experiment with text-based solutions.

I use a recfile [1] to manage contacts.

[1] http://www.gnu.org/s/recutils



Re: contact management in emacs

2021-03-07 Thread Alan Schmitt
Hello,

On 2021-03-08 01:13, Jean Louis  writes:

> I am recommending that you start using PostgreSQL database. I can
> guide you. My software is not so finished for public, but I can guide
> you personally and you will get stable system that lasts for years.

Thank you for the suggestion, but for the moment I think I will
experiment with text-based solutions.

Best,

Alan


signature.asc
Description: PGP signature


Re: contact management in emacs

2021-03-07 Thread Jean Louis
* Russell Adams  [2021-02-28 12:07]:
> The only reason I don't use BBDB is I want to use Org to allow me to
> maintain notes about contacts (ie: CRM). Yes, I get that I could have
> a CRM file and link in BBDB contacts, but that feels like adding
> layers.

I have replaced using Org file as the central system with the `people`
database as the central system. This may sound confusing. Instead of
using exclusively Org file, I am using the database and addint notes
to people in the database. A note can have any major or minor mode,
thus it could be text or Org file or markdown file, enriched mode or
restructured text, asciidoc, or similar.

My workflow is to find the person first, then press N to see notes, or
M-n to create a new note. Concepts I am explaining may serve some
people to create their own workflows.

Using database for that allows easily collaboration in real time with
other team members and inclusion or insertion of new contacts during
marketing activities without interruption. Org files are not suitable
for such collaborative updates.

> The stumbling point for me has been exporting to my mobile phone. I'm
> fine with a one way sync from my BBDB/Org solution to the phone, but
> I feel like I never found a good option.

bbdb-vcard package is here:
https://melpa.org/packages/bbdb-vcard-20201016.1902.tar

Jean



Re: contact management in emacs

2021-03-07 Thread Jean Louis
* dalanicolai  [2021-02-27 23:53]:
> I think all packages fulfill your requirements. So I would say it depends
> on how many contacts you are managing. I have some experience with
> org-contacts, and I find it very convenient and straightforward. It is also
> very convenient to just use org-mode, i.e. a plain text file, for your
> contacts.

That may be convenient for friends or family, but is not a good idea
if such a contact database is to enlarge due to marketing actions.

People who collect leads and manage relations with many other people
must have straight way to manage contacts, and similar to well known
CRM systems such as SugarCRM or others. In fact contact management
could be managed by external program and database accessed through
Emacs. Though I do both with Emacs. And I like to access database from
shell as I do not use only Emacs as editor. As the database is
liberated from editor it allows access through any software or
programming language.

> Every contact is a headline and you can add any kind of property
> or tag etc. you want. Also anniversaries get added to the Agenda. You can
> very easily jump to the right contact, using imenu or swoop/swiper (I use
> `SPC j i ` in Spacemacs. So if you have less than say 300 contacts (I have
> really no clue about the number of contacts that will still work smoothly),
> then depending on how die-hard you are, I would recommend to start with
> org-contacs.

More important is how fast are contacts coming into the database. If
there are just 100 per year, then that will work well.

But marketing action of 23 hours have provided me like 1700 contacts,
so there would be no way that I ever keep up with text or hand
work. That requires automated insertion of contacts into the database,
and I use local database. Online lead capture is sent PGP encrypted by
email and emails are automatically processed and leads entered into
the local database. Placing contacts online is insecure IMHO, no
matter what is advertised about it.

> You can use org-vcard to import contacts, and org-vcard claims to
> support exports too but I did not test that yet.  Anyway, I think
> you won't loose much time with setting up org-contacts and from then
> you can slowly check out and study the other options.

I am attaching `rcd-vcard.el` that uses PostgreSQL database and my
schemas to export vCards that work nicely with
Android/LineageOS/Replicant devices. Package alone will not
work. Functions may be useful for some people to modify them as they
wish. If somebody wish to really install my system, I will be helpful
in private chat or email and guide person until it becomes functional.

Jean
;;; rcd-vcard.el --- RCD vCard functions  -*- lexical-binding: t; -*-

;; Copyright (C) 2016-2021 by Jean Louis

;; Author: Jean Louis 
;; Version: 0.1
;; Package-Requires: (rcd-utilities rcd-db-init rcd-db rcd-cf)
;; Keywords: 
;; URL: https://gnu.support/gnu-emacs/packages/rcd-vcard.html

;; This file is not part of GNU Emacs.

;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .

;;; Commentary:

;; These are the RCD vCard functions
;;
;; RCD is acronym for Reach, Connect, Deliver, my personal
;; principle and formula for Wealth.

;;; Change Log:

;;; Code:

(require 'rcd-utilities)
(require 'rcd-db-init)
(require 'rcd-db)
(require 'rcd-cf)

(defvar *rcd-vcard-version* "2.1")
(defvar *rcd-vcard-output* "~/tmp/rcd-vcards/")

(defun rcd-vcard-jabber (xmpp)
  (if (rcd-string-not-empty-p xmpp)
  (format "X-JABBER:%s\nX-JABBER;WORK:%s\n" xmpp xmpp)
""))

(defun rcd-vcard-tel (tel &optional type)
  (if (rcd-string-not-empty-p tel)
  (let* ((type (or type "CELL"))
 (type (upcase type)))
(format "TEL;%s:%s\n" type tel))
""))

(defun rcd-vcard-address (address1 city1 zip1 state1 country1 address2 city2 
zip2 state2 country2)
  (with-output-to-string
(princ "ADR;DOM;HOME;:")
(princ city1)
(princ ";")
(princ country1)
(princ "\n"))) ;; TODO

(defun rcd-vcard-phones (office mobile home other fax &optional other-2 other-3 
other-4)
  (with-output-to-string
(when office
  (princ (rcd-vcard-tel office "WORK")))
(when mobile
  (princ (rcd-vcard-tel mobile "CELL")))
(when home
  (princ (rcd-vcard-tel home "HOME")))
(when other
  (princ (rcd-vcard-tel other "OTHER")))
(when fax
  (princ (rcd-vcard-tel fax "FAX")))
(when other-2
  

Re: contact management in emacs

2021-03-07 Thread Jean Louis
* Alan Schmitt  [2021-02-27 14:09]:
> Hello,
> 
> This may be slightly off-topic for the list, but as I’m considering
> org-contacts for my question, I hope it will be of interest here.
> 
> I would like to migrate my contact management to emacs, as I’m already
> using it for email. My requirements are the following ones:
> - address completion in emacs email clients (I currently use
> notmuch)

Your question I consider very important.

I am using heavily contact management with Emacs and PostgreSQL
database. Connection between Emacs and the database is provided by the
module `emacs-libpq`: https://github.com/anse1/emacs-libpq Currently I
manage over 220,000 contacts and more than 10,000 groups that I have
named "accounts" in the database, following the long term CRM
conventions.

Address completion is simple, I press the key and query for contacts,
insert name with email address nicely formatted.

> - support for multiple email addresses and custom fields

I have made for myself such a system that I may designate Cc: Bcc:
fields or tell that all email addresses of certain person will be
used. That header format is automatically created on the fly when
composing emails. Some email attachments are sent by using external
program `mutt` on the command line. And I am using multiple
identities. Contact may have single identity or may be under account
that has assigned identity or under multiple accounts with assigned
identities. 

> - creation of org links to contacts

As there is display of a contact or profile, and I keep also Org
profiles of a contact, thus I can also create simple link to the
contact. Link creation is also easy, query for contact, insert link. 

> - export to vcard format for synchronization to my mobile phone (using
> vdirsyncer)

I have made my own exporter to vcards, so all contacts are managed by
using PostgreSQL database through Emacs. By pressing `A` I am entering
the contact into the address book. Program is meant to have multiple
address books, for example private address book could be for device
nr. 1 and business address book for device nr. 2. This way all my
devices are synchronized from my central computer. No need for remote
insecure cloud databases.

> - keep the data under version control

Any editing may be under the database backed version control. For
example in this function here below:

(defun hlink-change-type ()
  (interactive)
  (let ((id (tabulated-list-get-id)))
(when id
  (let ((new-type (hlink-types)))
(when new-type
  ;; version control begins here
  (hyperscope-vc "hlinks" "hlinks_hlinktypes" id) 
  (rcd-db-update-entry "hlinks" "hlinks_hlinktypes" "integer" id 
new-type *hs*)
  (hyperscope-refresh id))

Simple function `hyperscope-vc` keeps care of the version control.

(defun hyperscope-vc (table column id &optional description)
  "Simple version system."
  (let* ((value (rcd-db-get-entry table column id *hs*))
 (value (format "%s" value))
 (value (sql-escape-string value))
 (description (if description (sql-escape-string description) "NULL"))
 (sql (format "INSERT into vc (vc_table, 
  vc_column, 
  vc_tableid, 
  vc_value, 
  vc_description) values ('%s', '%s', %s, 
%s, %s)
 RETURNING vc_id"
  table column id value description))
 (id (rcd-sql sql *hs*)))
(if id id nil)))

Version control is thus not automatic, it has to be chosen by myself
which databases or which editing would be under version control. The
above function first obtains all values from the database and then
inserts them into the table `vc` in the database. I could then browse
the table and return back the values if I wish so. Once in the
function, I do not think about it any more.

> Do you manage your contacts in emacs? And if so, what tools or workflow
> do you recommend?

I am recommending that you start using PostgreSQL database. I can
guide you. My software is not so finished for public, but I can guide
you personally and you will get stable system that lasts for years.

First thing would be to setup the PostgreSQL module for Emacs from
sources. If you are able to do that, I can guide you to get the rest
of functionality.

Jean




Re: contact management in emacs

2021-03-03 Thread TRS-80

On 2021-02-28 04:06, Russell Adams wrote:

The stumbling point for me has been exporting to my mobile
phone. I'm fine with a one way sync from my BBDB/Org solution to the
phone, but I feel like I never found a good option.

Please share what you find works for you.


I never got further than reading about it, but I have done quite a lot
of that.  And it always seems like this is the stumbling block.
Especially two way sync (as I probably most often add new contacts
into my phone, when I am out and about).

OTOH, my PinePhone has just recently shipped, so perhaps having an
actual GNU/Linux phone (instead of Android) may suddenly obviate the
need for all these complicated workarounds...  I suppose I will be
interested in what sort of format the Contacts "app" will be storing
them on the PinePhone.  In fact, I think I will search for (or make) a
thread about that at Pine64 forums...

Cheers,
TRS-80



Re: contact management in emacs

2021-02-28 Thread Alan Schmitt
Hello,

Thanks a lot for all the replies. I migrated from bbdb to ebdb a long
time ago, and I may go back following your suggestions.

Thanks again,

Alan


signature.asc
Description: PGP signature


Re: contact management in emacs

2021-02-28 Thread Eric S Fraga
On Saturday, 27 Feb 2021 at 15:12, andrés ramírez wrote:
> This is my setup:

Thank you for this.  Works perfectly!

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.4-231-gf46925



Re: contact management in emacs

2021-02-28 Thread Russell Adams
On Sat, Feb 27, 2021 at 12:08:04PM +0100, Alan Schmitt wrote:
> Hello,
>
> This may be slightly off-topic for the list, but as I’m considering
> org-contacts for my question, I hope it will be of interest here.
>
> I would like to migrate my contact management to emacs, as I’m already
> using it for email. My requirements are the following ones:
> - address completion in emacs email clients (I currently use notmuch)
> - support for multiple email addresses and custom fields
> - creation of org links to contacts
> - export to vcard format for synchronization to my mobile phone (using
> vdirsyncer)
> - keep the data under version control
>
> I have looked at two tools, which almost seem fit for the job.
> - ebdb does most of this, with the exception of vcard export (it seems
> to be worked on, https://github.com/girzel/ebdb/issues/60), and I’m not
> sure using version control on an sqlite file is a good idea.
> - org-contacts also seem to have all the required features, including
> vcard export (and if not sufficient there is
> https://github.com/novoid/org-contacts2vcard). I was worried it was
> unmaintained when looking at the copyright line, but I see in
> https://code.orgmode.org/bzg/org-mode/commits/master/contrib/lisp/org-contacts.el
> that there are recent commits to the file.
>
> Do you manage your contacts in emacs? And if so, what tools or workflow
> do you recommend?

The only reason I don't use BBDB is I want to use Org to allow me to
maintain notes about contacts (ie: CRM). Yes, I get that I could have
a CRM file and link in BBDB contacts, but that feels like adding
layers.

The stumbling point for me has been exporting to my mobile phone. I'm
fine with a one way sync from my BBDB/Org solution to the phone, but
I feel like I never found a good option.

Please share what you find works for you.



--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



Re: contact management in emacs

2021-02-27 Thread dalanicolai
I think all packages fulfill your requirements. So I would say it depends
on how many contacts you are managing. I have some experience with
org-contacts, and I find it very convenient and straightforward. It is also
very convenient to just use org-mode, i.e. a plain text file, for your
contacts. Every contact is a headline and you can add any kind of property
or tag etc. you want. Also anniversaries get added to the Agenda. You can
very easily jump to the right contact, using imenu or swoop/swiper (I use
`SPC j i ` in Spacemacs. So if you have less than say 300 contacts (I have
really no clue about the number of contacts that will still work smoothly),
then depending on how die-hard you are, I would recommend to start with
org-contacs. You can use org-vcard to import contacts, and org-vcard claims
to support exports too but I did not test that yet.
Anyway, I think you won't loose much time with setting up org-contacts and
from then you can slowly check out and study the other options.

I do not use Emacs for email yet, but org-contacts claims to support most
of Emacs its mail-readers.

If you enjoy tweaking your setup and study a little more then maybe
directly use BBDB or EBDB. EBDB's goal is to be a modern BBDB and I guess
the main developer does a very nice job. I have no experience with these
databases, because I think they are overkill (currently) for my usecase.

Daniel Nicolai

On Sat, 27 Feb 2021 at 18:03,  wrote:

> Send Emacs-orgmode mailing list submissions to
> emacs-orgmode@gnu.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.gnu.org/mailman/listinfo/emacs-orgmode
> or, via email, send a message with subject or body 'help' to
> emacs-orgmode-requ...@gnu.org
>
> You can reach the person managing the list at
> emacs-orgmode-ow...@gnu.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Emacs-orgmode digest..."
>
>
> Today's Topics:
>
>1. Re: Turning off all indentation in 9.4.4 (TRS-80)
>2. Re: Tips on maintaining history in Org Mode (TRS-80)
>3. Re: Set archive location relative to property (TRS-80)
>4. [PATCH] ~org-font-lock-add-priority-faces~: ensure priority
>   cookies are in a headline (Sébastien Miquel)
>5. Re: Tips on maintaining history in Org Mode (Samuel Wales)
>6. Re: Tips on maintaining history in Org Mode (David Masterson)
>7. Re: Tips on maintaining history in Org Mode (David Masterson)
>8. Re: Tips on maintaining history in Org Mode (David Masterson)
>9. Re: Tips on maintaining history in Org Mode (Tim Cross)
>   10. [bug] org-yank in stars corrupts outline (Samuel Wales)
>   11. Re: [bug] org-yank in stars corrupts outline (Samuel Wales)
>   12. Re: Tips on maintaining history in Org Mode (David Masterson)
>   13. Re: Tips on maintaining history in Org Mode (Samuel Wales)
>   14. Re: Tips on maintaining history in Org Mode (Ihor Radchenko)
>   15. Re: Tips on maintaining history in Org Mode (Ihor Radchenko)
>   16. Re: Tips on maintaining history in Org Mode (Ihor Radchenko)
>   17. contact management in emacs (Alan Schmitt)
>   18. Simple org-publish configuration example in manual does not
>   work (dalanicolai)
>   19. Re: contact management in emacs (Martin Steffen)
>   20. Re: [bug] org-yank in stars corrupts outline (Maxim Nikulin)
>   21. Re: [PATCH] org-mac-link: Disable Evernote capture by default
>   (Aaron Jensen)
>   22. Re: Babel: Programmatically evaluate a heading and subtrees?
>   (ian martins)
>   23. Re: contact management in emacs (andrés ramírez)
>   24. ob-reticulate: R+Python interface from Babel (Jack Kamm)
>   25. Re: contact management in emacs (Eric S Fraga)
>   26. Re: contact management in emacs (andrés ramírez)
>   27. Re: contact management in emacs (Martin Steffen)
>   28. Re: contact management in emacs (Bob Newell)
>
>
> --
>
> Message: 1
> Date: Fri, 26 Feb 2021 14:12:09 -0500
> From: TRS-80 
> To: emacs-orgmode@gnu.org
> Subject: Re: Turning off all indentation in 9.4.4
> Message-ID: <83f49a373d71c4b786bda1ad6323c...@isnotmyreal.name>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> On 2021-02-26 01:20, Kyle Meyer wrote:
> > TRS-80 writes:
> >
> >> On 2021-02-24 15:58, TRS-80 wrote:
> >>> On 2021-02-16 23:30, Kyle Meyer wrote:
> > [...]
> >>>> So, if I'm reading your preferences correctly, it sounds like you
> >>>> want
> >>>> just the first suggestion in the above snippet, leaving
> >>>> org-adapt-indentation at its default value:
> >>>>
> >>>>

Re: contact management in emacs

2021-02-27 Thread Dr. Arne Babenhauserheide

Martin Steffen  writes:

> I use bbdb (big-brother data base). I use it since a looong time
> already, and amassed 15000 or so contracts. It does what I want, it's
> text-based, so versioning is not a problem.

And it is fast; lookup feels instantaneous — different from many other
address-manager solutions.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken


signature.asc
Description: PGP signature


Re: contact management in emacs

2021-02-27 Thread Bob Newell
I've used BBDB for years, and have tried org-contact, but it
didn't seem to scale to the now rather large size of my BBDB
database.

I've looked at migrating to EBDB but as I have many custom
functions I haven't yet made the move.

BBDB can do amazing things. I've mentioned some of them
before. Of course org links are supported, and in conjunction
with the 'gnorb' package, Gnus email can be associated with
BBDB entries in interesting ways.

I use BBDB to easily maintain a slew of mailing lists. I also
have custom functions to set the input language mode for those
with whom I correspond in non-English languages. I even use
BBDB to initiate phone calls when I'm on my desktop computer.

I hadn't thought to put BBDB under version control but that
would be very easy.

However you don't need to get fancy right away. All the basics
are there. Like many things Emacs, it does take time to get
things set up the way you wish, but that time is well repaid
down the road a little.

-- 
Bob Newell
Honolulu, Hawai`i

- Via GNU/Linux/Emacs/Gnus/BBDB



Re: contact management in emacs

2021-02-27 Thread Martin Steffen
> "Eric" == Eric S Fraga  writes:

Eric> How do you get these to appear?  Or is the "could" a wish?

It's ``automatic''. The entry of the person needs a field "anniversary",
if that's filled with a date in -mm-dd format, it's included
(perhaps one has to set a variable like ``show-bbdb-anniversaries''
and/or load a corresponding elisp-addition.)


Martin




Eric> thank you, eric -- : Eric S Fraga via Emacs 28.0.50, Org
Eric> release_9.4.4-231-gf46925




Re: contact management in emacs

2021-02-27 Thread andrés ramírez
Hi. Eric.

> "Eric" == Eric S Fraga  writes:


[...]


Eric> How do you get these to appear?  Or is the "could" a wish?

This is my setup:
--8<---cut here---start->8---
(setq org-agenda-files (directory-files "~/docs/org/deft/" t ".*agenda\.org$"))
--8<---cut here---end--->8---

~/docs/org/deft/bbdb-anniversary-trick.agenda.org:
--8<---cut here---start->8---
* anniversary [isodate] 
  :PROPERTIES:
  :CATEGORY: bbdb
  :END:
%%(when (fboundp 'my/org-bbdb-anniversaries) (my/org-bbdb-anniversaries))
--8<---cut here---end--->8---

--8<---cut here---start->8---
(defun my/org-bbdb-anniversaries ()
"It does not work on emacs-23"
  (when (/= 23 emacs-major-version)
(org-bbdb-anniversaries)
)
  )
  --8<---cut here---end--->8---

the bbdb record should have the field anniversary:
--8<---cut here---start->8---
anniversary: 1960-03-03 custom
--8<---cut here---end--->8---

Best Regards



Re: contact management in emacs

2021-02-27 Thread Eric S Fraga
On Saturday, 27 Feb 2021 at 13:20, andrés ramírez wrote:
> bbdb anniversaries could also appear  on agenda:

How do you get these to appear?  Or is the "could" a wish?
thank you, eric
-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.4-231-gf46925



Re: contact management in emacs

2021-02-27 Thread andrés ramírez
Hi. Martin and  Alan.

> "Martin" == Martin Steffen  writes:


[...]


Martin> Org is also bbdb-aware, insofar one can do those links: instead of 
[[file:][yyy]]
Martin> one can use [[bbdb:somecriterion]].

bbdb anniversaries could also appear  on agenda:
--8<---cut here---start->8---
10 days-agenda (W08-W09):
Wednesday  24 February 2021
Thursday   25 February 2021
Friday 26 February 2021
Saturday   27 February 2021
Sunday 28 February 2021
Monday  1 March 2021 W09
Tuesday 2 March 2021
Wednesday   3 March 2021
  bbdb:   [[bbdb:Pedro ][Pedro  61st custom anniversary]]
Thursday4 March 2021
Friday  5 March 2021
--8<---cut here---end--->8---

Andrés Ramírez



Re: contact management in emacs

2021-02-27 Thread Martin Steffen




I use bbdb (big-brother data base). I use it since a looong time
already, and amassed 15000 or so contracts. It does what I want, it's
text-based, so versioning is not a problem.

I think it can do vcard export (though when I used vcards is a long
time ago, I can't remember if that was smooth, I think it was with one
of my first smart phone, and I wanted to quick fill up the phone book
there with my ``emacs-managed'' contact data base.).

One can add used defined fields (where one can ``match'' all contacts
for some criterion, and send then ``bulk'' email.

Org is also bbdb-aware, insofar one can do those links: instead of
[[file:][yyy]] one can use [[bbdb:somecriterion]].

I don't know if it matches your needs, but I can't say bad things about
that bbdb-thing.

Martin





contact management in emacs

2021-02-27 Thread Alan Schmitt
Hello,

This may be slightly off-topic for the list, but as I’m considering
org-contacts for my question, I hope it will be of interest here.

I would like to migrate my contact management to emacs, as I’m already
using it for email. My requirements are the following ones:
- address completion in emacs email clients (I currently use notmuch)
- support for multiple email addresses and custom fields
- creation of org links to contacts
- export to vcard format for synchronization to my mobile phone (using
vdirsyncer)
- keep the data under version control

I have looked at two tools, which almost seem fit for the job.
- ebdb does most of this, with the exception of vcard export (it seems
to be worked on, https://github.com/girzel/ebdb/issues/60), and I’m not
sure using version control on an sqlite file is a good idea.
- org-contacts also seem to have all the required features, including
vcard export (and if not sufficient there is
https://github.com/novoid/org-contacts2vcard). I was worried it was
unmaintained when looking at the copyright line, but I see in
https://code.orgmode.org/bzg/org-mode/commits/master/contrib/lisp/org-contacts.el
that there are recent commits to the file.

Do you manage your contacts in emacs? And if so, what tools or workflow
do you recommend?

Best,

Alan


signature.asc
Description: PGP signature