unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: help-gnu-emacs@gnu.org
Subject: Re: How to rename files to numbers in Eshell?
Date: Fri, 1 Oct 2021 00:42:31 +0300	[thread overview]
Message-ID: <YVYvR4mP5/TE0nJ2@protected.localdomain> (raw)
In-Reply-To: <87h7e2krgb.fsf@zoho.eu>

* Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-09-30 18:48]:
> Felix E. Klee wrote:
> 
> >> Pipes may be replaced by buffers, capturing information in
> >> a buffer and processing it thereafter.
> >
> > ... which makes it super slow
> 
> But Jean is re-writing all his Bash to Elisp so he surely has
> a lot of time :)

Or maybe there is not much of Bash as my "Bash" scripts were mostly
Common Lisp, Perl, etc.

> No, seriously, Jean, while in general I absolutely cannot
> understand this idea or see the benefits, I'm sure there are
> many cases where a Lisp solution (Elisp solution from Emacs)
> is as good or even better - so when you stumble upon those
> cases in your translating efforts, by all means do show it
> to us!

I guess that is hard to believe as you are in Emacs Lisp mailing list,
it is hard to believe you cannot understand the idea of using Emacs
Lisp, you who has hundreds of Emacs Lisp scripts.

Bash is different environment to Emacs, when person works in one
environment then person tends to integrate missing peaces. Would I
work in Racket, I would most probably rewrite it all to Racket.

> Post the code here as you do, it is appreciated despite my
> style issues with your code ...

I care only if it works.

Here are few examples that invoke `yad' dialog generator from Emacs.

(defun call-process-to-string (program &optional infile display &rest args)
  (with-temp-buffer
    (apply #'call-process program infile t display args)
    (buffer-string)))

(defun rcd-command-output-from-input (program input &rest args)
  "Return output string from PROGRAM with given INPUT string and optional ARGS."
  (let* ((output (with-temp-buffer
		   (insert input)
		   (apply #'call-process-region nil nil program t t nil args)
		   (buffer-string))))
    output))


;;;; ↝ YAD DIALOGS

(defun yad-command (&rest args)
  (apply 'call-process "yad" nil nil nil args))

(defun yad-calendar-date ()
  (string-trim
   (call-process-to-string "yad" nil nil "--calendar" "--center" "--date-format=%Y-%m-%d")))

(defun yad-text (title text body &optional center no-buttons text-align width height)
  "TEXT-ALIGN can be left, center, right and full."
  (let* ((center (when center "--center"))
	 (text-align (when text-align text-align))
	 (no-buttons (when no-buttons "--no-buttons"))
	 (width (when width (format "--width=%s" width)))
	 (height (when height (format "--height=%s" height)))
	 (list (delq nil (list center text-align no-buttons width height))))
    (apply 'rcd-command-output-from-input "yad" body "--text-info" "--title" title "--text" text "--fontname=DejaVu 18" list)))


-- 
Jean

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

In support of Richard M. Stallman
https://stallmansupport.org/



  reply	other threads:[~2021-09-30 21:42 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-11 13:15 How to rename files to numbers in Eshell? Felix E. Klee
2021-09-11 13:40 ` Jean Louis
2021-09-12  8:44   ` Felix E. Klee
2021-09-12 19:03     ` Jean Louis
2021-09-13  9:28       ` Jean Louis
2021-09-13 11:52         ` tomas
2021-09-14  7:42         ` Felix E. Klee
2021-09-14  9:17           ` Jean Louis
2021-09-14  9:32             ` tomas
2021-09-14 11:11             ` Felix E. Klee
2021-09-14 13:37               ` Jean Louis
2021-09-14 15:48                 ` Felix E. Klee
2021-09-16 22:37                   ` Michael Heerdegen
2021-09-16 22:47             ` Michael Heerdegen
2021-09-17  7:27               ` Felix E. Klee
2021-09-24  7:21         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-25 13:43           ` Jean Louis
2021-09-26  2:50             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30  6:38         ` Felix E. Klee
2021-09-30  7:37           ` Jean Louis
2021-09-30  7:50             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30 13:17             ` Felix E. Klee
2021-09-30 15:34               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30 21:42                 ` Jean Louis [this message]
2021-10-01  0:09                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-01 20:51                     ` Jean Louis
2021-10-01 21:34                       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-02  7:53                         ` Lack of integration in Emacs - it was " Jean Louis
2021-10-03  8:16                           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-03  9:27                             ` Jean Louis
2021-10-04  3:29                               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-04 10:15                                 ` Jean Louis
2021-10-04 11:22                                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-22 14:46       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-22 14:27   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-16 12:15 ` Felix E. Klee
2021-09-16 15:11   ` Nick Dokos
2021-09-16 16:07     ` Felix E. Klee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YVYvR4mP5/TE0nJ2@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).