help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How users start programming in Emacs Lisp...


From: Jean Louis
Subject: Re: How users start programming in Emacs Lisp...
Date: Sun, 30 May 2021 10:05:01 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* Eduardo Ochs <eduardoochs@gmail.com> [2021-05-30 07:33]:
> Hi, just a curiosity...
> 
> why do you prefer to use scratch buffers for elisp code instead of
> using (semi-scratch?) files in which we record all our experiments?

I use *scratch* buffer long time. It is for things that need not be
saved. There is `persistent-scratch' library loaded that does save it
over the sessions. However, whatever I write there is not of
importance if it is lost.

And temporary buffers I use because I don't want to save such. That is
where I evaluate and test things that don't belong to any file neither
should be saved. Bufffer could be saved though if necessary. 

> In the tutorials of eev I try to convince the new users to treat their
> notes and scratch code as "field notes", and save everything they
> can... one of my arguments is this:

Then it is not temporary any more, not scratch any more. Not something
being free to forget it and drop it. Temporary buffer is just a more
static version of IELM, or more expanded version of M-: so things in
M-: evaluation I also don't save; with the difference that scratch
buffer is separated from other buffers, it will not work with buffer
variables, and in my case I never need such.

Example text in Emacs Lisp scratch that still hangs there is the stuff
with Fortran discussion where some testing of outline-minor-mode was required:

```
outline-regexp ⇒ "[*]+"
(setq outline-regexp "[!]+")
outline-heading-alist ⇒ nil
(setq outline-heading-alist '(("!" . 1) ("!!" . 2) ("!!!" . 3)))

!     ! Something
      Program
      nOK
!!!     Somethingp
!     Something
      More
Something
```

that stuff I would not save. The point learned is that there are
variables to be set for outline-minor-mode for it to make it work. I
don't need to know which variables, I will find them in future by
inspecting {C-h v outline TAB} list of variables or by 
{M-x customize-group RET outlines RET}

> Learning eev is also like learning to use paper notebooks. It is
> much easier to understand the notes and ideas what we wrote
> ourselves in our notebooks than to understand what other people
> wrote in their notebooks... 

That is right. I like any guidances related to notes, you remember
that I switched from Org and file system based editing to mostly
database backed column's value editing so it is always relevant to
me. `eev' can be used there I guess.

> when we go back to what _we_ wrote we are able to reconnect with
> what we were thinking, even when our notes are quite terse because
> we did not write down all details - and we can't do that with other
> people's notes.

That is right. What is interesting in my system is that I have:

- dates that are relevant to creation of a node (which can be of any type);

- dates relevant to modification of a node;

- which user in collaboration created it, or modified it;

- any access and additional actions on a single node/document are
  recorded, for example change of a name from Johnny to John would be
  recorded by its date/time and by user name;

- any activation of a node/document, like opening of a hyperlink is
  recorded too, automatically; if user did read the note, or modified
  the node/document, or opened up the document is recorded;

- and so on; that all works without disturbance for user;

Then the whol track or history can be played back, it is possible to
find out:

- which people or participants where assigned to tasks or documents at
  specific times, dates in past;

- which stuff was researched back in time;

- related to which groups, companies, organizations, people, projects,
  etc.

Those are not main feautures, just side effects. 

Some of such features are within these Hyperscope ring functions:

;;;; ↝ HYPERSCOPE RING FUNCTIONS

Here is the variable initialization defined by fetching information
from a database:

(defvar hyperscope-ring-current
  (rcd-sql-first "SELECT hyperscopering_id FROM hyperscopering ORDER BY 
hyperscopering_id DESC LIMIT 1" hs-db)
  "Hyperscope's current ring item.")

The "ring" remains in the database and can be stored in a variable,
but it is persistent along sessions.

(defvar hyperscope-ring
  (rcd-sql-list "SELECT hyperscopering_hyperdocument FROM hyperscopering ORDER 
BY hyperscopering_id DESC" hs-db)
"Hyperscope ring uses RCD utilities function
  `next-circular-list-item'")

However it is not yet upgraded for multiple users, as then I just need
to add the columns like `usercreated' and `usermodified' so that ring
becomes collaborative:

 hyperscopering_id            | integer                     |
 hyperscopering_datecreated   | timestamp without time zone |
 hyperscopering_datemodified  | timestamp without time zone |
 hyperscopering_usercreated   | text                        |
 hyperscopering_usermodified  | text                        |
 hyperscopering_hyperdocument | integer                     |
 hyperscopering_description   | text                        |

Then instead of this function:

(defvar hyperscope-ring-current
  (rcd-sql-first "SELECT hyperscopering_id FROM hyperscopering WHERE ORDER BY 
hyperscopering_id DESC LIMIT 1" hs-db)
  "Hyperscope's current ring item.")

I would need to use this one:

(defvar hyperscope-ring-current
  (rcd-sql-first "SELECT hyperscopering_id FROM hyperscopering WHERE 
hyperscopering_usercreated = current_user ORDER BY hyperscopering_id DESC LIMIT 
1" hs-db)
  "Hyperscope's current ring item.")

As that one would choose only those items related to current user of
the database. Thus multiple users can contribute documents where all
things get tracked.

Choosing the last item accessed or activated is easy:

(defun hyperscope-ring-last ()
  (rcd-sql-first "SELECT hyperscopering_hyperdocument FROM hyperscopering WHERE 
hyperscopering_usercreated = current_user ORDER BY hyperscopering_id DESC LIMIT 
1" hs-db))

Updating new items is just calling the function, while ignoring
duplicates (who knows maybe duplicates are also important):

(defun hyperscope-ring (id)
  "Setup Hyperscope ring"
  (let ((last (hyperscope-ring-last)))
    (cond ((null last) (hyperscope-ring-update id))
          ((= last id) (ignore))
          (t (hyperscope-ring-update id)))))

And here is how somebody is recording everything within Memacs:

Memacs
https://github.com/novoid/Memacs

>   (From:)
>   http://angg.twu.net/eev-intros/find-here-links-intro.html
>   (find-here-links-intro)
> 
> Grepping and `C-s'-ing our own notes is easy, and most of the time we
> can read - and reuse - what we wrote.

Often I am re-using notes, or duplicating it to have a new version,
single click, and then editing new version. Unless those are some
disposable notes.

Then again I have a `hyperscope-capture-buffer' function where
whatever I write in other buffer is captured in the dynamic knowledge
repository. Then such function leaves a link like this one, as if I
placed the "stamp" in the email, I can quicker find some important
email captured as a note: (hyperscope 38116)

Description of such note is:

* Captured Buffer Text

Buffer name: mutt-protected-1001-4182-5758066564440477891
Buffer file: 
/home/data1/protected/tmp/mutt-protected-1001-4182-5758066564440477891
Time captured:  2021-05-30-09:34:13

Why would anybody "capture" one's own buffer? Well, why not, it can be
single key, some text that can be re-used for later or re-ordered for
articles. The difference is that "grep" need not be used but full text
search and results for searching "eev" appear almost instantly. A node
can be related to Eduardo Ochs and later the notes related to single
person can be listed. 

A classic file system allows user tags and group tags, but nothing
about relations to other people, groups, organizations, various
activities or businesses. 

> By the way (for Christopher): eev has a hands-on elisp tutorial. It's
> here:
> 
>   http://angg.twu.net/eev-intros/find-elisp-intro.html
>   (find-elisp-intro)

Hyperlink generation functions are useful. I don't know if I can use
such to enter URL into the database for example, you tell me.

You have PDF link generation functions. But is it generic that I could
connect it to something else? For example to invoke a key, capture the
PDF URL or URL or file system location (also link) and return it as
link which can be then entered in the database. Or is it hard coded?

And finally why not integrate the database in your system, it would
help greatly. Install this module:

emacs-libpq @ Github
https://github.com/anse1/emacs-libpq

Then install this package:

RCD Database Basics
https://hyperscope.link/3/7/4/9/3/RCD-Database-Basics-37493.html

Then use M-x cf-sql-table to design your own first SQL table. 

Integrate eev with permanent database backed information.


-- 
Jean

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

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]