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

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

Re: Maybe we can improve this function call-process-to-string?


From: Jean Louis
Subject: Re: Maybe we can improve this function call-process-to-string?
Date: Thu, 8 Apr 2021 21:32:20 +0300
User-agent: Mutt/2.0.6 (2021-03-06)

* Arthur Miller <arthur.miller@live.com> [2021-04-08 20:21]:
> I would also not use a string for the final result(s), just do everyting
> in that buffer, remove text you don't need and construct your link(s) in
> that buffer, it will probably be faster than creating temp buffer and
> taking buffer strings.

Thank you Arthur, just that I need it in programmed way. I don't
construct links myself interactively, I may interactively select files
in Dired, then functions do the rest and construct links.

Of course if I wish to inject some output from a system command
interactively, I have it built in into my fingers.

C-u M-! and there it goes. I need to reconstruct how to write that
command, as it is just built in the body.

Those needs are integrated, for example selecting bunch of directories
in Dired, and letting functions traverse and construct Markdown WWW
links or other WWW links, transferring it as a reference to somebody
or into the database or into the page.

> >     (push (shell-command-to-string command) list)))
> >     (kill-new (with-temp-buffer
> >             (dolist (item list)
> >               (insert item))
> >             (buffer-string)))))
> 
> It is really inneficient to push result form the command to a list to
> traverse it later and insert into buffer, when Emacs does that already
> for you by default.

I would like to agree, but don't understand it. I don't like
dolist/dotimes any more, so I am replacing it with `while' here
below. There is still pushing into the list.

How would I do it by default?

(defun md-image-hyperlink ()
  (interactive)
  (let ((files (dired-get-marked-files))
        (list '()))
    (while files
      (let* ((file (pop files))
             (small-image (public-html-rest file))
             (large-image (replace-regexp-in-string 
"/320/\\|/400/\\|/640/\\|/800/" "/1536/" small-image))
             (command (format "identify -format '[![%s](%s =%%wx%%h \"%s\")](%s 
\"%s\")' '%s'" small-image small-image small-image large-image large-image 
file)))
        ;; (message "%s" command)
        (push (shell-command-to-string command) list)))
    (kill-new (with-temp-buffer
                (while list
                  (insert (pop list)))
                (buffer-string)))))

> Your website looks very deceptive to me. I don't remember the name of
> that guy that used to post on this list for a while that was rude to
> you, but looking at your site now I understand what he ment. I have no
> idea who you are or what you do, but something tells me that is not an
> official GNU support site, isn't it?

There was no domain with support.gnu, so I took gnu.support

> Maybe you have all best intentions, but it looks shady, more akin to
> a scam page.

OK, did you get maybe some offer to buy? Did you have any relation
with the site? Lost something?

 _     ___  _     
| |   / _ \| |    
| |  | | | | |    
| |__| |_| | |___ 
|_____\___/|_____|
                  

I really admire programmers, but sometimes I get stunned with
nonsensical illogical reasoning.

> Hopefully that form on the front page looks so ugly so nobody will
> fall for it

Do I really care? Does anybody care? Do I need to care?

> but if I would you and value GNU movement as much as you do, I would
> probably change that domain name and removed that from the web, as
> well as changed that email from "bugs@gnu.support" to something less
> deceptive, because it also looks shady to me.

Enjoy your impressions, I will rather watch SF.

> I am by no mean associated with GNU, more than being a mere user of
> GNU software, so I can only express my personal feeling when I saw
> it.

That is totally fine, thank you for sharing. Recommended reading:
https://nowandme.com/


-- 
Jean

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

Sign an open letter in support of Richard M. Stallman
https://rms-support-letter.github.io/




reply via email to

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