From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: Maybe we can improve this function call-process-to-string? Date: Thu, 8 Apr 2021 21:32:20 +0300 Message-ID: References: <83a6q99pnd.fsf@gnu.org> <831rbkao9z.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38896"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0.6 (2021-03-06) Cc: help-gnu-emacs@gnu.org To: Arthur Miller Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 08 20:36:22 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUZVs-0009zK-MA for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 08 Apr 2021 20:36:20 +0200 Original-Received: from localhost ([::1]:50730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUZVr-0000mS-Hg for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 08 Apr 2021 14:36:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUZV7-0000gy-8M for help-gnu-emacs@gnu.org; Thu, 08 Apr 2021 14:35:33 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:41735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUZV4-00032K-Rs; Thu, 08 Apr 2021 14:35:32 -0400 Original-Received: from localhost ([::ffff:41.202.241.27]) (AUTH: PLAIN securesender, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000001DF49.00000000606F4CEF.000014D4; Thu, 08 Apr 2021 11:35:27 -0700 Mail-Followup-To: Arthur Miller , Eli Zaretskii , help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:128907 Archived-At: * Arthur Miller [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/