github-alphapapa

joined 1 year ago
[–] github-alphapapa@alien.top 1 points 11 months ago (3 children)

Is it just me or have there been a lot of posts lately from accounts with overall negative comment karma.

[–] github-alphapapa@alien.top 1 points 11 months ago

It might seem like a subtle improvement to you but I really think it actually achieves the goal of making it so that you can kind of get the structure of the code just from glancing at the colors.

Structure, from colors. I don’t know, I have never tried to infer structure from colors in the code.

This is what prism.el provides: color reflects logical depth, which signifies the primary aspect of structure. IMHO it is generally more useful than making function names stand out (their position makes them stand out anyway), variable declarations a certain color (though helpful, I don't need to see that constantly), etc. A well-written piece of code communicates a lot by its shape, which logical colorization helps to reveal.

[–] github-alphapapa@alien.top 1 points 11 months ago

I didn't say it would be easy. ;)

[–] github-alphapapa@alien.top 1 points 11 months ago (2 children)

I guess you should try Commercial Emacs, then.

[–] github-alphapapa@alien.top 2 points 1 year ago (1 children)

can someone help or give me some YT videos to watch to have a good idea about emacs ?

I hesitate to be the curmudgeon here, but if you can't--or won't--bother to visit youtube.com and type "emacs" into the search box, then you probably won't enjoy using Emacs. Emacs is most appreciated by people who take a bit of initiative.

[–] github-alphapapa@alien.top 1 points 1 year ago (1 children)
[–] github-alphapapa@alien.top 1 points 1 year ago

Please do not answer if you are not willing to tell me exactly what to put in my init.el file.

Please do not ask if you are not willing to google your question first. We are not ChatGPT.

[–] github-alphapapa@alien.top 1 points 1 year ago

"i want a video or a proof" that you googled these questions and found no answers

Since this question is asked at least weekly, you should have.

We do users like this no favors by indulging them.

[–] github-alphapapa@alien.top 1 points 1 year ago

Probably not what you want to do, but IIUC you could run Emacs from Cygwin and it wouldn't have that problem.

[–] github-alphapapa@alien.top 1 points 1 year ago

These should be functions instead of macros.

As well, being that simple, they shouldn't generally exist at all. Rather, the dolist forms should just be inlined. (This is probably the usual case of a user who just learned about macros and is excited to use them, and so overuses them. We've all been there. :)

[–] github-alphapapa@alien.top 1 points 1 year ago (1 children)

Emacs is more like a piece of marble. Harder to work with but has so much more potential.

More like a ball of clay: infinitely and trivially malleable. And you can bake parts of it into ceramic whenever you want.

[–] github-alphapapa@alien.top 1 points 1 year ago (1 children)

My first suggestion would be to use plz for HTTP. Then I'd use cl-loop and pcase to simplify the rest of the code. Here's a partial rewrite with a TODO for further exercise. :)

(defun wikipedia-article-references (subject)
  (let* ((url (format "https://en.wikipedia.org/wiki/%s" (url-hexify-string subject)))
         (dom (plz 'get url :as #'libxml-parse-html-region)))
    (cl-loop for cite-tag in (dom-by-tag dom 'cite)
             for cite-class = (dom-attr cite-tag 'class)
             collect (pcase cite-class
                       ((rx "journal")
                        (let ((a-tag (dom-search cite-tag
                                                 (lambda (tag)
                                                   (string-prefix-p "https://doi.org" (dom-attr tag 'href))))))
                          (cons (concat "doi:" (dom-text a-tag))
                                ;; TODO: Use `string-match' with `rx' and `match-string' here.
                                (let* ((cite-texts (dom-texts cite-tag))
                                       (title-beg (1+ (string-search "\"" cite-texts)))
                                       (title-end (string-search "\"" cite-texts (1+ title-beg))))
                                  (substring cite-texts title-beg title-end)))))
                       ((rx "book")
                        (let ((a-tag (dom-search cite-tag
                                                 (lambda (tag)
                                                   (string-prefix-p "/wiki/Special:BookSources" (dom-attr tag 'href))))))
                          (cons (concat "isbn:" (dom-text (dom-child-by-tag a-tag 'bdi)))
                                (dom-text (dom-child-by-tag cite-tag 'i)))))
                       (_ (let ((a-tag (assoc 'a cite-tag)))
                            (cons (dom-attr a-tag 'href) (dom-text a-tag))))))))

Regarding this:

And yes, I know that I could probably use a library like s, dash, seq, or cl, but I try to keep my elisp functions free of those kind of things

First of all, cl and seq are built-in to Emacs and are used in core Emacs code. There's no reason not to use them. Second, dash and s are on ELPA and are widely used; it's largely a matter of style, but they are solid libraries, so again, no reason not to use them. They don't have cooties. ;)

view more: ‹ prev next ›