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: Wed, 2 Jun 2021 06:43:35 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* Eduardo Ochs <eduardoochs@gmail.com> [2021-06-02 03:56]:
> On Tue, 1 Jun 2021 at 13:32, Jean Louis <bugs@gnu.support> wrote:
> >
> > You can use org-protocol and this extension:
> > https://support.mozilla.org/1/firefox/88.0/Linux/en-US/extensions-pb
> 
> 
> Hi Jean Louis,
> 
> I am quite slow at following textual instructions like these, and at
> converting them to executable steps (accompanied by links to the
> relevant documentation). You've probably noticed that the sandboxed
> tutorials of eev are an experiment in writing instructions in another
> way - in which the steps are very easy to execute, there are lots of
> hyperlinks to documentation, to source code, and to tests that explain
> the data structures and the behaviours of individual functions... and
> they are an attempt to find other people who like that style, and who
> would want to experiment with writing their own documentation in that
> way, too.
> 
> I'll try to follow your instructions in the weekend. I am guessing
> that they will take me many hours, because I know very little about
> databases and SQL, and because org-capture and org-protocol also seems
> to be quite complex beasts.

org-protocol is about sending information from outside of Emacs to
Emacs, normally people capture things in Org files, but because you
can use any function, you can make your own to capture things into eev
hyperlinks.

Using browser for org-protocol is one of possible methods, one could
use various outside programs or methods.

First thing to do is to customize the variable: `org-protocol-protocol-alist'

----- See more of its description with C-h v:
org-protocol-protocol-alist is a variable defined in ‘org-protocol.el’.

Its value is
(("Hyperscope Store Hyperlink" :protocol "store-link" :function 
hyperscope-org-protocol-store-link)
 ("Hyperscope Capture From Hyperlink" :protocol "capture" :function 
hyperscope-org-protocol-capture-link :kill-client t))
Original value was nil

  You can customize this variable.

Register custom handlers for org-protocol.

Each element of this list must be of the form:

  (module-name :protocol protocol :function func :kill-client nil)
---------

"store-link" is just to store the link in this case, it should be
quick; it will store title and hyperlink that browser is visiting;

"capture" is to store the marked text in the browser and the hyperlink
and title together;

For you it could be this way:

----
(("Eev Store Hyperlink from Browser" :protocol "store-link" :function 
eev-org-protocol-store-link)
 ("Eev Capture From Browser" :protocol "capture" :function 
eev-org-protocol-capture-link :kill-client t))
---

Your function for "store-link" would be like this:

(defun eev-org-protocol-store-link (query)
  (let* ((splitparts (org-protocol-parse-parameters query t))
         (uri (org-protocol-sanitize-uri (plist-get splitparts :url)))
         (title (plist-get splitparts :title))
         (my-file "~/my-eev-captured-hyperlinks.eev"))
    (with-temp-file
        (insert-file-contents my-file)
      (insert "\n" title "\n" "(find-firefox \"" uri "\")\n\n"))))

Now when you use that extension I recommended (for others I don't
know), you would quickly store the hyperlink in the file in the
eev style just by clicking in the browser at right place.

When this starts working, let me know, then we move to capturing
more text then just the title and link. But same concept is used
with the difference that you would open the capturing file for
editing maybe. It would not be just click and go, it would be
click, and Emacs buffer is opened for you to edit the captured
text, title and hyperlink.

-- 
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]