* How to rename files to numbers in Eshell? @ 2021-09-11 13:15 Felix E. Klee 2021-09-11 13:40 ` Jean Louis 2021-09-16 12:15 ` Felix E. Klee 0 siblings, 2 replies; 38+ messages in thread From: Felix E. Klee @ 2021-09-11 13:15 UTC (permalink / raw) To: help-gnu-emacs Consider a list of files: $ ls -1 *.jpg IMG_20210909_0003.jpg IMG_20210909_0004.jpg IMG_20210909_0005.jpg IMG_20210909_0006.jpg IMG_20210909_0007.jpg … I want to rename these files to `1.jpg`, `2.jpg`, …, and I know how to do it with Dired. However, this time I want to do it with Eshell. My own attempt, works, but I think there should be an easier way: $ listify *.jpg $ setq my-files $$ $ setq my-numbers $(number-sequence 1 (length my-files)) $ setq my-pairs $(mapcar* 'cons my-files my-numbers) $ for pair in $my-pairs { setq a (car pair); setq b (cdr pair); mv $a "$b".jpg } PS: I already posted this on Emacs Stack Exchange <https://emacs.stackexchange.com/q/68445/5327>. ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 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-22 14:27 ` Emanuel Berg via Users list for the GNU Emacs text editor 2021-09-16 12:15 ` Felix E. Klee 1 sibling, 2 replies; 38+ messages in thread From: Jean Louis @ 2021-09-11 13:40 UTC (permalink / raw) To: Felix E. Klee; +Cc: help-gnu-emacs * Felix E. Klee <felix.klee@inka.de> [2021-09-11 16:16]: > Consider a list of files: > > $ ls -1 *.jpg > IMG_20210909_0003.jpg > IMG_20210909_0004.jpg > IMG_20210909_0005.jpg > IMG_20210909_0006.jpg > IMG_20210909_0007.jpg > … > > I want to rename these files to `1.jpg`, `2.jpg`, …, and I know how to > do it with Dired. However, this time I want to do it with Eshell. > > My own attempt, works, but I think there should be an easier way: > > $ listify *.jpg > $ setq my-files $$ > $ setq my-numbers $(number-sequence 1 (length my-files)) > $ setq my-pairs $(mapcar* 'cons my-files my-numbers) > $ for pair in $my-pairs { setq a (car pair); setq b (cdr pair); > mv $a "$b".jpg } This may serve as starting point: (defun renumber-files (&optional files) "This function works within Dired or Directory Editor in GNU Emacs. It will rename bunch of files and renumber them automatically by date and number of the file. It is useful when you are renaming less important images or bunch of files with irrelevant file names." (interactive) (let* ((files (or files (dired-get-marked-files))) (count 1)) (dolist (file files) (let* ((extension (file-name-extension file)) (filename (format "%s-%06.f.%s" (format-time-string "%F") count extension))) (rename-file file filename) (setq count (+ count 1)))))) Then in eshell: $ renumber-files * I have chosen to renumber it by date, you can customize it yourself. It is handy when I am downloading many pictures or videos, then I know at what date they were downloaded. Of course in that case I don't mind of file names significance, that is why I am renumbering them. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-11 13:40 ` Jean Louis @ 2021-09-12 8:44 ` Felix E. Klee 2021-09-12 19:03 ` Jean Louis 2021-09-22 14:27 ` Emanuel Berg via Users list for the GNU Emacs text editor 1 sibling, 1 reply; 38+ messages in thread From: Felix E. Klee @ 2021-09-12 8:44 UTC (permalink / raw) To: help-gnu-emacs Jean Louis <bugs@gnu.support> writes: > (defun renumber-files (&optional files) > […] Thanks for the alternative approach, Jean! It’s still quite verbose, though, even involving the creation of a custom function. Renaming files to numbers is actually very easy using Dired’s `wdired-change-to-wdired-mode`, and then doing regexp replace. The purpose of my question is to learn a bit about Eshell. > I have chosen to renumber it by date, you can customize it > yourself. It is handy when I am downloading many pictures or videos, > then I know at what date they were downloaded. Of course in that case > I don't mind of file names significance, that is why I am renumbering > them. For organizing imported media files by date, I have a Bash script `organize_media`: https://gist.github.com/feklee/85b5f13e83c796472dda16e31e32b7f3 ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-12 8:44 ` Felix E. Klee @ 2021-09-12 19:03 ` Jean Louis 2021-09-13 9:28 ` Jean Louis 2021-09-22 14:46 ` Emanuel Berg via Users list for the GNU Emacs text editor 0 siblings, 2 replies; 38+ messages in thread From: Jean Louis @ 2021-09-12 19:03 UTC (permalink / raw) To: Felix E. Klee; +Cc: help-gnu-emacs * Felix E. Klee <felix.klee@inka.de> [2021-09-12 11:46]: > Jean Louis <bugs@gnu.support> writes: > > (defun renumber-files (&optional files) > > […] > > Thanks for the alternative approach, Jean! > > It’s still quite verbose, though, even involving the creation of a > custom function. > > Renaming files to numbers is actually very easy using Dired’s > `wdired-change-to-wdired-mode`, and then doing regexp replace. The > purpose of my question is to learn a bit about Eshell. Is there any regular expression counter replacement so that each new replacement get a new number? > > I have chosen to renumber it by date, you can customize it > > yourself. It is handy when I am downloading many pictures or videos, > > then I know at what date they were downloaded. Of course in that case > > I don't mind of file names significance, that is why I am renumbering > > them. > > For organizing imported media files by date, I have a Bash script > `organize_media`: > > https://gist.github.com/feklee/85b5f13e83c796472dda16e31e32b7f3 I don't use Bash any more for that, I use Emacs Lisp. For pictures, I made "sort-images", it is definitely not perfect for everybody, but it serves me to sort those files that come from camera devices or phone to sort them by year, month, date into their corresponding folders. (defun rcd-image-date-match (file) (string-match "[[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][_-]" file)) (defun sort-images (&optional prefix) (interactive "P") (let ((files (dired-get-marked-files))) (dolist (file files) (let* ((attributes (file-attributes file)) (file-base (file-name-base file)) (file-ext (file-name-extension file)) (position (rcd-image-date-match file-base)) (modification-time (file-attribute-modification-time attributes)) (year (if current-prefix-arg (format-time-string "%Y" modification-time) (substring file-base position (+ position 4)))) (month (if current-prefix-arg (format-time-string "%m" modification-time) (substring file-base (+ 4 position) (+ position 6)))) (day (if current-prefix-arg (format-time-string "%d" modification-time) (substring file-base (+ 6 position) (+ position 8)))) (dir (concat "/home/data1/protected/Media/Pictures/Pictures/Year-" year "/" month "/" year "-" month "-" day "/")) (destination (concat "/home/data1/protected/Media/Pictures/Pictures/Year-" year "/" month "/" year "-" month "-" day "/" file-base "." file-ext))) (mkdir dir t) (message (concat "Copy file to: " destination)) (if (file-exists-p destination) (if (y-or-n-p (concat "Overwrite: " destination)) (rename-file file destination t)) (rename-file file destination)))) (revert-buffer))) -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-12 19:03 ` Jean Louis @ 2021-09-13 9:28 ` Jean Louis 2021-09-13 11:52 ` tomas ` (3 more replies) 2021-09-22 14:46 ` Emanuel Berg via Users list for the GNU Emacs text editor 1 sibling, 4 replies; 38+ messages in thread From: Jean Louis @ 2021-09-13 9:28 UTC (permalink / raw) To: Felix E. Klee, help-gnu-emacs Dear Felix, maybe you forgot to insert mailing list in your answer. > Jean Louis <bugs@gnu.support> writes: > > Is there any regular expression counter replacement so that each new > > replacement get a new number? > Example replacement: > \,(1+ \#) > This starts counting at 1. If you want to start at 0, then simply use: \# That is definitely interesting, please correct me, as I don't get it how to apply it, as following is not working: (replace-regexp-in-string "ABC" "\#" "ABCM ABCI ABCJ ABCY ABC8") > > I don't use Bash any more for that, I use Emacs Lisp. > I'm not convinced so far that Elisp provides any advantage here. > Elisp scripts look way more wordy. I have transcribed almost anything I used to do in Bash to Emacs Lisp. For example image resizing with external `mogrify' (defun image-resize (file &optional size) "Resizes the JPG image with default size" (if (rcd-which-list '("mogrify")) (let ((extension (file-name-extension file))) (when (or (equal (downcase extension) "jpg") (equal (downcase extension) "png")) (let* ((file (shell-double-quote file)) (command (format "mogrify -resize %s \"%s\"" size file))) (message command) (call-process-shell-command command)))) (rcd-warning-message "RCD ERROR: `mogrify' not found in `$PATH'"))) (defun image-resize-dired () "Resizes images" (interactive) (let ((files (dired-get-marked-files)) (size (read-number "Size: " *image-default-resize-size* '*image-resize-sizes*))) (while files (image-resize (pop files) size)) (revert-buffer))) *image-default-resize-size* ⇒ 1536 *image-resize-sizes* ⇒ ("85" "90" "100" "200" "800" "1536" "1024" "640" "2048" 1536 1024 800 1200 640) Of course anything like that may be written in any programming language. To me it is very handy to mark few files and resize them as I spend time with files mostly in Dired, not so much in Bash. For example image optimizing which is used for websites mostly I have used to do with Bash and then I converted it to Emacs Lisp. (defun optimize-image-jpg (file &optional quality) "Optimizes the JPG image with quality 70%" (if (rcd-which-list '("mogrify")) (let ((extension (file-name-extension file)) (quality (or quality "70"))) (when (string-match "\\(?:\\(?:jpe?\\|pn\\)g\\)" (downcase extension)) (message "Optimizing `%s'" file) (call-process "mogrify" nil "-sampling-factor" "4:2:0" "-strip" "-interlace" "JPEG" "-colorspace" "RGB" "-format" extension "-quality" quality file) (message "Optimizing FINISHED for `%s'" file))) (rcd-warning-message "RCD ERROR: `mogrify' not found in $PATH"))) (defun optimize-jpg-images-dired () "Optimizes JPG images inside of Dired" (interactive) (let ((files (dired-get-marked-files))) (while files (optimize-image-jpg (pop files))) (revert-buffer))) Of course one could do anything with Bash as main environment, but just because it is appears so much easier, handy, simpler, more integrated, I like to do it with Emacs as main environment. There are more functions available to Emacs Lisp than to Bash, re-usability in Emacs Lisp is so much higher. > > For pictures, I made "sort-images", > I see you use the file modification time. Did you consider pulling the > date from EXIF or other meta data stored within files? Only if there is prefix argument, I use the function `sort-images' to sort files which come from camera or phones, those images already have their creation time in their file names. > In my script I use: > * `exiftool`: photos > * `ffprobe`: videos, audio recordings That is definitely good option, though it cannot be automated. As Exif information cannot be trusted easily. For my own camera pictures they have their date in their names, right? Their exif information will be correct too, but not as reliable for the function. For those pictures coming from other people they may not have any exif information, or it may be modified Exif information, but they may still retain the date of the picture in the file name, you see? The file name of the picture is more authoritative to the name than Exif in most of cases from my experience. I guess I would use Exif only when I already inspect bunch of files to have a correct Exif information. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-13 9:28 ` Jean Louis @ 2021-09-13 11:52 ` tomas 2021-09-14 7:42 ` Felix E. Klee ` (2 subsequent siblings) 3 siblings, 0 replies; 38+ messages in thread From: tomas @ 2021-09-13 11:52 UTC (permalink / raw) To: help-gnu-emacs; +Cc: Felix E. Klee [-- Attachment #1: Type: text/plain, Size: 1312 bytes --] On Mon, Sep 13, 2021 at 12:28:24PM +0300, Jean Louis wrote: > Dear Felix, maybe you forgot to insert mailing list in your answer. > > > Jean Louis <bugs@gnu.support> writes: > > > Is there any regular expression counter replacement so that each new > > > replacement get a new number? > > > Example replacement: > > > \,(1+ \#) > > > This starts counting at 1. If you want to start at 0, then simply use: > > \# > > That is definitely interesting, please correct me, as I don't get it how to apply it, as following is not working: > > (replace-regexp-in-string "ABC" "\#" "ABCM ABCI ABCJ ABCY ABC8") I think this notation is only for interactive input. Besides, the wrapping "\,(...)" is important, meaning "interpolate this Lisp expression's value here". For what you have in mind you could make use of the fact that `replace-regexp-in-string' also takes a function: (defun make-counter (startval) ; the "classical" counter closure (lambda (match) (prog1 (format "%d" startval) ; we have to evaluate to a string, I think (setq startval (1+ startval))))) (replace-regexp-in-string "ABC" (make-counter 23) "ABCM ABCI ABCJ ABCY ABC8") => "23M 24I 25J 26Y 278" (don't forget lexical binding, it won't work otherwise ;-) Cheers - t [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 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-24 7:21 ` Emanuel Berg via Users list for the GNU Emacs text editor 2021-09-30 6:38 ` Felix E. Klee 3 siblings, 1 reply; 38+ messages in thread From: Felix E. Klee @ 2021-09-14 7:42 UTC (permalink / raw) To: help-gnu-emacs Jean Louis <bugs@gnu.support> writes: > That is definitely interesting, please correct me, as I don't get it how to apply it, as following is not working: > > (replace-regexp-in-string "ABC" "\#" "ABCM ABCI ABCJ ABCY ABC8") How I use it, by example: 1. Open directory in Dired: drw-r--r-- 1 40K Sep 13 22:08 . drw-r--r-- 1 24K Sep 13 22:08 .. -rw-r--r-- 1 5 Sep 13 09:37 0.jpg -rw-r--r-- 1 5 Sep 13 09:37 1.jpg -rw-r--r-- 1 282 Jun 20 2020 desktop.ini -rw-r--r-- 1 625K Sep 13 22:00 IMG_20210913_0001.jpg -rw-r--r-- 1 385K Sep 13 22:01 IMG_20210913_0002.jpg -rw-r--r-- 1 1.1M Sep 13 22:02 IMG_20210913_0003.jpg 2. M-x wdired-change-to-wdired-mode 3. M-x query-replace-regexp [^ ]+jpg → \,(1+ \#).jpg Result: drw-r--r-- 1 40K Sep 13 22:08 . drw-r--r-- 1 24K Sep 13 22:08 .. -rw-r--r-- 1 5 Sep 13 09:37 1.jpg -rw-r--r-- 1 5 Sep 13 09:37 2.jpg -rw-r--r-- 1 282 Jun 20 2020 desktop.ini -rw-r--r-- 1 625K Sep 13 22:00 3.jpg -rw-r--r-- 1 385K Sep 13 22:01 4.jpg -rw-r--r-- 1 1.1M Sep 13 22:02 5.jpg ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-14 7:42 ` Felix E. Klee @ 2021-09-14 9:17 ` Jean Louis 2021-09-14 9:32 ` tomas ` (2 more replies) 0 siblings, 3 replies; 38+ messages in thread From: Jean Louis @ 2021-09-14 9:17 UTC (permalink / raw) To: Felix E. Klee; +Cc: help-gnu-emacs * Felix E. Klee <felix.klee@inka.de> [2021-09-14 10:43]: > 3. M-x query-replace-regexp > > [^ ]+jpg → \,(1+ \#).jpg > > Result: > > drw-r--r-- 1 40K Sep 13 22:08 . > drw-r--r-- 1 24K Sep 13 22:08 .. > -rw-r--r-- 1 5 Sep 13 09:37 1.jpg > -rw-r--r-- 1 5 Sep 13 09:37 2.jpg > -rw-r--r-- 1 282 Jun 20 2020 desktop.ini > -rw-r--r-- 1 625K Sep 13 22:00 3.jpg > -rw-r--r-- 1 385K Sep 13 22:01 4.jpg > -rw-r--r-- 1 1.1M Sep 13 22:02 5.jpg Thanks for example. Though it would be good to have the zero padding for cases when there are more files than 9 to later easier sort them. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-14 9:17 ` Jean Louis @ 2021-09-14 9:32 ` tomas 2021-09-14 11:11 ` Felix E. Klee 2021-09-16 22:47 ` Michael Heerdegen 2 siblings, 0 replies; 38+ messages in thread From: tomas @ 2021-09-14 9:32 UTC (permalink / raw) To: help-gnu-emacs; +Cc: Felix E. Klee [-- Attachment #1: Type: text/plain, Size: 590 bytes --] On Tue, Sep 14, 2021 at 12:17:33PM +0300, Jean Louis wrote: > * Felix E. Klee <felix.klee@inka.de> [2021-09-14 10:43]: > > 3. M-x query-replace-regexp > > > > [^ ]+jpg → \,(1+ \#).jpg [...] > Thanks for example. > > Though it would be good to have the zero padding for cases when there > are more files than 9 to later easier sort them. Any lisp code can go between the parentheses in \,(...) so you might try \,(format "%03d" \#) (Caveat: I can't test it currently). It's all described in the Emacs Manual "Regexp Replacement" chapter. Cheers - t [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 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-16 22:47 ` Michael Heerdegen 2 siblings, 1 reply; 38+ messages in thread From: Felix E. Klee @ 2021-09-14 11:11 UTC (permalink / raw) To: help-gnu-emacs Jean Louis <bugs@gnu.support> writes: > Though it would be good to have the zero padding for cases when there > are more files than 9 to later easier sort them. If that’s needed, I just do another search and replace afterwards, or I do it by hand. That’s all easy to do in Wdired mode. No need for sophisticated scripts. ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-14 11:11 ` Felix E. Klee @ 2021-09-14 13:37 ` Jean Louis 2021-09-14 15:48 ` Felix E. Klee 0 siblings, 1 reply; 38+ messages in thread From: Jean Louis @ 2021-09-14 13:37 UTC (permalink / raw) To: Felix E. Klee; +Cc: help-gnu-emacs * Felix E. Klee <felix.klee@inka.de> [2021-09-14 14:29]: > Jean Louis <bugs@gnu.support> writes: > > Though it would be good to have the zero padding for cases when there > > are more files than 9 to later easier sort them. > > If that’s needed, I just do another search and replace afterwards, or I > do it by hand. That’s all easy to do in Wdired mode. No need for > sophisticated scripts. Will it work on marked files? -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-14 13:37 ` Jean Louis @ 2021-09-14 15:48 ` Felix E. Klee 2021-09-16 22:37 ` Michael Heerdegen 0 siblings, 1 reply; 38+ messages in thread From: Felix E. Klee @ 2021-09-14 15:48 UTC (permalink / raw) To: help-gnu-emacs Jean Louis <bugs@gnu.support> writes: > Will it work on marked files? Never had that use case, but interesting question. I tried: ^\*\(.*\)[^ ]+jpg → \1\,(1+ \#).jpg However, that doesn’t work because the part before the file name is not editable: Replaced 0 occurrences (skipped 3 read-only) I had three files selected. ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-14 15:48 ` Felix E. Klee @ 2021-09-16 22:37 ` Michael Heerdegen 0 siblings, 0 replies; 38+ messages in thread From: Michael Heerdegen @ 2021-09-16 22:37 UTC (permalink / raw) To: Felix E. Klee; +Cc: help-gnu-emacs "Felix E. Klee" <felix.klee@inka.de> writes: > Jean Louis <bugs@gnu.support> writes: > > Will it work on marked files? > > Never had that use case, but interesting question. I tried: > > ^\*\(.*\)[^ ]+jpg → \1\,(1+ \#).jpg > > However, that doesn’t work because the part before the file name is not > editable: > > Replaced 0 occurrences (skipped 3 read-only) > > I had three files selected. One working method is: limit the buffer to the marked files, e.g. with t (`dired-toggle-marks') and k (`dired-do-kill-lines'). g (`revert-buffer') to get the killed lines back when done. k only affects display, it doesn't perform any file operation. Some third party packages allow to display marked files in a fresh dired buffer. Michael. ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-14 9:17 ` Jean Louis 2021-09-14 9:32 ` tomas 2021-09-14 11:11 ` Felix E. Klee @ 2021-09-16 22:47 ` Michael Heerdegen 2021-09-17 7:27 ` Felix E. Klee 2 siblings, 1 reply; 38+ messages in thread From: Michael Heerdegen @ 2021-09-16 22:47 UTC (permalink / raw) To: Felix E. Klee; +Cc: help-gnu-emacs Jean Louis <bugs@gnu.support> writes: > Though it would be good to have the zero padding for cases when there > are more files than 9 to later easier sort them. Instead of query-replace most of the time I am quite happy with rectangle commands (C-x r k - `kill-rectangle' and C-x r N - `rectangle-number-lines'). I kill any files lines that are in the way with k before I enter wdired and mark a rectangle. If you call `rectangle-number-lines' with a prefix arg you are prompted for a starting number and a FORMAT string. If you choose, for example, "%03d", you get zero padding for three digits. Michael. ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-16 22:47 ` Michael Heerdegen @ 2021-09-17 7:27 ` Felix E. Klee 0 siblings, 0 replies; 38+ messages in thread From: Felix E. Klee @ 2021-09-17 7:27 UTC (permalink / raw) To: help-gnu-emacs Michael Heerdegen <michael_heerdegen@web.de> writes: > If you call `rectangle-number-lines' with a prefix arg you are > prompted for a starting number and a FORMAT string. If you choose, > for example, "%03d", you get zero padding for three digits. Neat! ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-13 9:28 ` Jean Louis 2021-09-13 11:52 ` tomas 2021-09-14 7:42 ` 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-30 6:38 ` Felix E. Klee 3 siblings, 1 reply; 38+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-24 7:21 UTC (permalink / raw) To: help-gnu-emacs Jean Louis wrote: > That is definitely interesting, please correct me, as > I don't get it how to apply it, as following is not working: > > (replace-regexp-in-string "ABC" "\#" "ABCM ABCI ABCJ ABCY ABC8") Well, what are you trying to do? >>> I don't use Bash any more for that, I use Emacs Lisp. >> >> I'm not convinced so far that Elisp provides any advantage >> here. Elisp scripts look way more wordy. > > I have transcribed almost anything I used to do in Bash to > Emacs Lisp. For example image resizing with external > `mogrify' Holy cow, lucky me I don't think like that as I have 100+ zsh to (if so) translate into Elisp ... [1] I don't think it is a matter of Elisp being less or more wordy (but interestingly Elisp and Lisp in general is very wordy while shell script languages and zsh in particular has a syntax that is extremely compact and cryptic) - so while it isn't about that (here), it is rather about where you are and what you do. Elisp for editing files and inputting text and shell languages for all work in/from the filesystem. > Of course anything like that may be written in any > programming language [...] You can't, and even if it you could, it isn't a good idea because different languages are intended for different types of programming tasks. So while you _can_ hammer a nail with the flip side of the axe propose a dispose of hammers in any wood shop/carpentry with this argument and ... no one will do it. > Of course one could do anything with Bash as main > environment, but just because it is appears so much easier, > handy, simpler, more integrated, I like to do it with Emacs > as main environment. It isn't ... > There are more functions available to Emacs Lisp than to > Bash, re-usability in Emacs Lisp is so much higher. You are aware that there are other shells than Bash? Also, shell programming doesn't rely on functions half as much as does well, functional programming like Lisp. Shell programming is supposed to be just the glow and binaries are supposed to do the main job. Nowadays little by little they have added so much features so a lot more is now possible with just the shell, but still. [1] https://dataswamp.org/~incal/conf/.zsh/ -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 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 0 siblings, 1 reply; 38+ messages in thread From: Jean Louis @ 2021-09-25 13:43 UTC (permalink / raw) To: help-gnu-emacs > > I have transcribed almost anything I used to do in Bash to > > Emacs Lisp. For example image resizing with external > > `mogrify' > > Holy cow, lucky me I don't think like that as I have 100+ zsh > to (if so) translate into Elisp ... [1] > > I don't think it is a matter of Elisp being less or more wordy > (but interestingly Elisp and Lisp in general is very wordy > while shell script languages and zsh in particular has > a syntax that is extremely compact and cryptic) - so while it > isn't about that (here), it is rather about where you are and > what you do. Elisp for editing files and inputting text and > shell languages for all work in/from the filesystem. When personal Emacs environment develops than it becomes rather tedious to do it in Bash when there are many prepared and ready functions from Emacs Lisp. The more environment is developed and user knows about it, the easier it becomes to think with Emacs handling stuff that common users would otherwise handle with the shell. > > There are more functions available to Emacs Lisp than to > > Bash, re-usability in Emacs Lisp is so much higher. > > You are aware that there are other shells than Bash? Sure, like eshell. ;-) I would use any program if it satisfies the purpose. Within `mutt' email client I will use `fzf' and `psql' to choose some items from the database and completion and tabulated list mode to choose items from within Emacs. So it really does not matter. What user knows or prefers personal and what is more useful shall be first chosen. > Also, shell programming doesn't rely on functions half as much > as does well, functional programming like Lisp. If you don't rely, then don't, otherwise Bash script can be developed very similar to Emacs lisp with a lot of reusable functions. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-25 13:43 ` Jean Louis @ 2021-09-26 2:50 ` Emanuel Berg via Users list for the GNU Emacs text editor 0 siblings, 0 replies; 38+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-26 2:50 UTC (permalink / raw) To: help-gnu-emacs Jean Louis wrote: > When personal Emacs environment develops than it becomes > rather tedious to do it in Bash when there are many prepared > and ready functions from Emacs Lisp. Work in Bash does not rely on functions the way functional programming does, instead it relies on shell tools that aren't part of Bash, e.g. the GNU toolchain. Now, with so many people using Bash and other even more feature-rich shells (where "save a fork" has been a focus of development) there should be enough functions even compared to what you find in Lisp. Lisp is a fringe/underground language while every and any kid with a Linux box uses the shell. > I would use any program if it satisfies the purpose. But some people actually think first what tool(s) are suited for a particular task. Again, you _can_ hit a nail with the flip side of an axe. However that doesn't make it a smart thing to do! And if you rely on that in general you'll be the laughing stock of the wood shop/carpentry ... > If you don't rely, then don't, otherwise Bash script can be > developed very similar to Emacs lisp with a lot of > reusable functions. Of course you can reuse shell scripts and functions ... -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-13 9:28 ` Jean Louis ` (2 preceding siblings ...) 2021-09-24 7:21 ` 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 3 siblings, 1 reply; 38+ messages in thread From: Felix E. Klee @ 2021-09-30 6:38 UTC (permalink / raw) To: help-gnu-emacs Jean Louis <bugs@gnu.support> writes: > I have transcribed almost anything I used to do in Bash to Emacs > Lisp. It’s definitely an interesting exercise. However, Eshell has a showstopper limitation: pipes are *slow* ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 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 0 siblings, 2 replies; 38+ messages in thread From: Jean Louis @ 2021-09-30 7:37 UTC (permalink / raw) To: Felix E. Klee; +Cc: help-gnu-emacs * Felix E. Klee <felix.klee@inka.de> [2021-09-30 09:58]: > Jean Louis <bugs@gnu.support> writes: > > I have transcribed almost anything I used to do in Bash to Emacs > > Lisp. > > It’s definitely an interesting exercise. However, Eshell has a > showstopper limitation: pipes are *slow* For me, shell scripts are in Elisp and usually used in Dired rather than Eshell. Pipes may be replaced by buffers, capturing information in a buffer and processing it thereafter. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 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 1 sibling, 0 replies; 38+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-30 7:50 UTC (permalink / raw) To: help-gnu-emacs Jean Louis wrote: > For me, shell scripts are in Elisp and usually used in Dired > rather than Eshell. > > Pipes may be replaced by buffers, capturing information in > a buffer and processing it thereafter. Elisp and Bash are not close so one might as well start over ... If you insist, here are some zsh for you to practice on. So tell me, what's the Elisp equivalent of: #! /bin/zsh create-100-meg-bogus-file () { local file=${1:-100.data} rm $file dd if=/dev/urandom \ of=$file \ count=$(( 1024 * 100 )) \ bs=1024 | sha256sum | ( read rnd _; echo $rnd >> $file ) } and #! /bin/zsh t () { # check number of arguments if [[ $# == 0 ]]; then echo "syntax: $0 COMMAND" >&2 return fi local cmd=$1 find-zsh-command $cmd # use whence; if a path, do 'ls' local whence_hits whence_hits=("${(@f)$(whence -ca $cmd | sed "s#$HOME#~#g")}") local h for h in $whence_hits; do echo $h ls -Ghl --color=auto $h 2> /dev/null if [ -h $h ]; then local dest=$(readlink -e $h) set-fg-color 3 echo -n " * links to: " reset-color echo -n $dest '\n ' ls -Ghl --color=auto $dest fi done # if a script, output it cats $cmd } ? The whole file (323 lines) https://dataswamp.org/~incal/conf/.zsh/files-fs After that only ~99 more and you are all set :) -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 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 1 sibling, 1 reply; 38+ messages in thread From: Felix E. Klee @ 2021-09-30 13:17 UTC (permalink / raw) To: help-gnu-emacs Jean Louis <bugs@gnu.support> writes: > Pipes may be replaced by buffers, capturing information in a buffer > and processing it thereafter. …which makes it super slow ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 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 0 siblings, 1 reply; 38+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-30 15:34 UTC (permalink / raw) To: help-gnu-emacs 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 :) 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! Post the code here as you do, it is appreciated despite my style issues with your code ... -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-30 15:34 ` Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-30 21:42 ` Jean Louis 2021-10-01 0:09 ` Emanuel Berg via Users list for the GNU Emacs text editor 0 siblings, 1 reply; 38+ messages in thread From: Jean Louis @ 2021-09-30 21:42 UTC (permalink / raw) To: help-gnu-emacs * 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/ ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-30 21:42 ` Jean Louis @ 2021-10-01 0:09 ` Emanuel Berg via Users list for the GNU Emacs text editor 2021-10-01 20:51 ` Jean Louis 0 siblings, 1 reply; 38+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-01 0:09 UTC (permalink / raw) To: help-gnu-emacs Jean Louis wrote: > Or maybe there is not much of Bash as my "Bash" scripts were > mostly Common Lisp, Perl, etc. Common Lisp is the so-called "industrial strength" Lisp and should be much faster than Elisp, did some work on that (SBCL) with SLIME and SDL2/OpenGL (12 files) <https://dataswamp.org/~incal/common-lisp/general-base/> This config file also includes the commands to install everything: <https://dataswamp.org/~incal/emacs-init/ide/slime-incal.el> Here are a bunch of screenshot (included GLSL, source lost, I think): <https://dataswamp.org/~incal/figures/opengl-glsl/> However ... there were a bunch of problems with the SLIME workflow, it didn't get to the point that it felt like Elisp in terms of interaction/integration, maybe I wasn't persistent enough, but here yes, from my POV of relative failure in that regard I can see that you want it Elisp and not CL. As for Perl, I'm not a network guy but if I were I would prefer Python, devel is just lightning fast, as I realized with my one Python as-an-adult project. <https://dataswamp.org/~incal/#bot> Some toy projects with Perl: (very old) <https://dataswamp.org/~incal/irssi/> <https://dataswamp.org/~incal/note_DB> To translate either Perl or Python to Elisp to I would _never_ do ... > 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. Hold your horses, not scripts, functions! I do have scripts as well but these are rare. <https://dataswamp.org/~incal/emacs-init/bike.el> And I have that in zsh as well in another version. No real benefit from the Elisp version compared to the zsh, either. <https://dataswamp.org/~incal/conf/.zsh/bike> > 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. Agreed, but I do filesystem shell tools from a terminal emulator (the Linux VTs with tmux on top) which I think is very common (maybe xterm and tmux is more common but in principle) and see no reason and no advantage, on the contrary, to move that - or even write it to begin with - in Elisp ... You are saying the environment decides what to use, yes, that and the purpose and associated tools, but to me, all those point at the shell (e.g. zsh as I use) and to at Emacs ... >> Post the code here as you do, it is appreciated despite my >> style issues with your code ... > > I care only if it works. But this attitude holds you back as a programmer ... > Here are few examples that invoke `yad' dialog generator > from Emacs. Cool - keep 'em coming :) -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 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 0 siblings, 1 reply; 38+ messages in thread From: Jean Louis @ 2021-10-01 20:51 UTC (permalink / raw) To: help-gnu-emacs * Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-10-01 03:11]: > Jean Louis wrote: > > > Or maybe there is not much of Bash as my "Bash" scripts were > > mostly Common Lisp, Perl, etc. > > Common Lisp is the so-called "industrial strength" Lisp and > should be much faster than Elisp, did some work on that (SBCL) > with SLIME and SDL2/OpenGL (12 files) > <https://dataswamp.org/~incal/common-lisp/general-base/> Just that for my needs speed does not matter much. What really matters is the integration opportunity that Emacs offers. We don't have our computing so prepared to be fully integrated, but we have got opportunities to make it so. Example is sharing files from mobile devices, they have made it well integrated. Users on any mobile device may go into gallery and share image or file to any kind of available communication channel such as Bluetooth, email, http sharing over web server provided application is installed, SMS if available, XMPP chat, or other types of chat, and so on. File sharing is fundamental to computer. We don't have file sharing well integrated in Emacs. For example there is no quick Dired function to email a file or set of files. There is "attach file" to email function but it is not so straight forward. There is Tramp to share to other devices, which is good integration related package. Back to Common Lisp. It is even less integrated for basic needs. In Emacs I can mark files and share them to other device or use functions to share them by email or publish files on remote devices. In Common Lisp I have to program everything myself, too much of it. Marking of files I would need to program myself. Taking care of even lower level functions. > However ... there were a bunch of problems with the SLIME > workflow, it didn't get to the point that it felt like Elisp > in terms of interaction/integration, maybe I wasn't persistent > enough, but here yes, from my POV of relative failure in that > regard I can see that you want it Elisp and not CL. Everything can be done with Common Lisp and Scheme, but it is more work with Common Lisp as compared to Emacs once user understands how much of it is already close to fingertips. > To translate either Perl or Python to Elisp to I would _never_ > do ... I have done that from Perl to Common Lisp, from Perl to Emacs Lisp. > > 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. > > Agreed, but I do filesystem shell tools from a terminal > emulator (the Linux VTs with tmux on top) which I think is > very common (maybe xterm and tmux is more common but in > principle) and see no reason and no advantage, on the > contrary, to move that - or even write it to begin with - in > Elisp ... You are saying the environment decides what to use, > yes, that and the purpose and associated tools, but to me, all > those point at the shell (e.g. zsh as I use) and to at > Emacs ... I use Emacs Lisp to prepare images and videos for WWW, publish files to remote servers, generate hyperlinks and similar. Sometimes I have video files to be converted to WEBM format and I delegate it to network machine which manages conversion by Emacs Lisp. If I have local function to convert videos, then I just copy it remotely and have remote computer do the same. It is programming language, not just editor. There is fundamental principle that almost anything we do on computer is related to writing, thus editing. In your example you are mentioning it without notice, you have to edit and type text in xterm and within tmux. Normally I use `screen' similar to `tmux' to launch `aria2c' when I am downloading some movies on remote server. Internet connection is not stable from under developed countries and `screen' prevents process to break. Later I find the file properly downloaded. When I learn how to launch a torrent remotely to `aria2c' then I will do it from Emacs. Why open terminal, ssh, login, when I could just get a prompt and insert torrent link and let computer think of the rest. In general it is good to strive to more integration that computers do the work for us. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 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 0 siblings, 1 reply; 38+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-01 21:34 UTC (permalink / raw) To: help-gnu-emacs Jean Louis wrote: > Just that for my needs speed does not matter much. > What really matters is the integration opportunity that > Emacs offers. We don't have our computing so prepared to be > fully integrated, but we have got opportunities to make > it so. I agree that's super important but I thought that was possible with SLIME. Maybe it is theoretically, maybe it is in practice as well only I didn't crack the code ... but no, never came close to the Elisp interactive feel. > We don't have file sharing well integrated in Emacs. > For example there is no quick Dired function to email a file > or set of files. Easy enough to fix - see source last - but I don't know why it isn't there to begin with. either political reasons or no one did it. > Back to Common Lisp. It is even less integrated for basic > needs. In Emacs I can mark files and share them to other > device or use functions to share them by email or publish > files on remote devices. In Common Lisp I have to program > everything myself, too much of it. Marking of files I would > need to program myself. Taking care of even lower > level functions. It is like that, is it? Or did you overlook some key packages in that field perhaps? I don't think so necessarily but it is possible ... > Everything can be done with Common Lisp and Scheme, but it > is more work with Common Lisp as compared to Emacs once user > understands how much of it is already close to fingertips. How much Elisp is there around compared to all CL and all Scheme and all other Lisp diagrams? Pie chart! >> To translate either Perl or Python to Elisp to I would >> _never_ do ... > > I have done that from Perl to Common Lisp, from Perl to > Emacs Lisp. Yeah, this whole translating stuff is foreign to me ... even if I did it I would call it a re-implementation or second attempt rather than a "translation" > There is fundamental principle that almost anything we do on > computer is related to writing, thus editing. In your > example you are mentioning it without notice, you have to > edit and type text in xterm and within tmux. Well, I know I type what I think is "a lot" but what the Jonas Svensson of Sweden does and does not with his computer, i have no clue. so while I don't think he "edits" all day and night long, rather he uses the computers with GUIs only. ;;; -*- lexical-binding: t -*- ;;; ;;; this file: ;;; http://user.it.uu.se/~embe8573/emacs-init/gnus/mail-to-many.el ;;; https://dataswamp.org/~incal/emacs-init/gnus/mail-to-many.el (require 'gnus-msg) (require 'message) (defun send-mail-to-many (to-list subject body) (dolist (to to-list) (send-mail-to to subject body) )) (defun send-mail-to (to subject body) (gnus-post-news 'post "") (message-goto-to) (insert to) (message-goto-subject) (insert subject) (message-goto-body) (insert body) (message-send-and-exit) ) (provide 'mail-to-many) -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 38+ messages in thread
* Lack of integration in Emacs - it was Re: How to rename files to numbers in Eshell? 2021-10-01 21:34 ` Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-02 7:53 ` Jean Louis 2021-10-03 8:16 ` Emanuel Berg via Users list for the GNU Emacs text editor 0 siblings, 1 reply; 38+ messages in thread From: Jean Louis @ 2021-10-02 7:53 UTC (permalink / raw) To: help-gnu-emacs * Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-10-02 00:36]: > Jean Louis wrote: > > > Just that for my needs speed does not matter much. > > What really matters is the integration opportunity that > > Emacs offers. We don't have our computing so prepared to be > > fully integrated, but we have got opportunities to make > > it so. > > I agree that's super important but I thought that was possible > with SLIME. Maybe it is theoretically, maybe it is in practice > as well only I didn't crack the code ... but no, never came > close to the Elisp interactive feel. SLIME, during time 2016-2017, was working well for me. I think that SLY now works about equally well. And I also use packages to see quickly the Common Lisp specification, in general, it is well integrated for my needs. One problem is if "connection breaks" as then I lose all values and need to evaluate it again. LibreOffice has many features integrated, for example LibreOffice Writer can write HTML documents and various other types of documents. I can choose background picture for HTML page and save it. Similarly, Emacs offers to write all kinds of documents, not as visual maybe, but one can do so much. It is integrated with `make' system, with Markdown, with all kinds of programming languages, compiling, building, LaTex conversions, all kinds of modes, Dired and remote Tramp connections, in general Emacs is integrated very well. From users' viewpoint we can lean on mobile devices that integrate features well, and I can say that in Emacs we don't have those features. For example, some file managers like Amaze on Replicant/Android/LineageOS systems may accept shared information, like if I have a file, I can choose to open it in Amaze text editor. That is rather feature of operating system. Similarly we have /usr/share/applications/ where system can decide which application could or should open specific file. The operating system I have here Parabola GNU/Linux-libre has file managers but I don't get it all integrated, each file manager is different, I don't get always a feature that tells me like "Open with Emacs". Dired is great. Though there is no automatic integration with the system. Imagine directories in Dired, and you have 5 other different file managers. There is /usr/share/applications system, but Dired is not looking there automatically. It will not give me option to open with other file managers. It will not look into how else could I open the image. I have to configure it all myself. Though from user's viewpoint I have installed the image viewers. I have already made decision that I wish to use specific image viewers, and Dired does not know about it. Other file managers will not know nothing about Dired as well. Mobile devices have it integrated long time ago and Emacs is not following the pattern. I can think of Dired like following: - press Enter on the file and that shall open it in Emacs - use prefix key or different key, and Dired should ask me how to open the file with other application that is on the file system. It makes really no sense to press on *.odt file and that I get asked by Emacs if Emacs should open it or not. That is lack of integration. Emacs should know if it cannot properly open *.odt files and offer me to open it with LibreOffice. The keys "Enter" and `&' are not well integrated in Dired for my needs. I don't like having 2 keys to launch the file, I prefer having one single key that is smarter. If I am on JPG file, I prefer opening it in Emacs with RET key. But I maybe wish to edit JPG image or view it with external viewer. Then I would prefer having quick choice, and not just changing key or typing each time different program. That could be implemented with M-RET for example and to get choice from /usr/share/applications on how to open the file. Maybe I want to open it in ImageMagick editor, maybe with Gimp, maybe with `sxiv' image viewer. Majority of file managers have the option called "Open with" and gives me choice of applications. Within Emacs I have to configure it myself or make a new function myself. And it is common users' need. - Sharing files as I mentioned is almost non-existent. If there are chat programs on the system then Dired and other file managers should offer me possibility to share to those chat systems. To share it maybe to email, or FTP, SCP, Rsync servers, and so on. And I don't mean "configure and share", rather "click and share". The less actions user have to do, the better is the integration. Emacs integrates much of features together. Though it lacks important common features used today on multiple different file systems. > > We don't have file sharing well integrated in Emacs. > > For example there is no quick Dired function to email a file > > or set of files. > > Easy enough to fix - see source last - but I don't know why it > isn't there to begin with. either political reasons or no one > did it. If user has to see the source it means that integration is not there. From programmer's viewpoint I can understand, and we can argue how easy it is. From users' viewpoint, it is simply not a tool for that. We know it could be great tool for sharing files through multiple communication lines, but it is simply not. I have it integrated with `mutt' email client, but that cannot possibly be a solution for everybody. Email software shall know how to accept files -- which is also difficulty, they don't know. And Emacs and othe file managers shall know which software is installed to offer to user to share files to such installed email software. This way there would be just nothing to configure. Exactly this works like a charm on Replicant/Android devices. Though I don't know how software registers itself to be capable of accepting shared files. For example K9 email client once installed will automatically be offered to accept the shared file. On GNU/Linux email software does not know about each other. File managers don't know about email software. It is old fashioned, not integrated. How about the central contacts management? Emacs knows nothing about it. There are attempts to provide contacts management by various software, nothing is integrated well with the operating systems. LDAP servers on GNU/Linux far from user friendly. Look at Android and other mobile operating systems. Click on file and share it, share to chat systems, email, etc. Then once sharing starts, like email, start typing the contact's name and its email address is already appearing. Look at GNU/Linux email clients, each client maybe has its contact management, maybe not. Each email client has different address book. Look at Emacs email clients that are disparate to each other each using different methods and their own aliases or address books and require hell of configurations until it starts working. Well, at leat we have unlimited fun for decades talking about configurations, and all related to setups. But it does not efficiently help the productivity. Writing letters is related to people, but where is central people management? It does not exist. If it is there, then it is exclusively locked to Emacs like BBDB or like Hyperbole contact management, which lack integration that rarely somebody uses it. To share a file from Dired, my workflow is following: 1. Review then mark files for sharing; 2. Press key; or press prefix to add comment about the files shared; 3. Write query to find possible person to share to; 4. Select correct person if there are many; 5. Files are shared; process is finished; Otherwise, without personal integration, how would I share files from Emacs? 1. Open message mode or mail mode or other email client; 2. Find files, from within email client; I find this tedious as how do I review files before selecting it? I have only titles, but titles could be similar and confusing. Maybe I like to open files and review it before marking it, see number (1) in the previous example; 3. Attach files; 4. Now find the contact information of person to send file to; how? Maybe it is integrated to specific email client, maybe not, it is difficult. Here is incomplete insight in how I use few functions to send files by using Mutt email client from Emacs. Important is that it works. It cannot be general solution for users as each user uses different email client. (defun mutt-send-files (files to email &optional subject text) "Attach files to email and send it by mutt. It is understood that mutt hooks and settings will set the from address, signature, and other settings" (let* ((files (if (string= (type-of files) "string") (list files) files)) (files (seq-drop-while (lambda (a) (not (file-exists-p a))) files)) (length (length files)) (plural (if (> length 1) "s" "")) (number (capitalize (clisp-number-to-words length t))) (text-body (or text "")) (message (format "%s attached file%s by Mr. Louis" number plural)) (subject (if subject (concat subject " - " message) message)) (subject-plain subject) (subject (string-to-double-quotes subject)) (subject (escape-$ subject)) (body (concat temporary-file-directory "mutt-attachment-body.txt")) (body-file (string-to-single-quotes body)) (files (mapcar 'string-to-single-quotes files)) (files (string-join files " ")) ;; TODO (mutt-data (mutt-prepare-command email)) (mutt-command (car mutt-data)) (command (format "%s -s %s -a %s -- %s < %s" mutt-command subject files to body-file))) (with-temp-file body (insert subject-plain) (insert "\n\n") (unless (seq-empty-p text-body) (insert "Message: \n\n") (insert text-body)) (insert "\n\n") (insert user-full-name)) (message command) (async-shell-command command))) (defun mutt-dired-send-files-subject (&optional prefix-arg) (interactive "P") (let* ((subject (read-from-minibuffer "Subject: " nil nil nil '(*email-subject*))) (text (if current-prefix-arg (read-from-minibuffer "Message: ") ""))) (when (> (length subject) 0) (let* ((files (dired-get-marked-files)) (id (cf-people-search-id (rcd-ask cf-people-prompt)))) (when id (let* ((name (cf-full-contact-name id)) (name (s-collapse-whitespace name)) (email (completing-read "Choose email: " (cf-valid-emails id)))) (when email (let* ((to (format "\"%s <%s>\"" name email)) (ask (format "Do you want to send files to %s? " to))) (when (yes-or-no-p ask) (mutt-send-files files to email subject text)))))))))) (defun mutt-dired-send-files () (interactive) (let* ((files (dired-get-marked-files)) (id (cf-people-search-id (rcd-ask cf-people-prompt)))) (when id (let* ((name (cf-full-contact-name id)) (email (completing-read "Choose email: " (cf-valid-emails id)))) (when email (let* ((to (format "\"%s <%s>\"" name email)) (ask (format "Do you want to send files for %s? " to))) (when (yes-or-no-p ask) (mutt-send-files files to email)))))))) My personal Emacs integration thus allows me to do this workflow: 1. Review files, then mark files for sharing; 2. Press key; or press prefix to add comment about the files shared; 3. Write query to find possible person to share to; 4. Select correct person as recipient if there are many; 5. Files are shared; process is finished; For each recipient there is different identity, depending of their group, that is solved in background. I don't need to choose the identity or my email address, I just decide which files are to be shared and if I need to add a comment about them. On Android/Replicant/LineageOS those features are integrated in the system and in software packages. > > Back to Common Lisp. It is even less integrated for basic > > needs. In Emacs I can mark files and share them to other > > device or use functions to share them by email or publish > > files on remote devices. In Common Lisp I have to program > > everything myself, too much of it. Marking of files I would > > need to program myself. Taking care of even lower > > level functions. > > It is like that, is it? Or did you overlook some key packages > in that field perhaps? I don't think so necessarily but it is > possible ... Number of packages does not tell about integration. Packages are disparate and often repetitive, not integrated with each other. Emacs has the GUI, Common Lisp does not have. I think Common Lisp should have it, in general every programming language TODAY, should offer GUI integrated. Not let users search for it. Example of good integration in Lisp is Lush: http://lush.sourceforge.net/screenshots.html or PicoLisp: https://picolisp.com/wiki/?home with integrated database, XHTML/CSS GUI Framework, and they are far from ideal integrated programming language. Racket seem to be better integrated. Plethora of Common Lisp is just command line based, anything else requires packages. What users of today need is something like Scratch: https://scratch.mit.edu - visual programming, integrated, easy to start. > > Everything can be done with Common Lisp and Scheme, but it > > is more work with Common Lisp as compared to Emacs once user > > understands how much of it is already close to fingertips. > > How much Elisp is there around compared to all CL and all > Scheme and all other Lisp diagrams? Pie chart! It really does not matter. Compare it to Scratch, if you need days, weeks or months to do what Scratch can do in 1 hour, then quantity really does not matter. It is not helpful. Users need well prepared systems. > >> To translate either Perl or Python to Elisp to I would > >> _never_ do ... > > > > I have done that from Perl to Common Lisp, from Perl to > > Emacs Lisp. > > Yeah, this whole translating stuff is foreign to me ... even > if I did it I would call it a re-implementation or second > attempt rather than a "translation" Good place to start with specific examples is: http://www.rosettacode.org/wiki/Rosetta_Code Doing it in different programming languages is pleasure as that increases one's own understanding of the workflow and leads to discovery of better methods. > ;;; -*- lexical-binding: t -*- > ;;; > ;;; this file: > ;;; http://user.it.uu.se/~embe8573/emacs-init/gnus/mail-to-many.el > ;;; https://dataswamp.org/~incal/emacs-init/gnus/mail-to-many.el > > (require 'gnus-msg) > (require 'message) Right. Gnus. We are all disparate. Integration nowhere. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Lack of integration in Emacs - it was Re: How to rename files to numbers in Eshell? 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 0 siblings, 1 reply; 38+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-03 8:16 UTC (permalink / raw) To: help-gnu-emacs Jean Louis wrote: > Similarly, Emacs offers to write all kinds of documents, not > as visual maybe, but one can do so much. It is integrated > with `make' system, with Markdown, with all kinds of > programming languages, compiling, building, LaTex > conversions, all kinds of modes, Dired and remote Tramp > connections, in general Emacs is integrated very well. But also Gnus, ERC, you name it. The level of integration and the uniform configuration/extension method (Elisp) is why I started to use it. Also it allows you to be a programmer every day without having to have a huge project, which is nice. Huge projects are also nice but more difficult and even if you succeed how often will you, or anyone else, use them? But what you do with Elisp you use every day and some of it is used around the world, even. So it is, or can be if you are lucky, Caramelldansen all over :) <https://www.youtube.com/watch?v=x57yIcRiRR4> > Dired is great. Though there is no automatic integration > with the system. Imagine directories in Dired, and you have > 5 other different file managers. You mean integrate other pieces of software with Emacs? I think "the Emacs school of integration" is rather to identify good ideas and implement them _in_ Emacs, not between Emacs and that other piece of software ... > Writing letters is related to people, but where is central > people management? It does not exist. It does, use 'alias' in ~/.mailrc ... > Right. Gnus. We are all disparate. Integration nowhere. Gnus is part of Emacs so that is 100% integrated if you will. If you intent to use Emacs as an interface to non-Emacs software that level of integration seems indeed like a lot of work I don't envy you ... -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Lack of integration in Emacs - it was Re: How to rename files to numbers in Eshell? 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 0 siblings, 1 reply; 38+ messages in thread From: Jean Louis @ 2021-10-03 9:27 UTC (permalink / raw) To: help-gnu-emacs * Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-10-03 11:17]: > Jean Louis wrote: > > > Similarly, Emacs offers to write all kinds of documents, not > > as visual maybe, but one can do so much. It is integrated > > with `make' system, with Markdown, with all kinds of > > programming languages, compiling, building, LaTex > > conversions, all kinds of modes, Dired and remote Tramp > > connections, in general Emacs is integrated very well. > > But also Gnus, ERC, you name it. The level of integration and > the uniform configuration/extension method (Elisp) is why > I started to use it. Yes. As compared to other software Emacs offers opportunity to integrate many features in one place. It helps user operate computer easier. Though it goes through peculiar Emacs way as compared to other software. > Also it allows you to be a programmer every day without having > to have a huge project, which is nice. I do programming out of necessity or specific needs. I would like not to program and spend time eating fruits with girl(s) on the Indian ocean in Mombasa. Instead I have to fiddle with Org mode and macros, Emacs Lisp, you name it. I don't want it, but I have to. Would there be easier way I would go for it. Until then Emacs is helping me speed up with my needs. I wish it would be so well integrated that with simple decisions things get done. Modern smart TVs are programmed that way, you choose a channel and you watch movie. Or put USB flash stick and play video from it. Or watch pictures. Smart phones are prepared that way. Desktop is not well integrated for end users no matter what operating system is there. Emacs is a helper software to operating system, helping users and opening opportunities for users to integrate it more. > Huge projects are also nice but more difficult and even if you > succeed how often will you, or anyone else, use them? Personal every day used software is about 1 megabyte in size. Emacs packages are more than that, that is for me large enough. > > Dired is great. Though there is no automatic integration > > with the system. Imagine directories in Dired, and you have > > 5 other different file managers. > > You mean integrate other pieces of software with Emacs? > I think "the Emacs school of integration" is rather to > identify good ideas and implement them _in_ Emacs, not between > Emacs and that other piece of software ... That is your idea, that is why Emacs and other desktop software that does not talk to each other is old fashioned. > > Writing letters is related to people, but where is central > > people management? It does not exist. > > It does, use 'alias' in ~/.mailrc ... LOL. Please tell to smart phone user to put aliases in ~/.mailrc and no phones will ever be sold. Forget it. It's very simple, desktop of today is failure to modern mobile devices. > > Right. Gnus. We are all disparate. Integration nowhere. > > Gnus is part of Emacs so that is 100% integrated if you will. Integrated with Emacs? Though that is not what integration means for me. When you open up Android application like K9, you will get questions, configure it, and it will work. It works for average no-clue users. When I type `M-x gnus' I will get what? Cow. While this may be fun to programmers, there is no way this could ever pass for modern users. And that remark is only to what you said "it is integrated with Emacs", but that is not type of integration I mean. Let us say you are user, you have your user account, right? Then once you enter into system you should be asked to complete your user account settings, and you would know where those settings are to update it later. Once updated, ANY email client would read your emails without asking you over and over again. It is computer, it is supposed to be artificial intelligence, machine that does it for you. Let us say you wish to send files to somebody by email, if you have configured anything, it should simply work. That is how it works on Android/Replicant/LineageOS. It does not work and is failure of 21st century on desktop. No cows, my friend. > If you intent to use Emacs as an interface to non-Emacs > software that level of integration seems indeed like a lot of > work I don't envy you ... I would like that Emacs run the computer as that way things would easier get integrated, but it doesn't. And it speaks little to other software on the same system. But Emacs should know more about it. Things like: - when any phone is nearby computer or other devices, both the phone and computer, should pair and find out about each other, and easy exchange images, videos, contacts, logs. View anything on computer from phone and vice versa. Technically this all is possible, it was never integrated due to competition and whatever control of monopolies. - if phone has speech recognition, then Emacs, desktop, should have it too, this should include automatic translations on computer, phrases, speech, more audio visual technology; - Emacs being built on top of Lisp should offer more of the AI or artificial intelligence then just a shrink for suicidal people, and remember what user was doing over the week and upon new start it should talk with user as it already got a lot of information about files to be opened, and times of user's habits. It should know for example that it is time for work, and that maybe user has to contact Mary again, and that work is now probably over, and that user did not work longer on his poem file, it shall remind about backups or updated contacts that has to be pushed into phones, or that there is dinner, etc. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Lack of integration in Emacs - it was Re: How to rename files to numbers in Eshell? 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 0 siblings, 1 reply; 38+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-04 3:29 UTC (permalink / raw) To: help-gnu-emacs Jean Louis wrote: > Yes. As compared to other software Emacs offers opportunity > to integrate many features in one place. It helps user > operate computer easier. Though it goes through peculiar > Emacs way as compared to other software. Or other software is peculiar compared to Emacs, Emacs is from 1976. Besides, "other software" - there's a lot of software. Pick randomly a piece of software and you'll find the way it does things isn't the same as how it happens in some other random piece of software. Consistence _within_ the piece of software is a goal not always achieved ... > I do programming out of necessity or specific needs. I would > like not to program and spend time eating fruits with > girl(s) on the Indian ocean in Mombasa. Instead I have to > fiddle with Org mode and macros, Emacs Lisp, you name it. > I don't want it, but I have to. Would there be easier way > I would go for it. Until then Emacs is helping me speed up > with my needs. If you do things for the modern world in your words, e.g., smartphones and "modern smart TVs", I'm not sure Emacs/Elisp is the fastest thing, if it is only about speed (not the drug). Maybe some other framework exists to control these devices, and then another programming language on top of that, like Python or Lua, is faster ... > I wish it would be so well integrated that with simple > decisions things get done. Modern smart TVs are programmed > that way, you choose a channel and you watch movie. Or put > USB flash stick and play video from it. Or watch pictures. > Smart phones are prepared that way. Desktop is not well > integrated for end users no matter what operating system is > there. Emacs is a helper software to operating system, > helping users and opening opportunities for users to > integrate it more. You want to play the movie in Emacs when one inserts the USB or what are you talking about? I use mpv to play multimedia: <https://dataswamp.org/~incal/#mpv> >> It does, use 'alias' in ~/.mailrc ... > > LOL. > > Please tell to smart phone user to put aliases in ~/.mailrc > and no phones will ever be sold. Forget it. I don't really care what other people use ... > It's very simple, desktop of today is failure to modern > mobile devices. I'm not a fan of the desktop if you by that mean the Xerox/Finder/Windows/GNOME/KDE/etc stuff. However that's a thing of the 80s and 90s and Emacs isn't part of or tries to implement the desktop metaphor. > When you open up Android application like K9, you will get > questions, configure it, and it will work. It works for > average no-clue users. Again I don't care what software "average no-clue users" use. Maybe it is only good they don't use Emacs ... > - when any phone is nearby computer or other devices, both > the phone and computer, should pair and find out about > each other, and easy exchange images, videos, contacts, > logs. View anything on computer from phone and vice versa. > Technically this all is possible, it was never integrated > due to competition and whatever control of monopolies. > > - if phone has speech recognition, then Emacs, desktop, > should have it too, this should include automatic > translations on computer, phrases, speech, more audio > visual technology; > > - Emacs being built on top of Lisp should offer more of the > AI or artificial intelligence then just a shrink for > suicidal people, and remember what user was doing over the > week and upon new start it should talk with user as it > already got a lot of information about files to be opened, > and times of user's habits. It should know for example > that it is time for work, and that maybe user has to > contact Mary again, and that work is now probably over, > and that user did not work longer on his poem file, it > shall remind about backups or updated contacts that has to > be pushed into phones, or that there is dinner, etc. Okay, only who do you suggest will program all this and make it work? I think I'll pass but thank you. No one will stop you from trying and hopefully conquer the smartphone world with an all-new, iEmacs :) -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Lack of integration in Emacs - it was Re: How to rename files to numbers in Eshell? 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 0 siblings, 1 reply; 38+ messages in thread From: Jean Louis @ 2021-10-04 10:15 UTC (permalink / raw) To: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 6171 bytes --] * Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-10-04 06:30]: > Jean Louis wrote: > > > Yes. As compared to other software Emacs offers opportunity > > to integrate many features in one place. It helps user > > operate computer easier. Though it goes through peculiar > > Emacs way as compared to other software. > > Or other software is peculiar compared to Emacs, Emacs is > from 1976. It still remains in old times. We have modern times, new needs. Example is "recent files" integration: - Open "pluma" editor, it will offer "Recent files", related to other editors and software which opened "recent files" - "Gedit" will offer "Recent files" and will see recent files opened by "pluma" and other software - Emacs does not see recent files opened by other editors, but it should. Integration in operating systems is there, provisioned, prepared, but we don't have it. Common sense is that features should be integrated within single peace of software, even that is not so in many. Unspoken from Emacs, it is not enough integrated if you ask me. It is bunch of features that don't talk to each other as well but due to Emacs Lisp offer the opportunity to be re-used, and integrated well within Emacs. Maybe due to number of features and developers not having collaboration with other packages we get dis-integrated development in parallel with integrated development, but the more integration is there, the more dis-integration is also there. Example are Emacs email clients, each so much different to each other and none of them really ready for end users, none may be compared to Evolution or Thunderbird for example. Old fashioned, hard to use. I use it all time, but my personal satisfaction is far from what a modern user in year 2021 can handle. Computing enthusiasm is not there any more, it drives me, but not the people around me. They need simplicity similar like on Android/Replicant/LineageOS; corporations have money and invest money to find out what users will find comfortable, Microsoft, Google, Apple, they find ways to deal with billions of users, and GNU/Linux desktop, including Emacs is not following the same guidelines. At least not in the same decade. > If you do things for the modern world in your words, e.g., > smartphones and "modern smart TVs", I'm not sure Emacs/Elisp > is the fastest thing, if it is only about speed (not the > drug). Maybe some other framework exists to control these > devices, and then another programming language on top of that, > like Python or Lua, is faster ... I have not complained on speed. Emacs is about writing, very powerful, right? What people write? For example letters. Do we have straightforward way? I don't think so. A guy in Germany need letter in one way, somebody in US writes letters in different way. There different formats and norms on how and where to write the address, the sender's address, how and where to write subject, greeting, signatures and so on. Still those norms and formats are pretty much standard in many countries and they could be well integrated in Emacs, but we are far far from there. Helper software in Emacs should recognize locale and offer the letter norm by the locale, it should ask for address and similar things and offer to user to write the letter and provide excellent output. Emacs can do this, there are tools like Groff, LaTeX and Asciidoctor and it can be done all, but is not there, we don't have integrated solution. One has to be computer guy, nerd, to write a standard letter by using Emacs. LyX does that somewhat better, see attached screenshot. We have Emacs, supposed to be top writer's tool, but it demands a lot of learning before a simple letter may be written. Do you see? I don't say it is much different to LibreOffice, or other text editors. I just say we are far from integration that a modern human of 21st century deserves. > > I wish it would be so well integrated that with simple > > decisions things get done. Modern smart TVs are programmed > > that way, you choose a channel and you watch movie. Or put > > USB flash stick and play video from it. Or watch pictures. > > Smart phones are prepared that way. Desktop is not well > > integrated for end users no matter what operating system is > > there. Emacs is a helper software to operating system, > > helping users and opening opportunities for users to > > integrate it more. > > You want to play the movie in Emacs when one inserts the USB > or what are you talking about? It wasn't my idea, but when you mention it, yes, Emacs should give to user upon USB insertion a notification that there are files, "do you want to open?" -- definitely. My idea was that Emacs Dired should give me option to open files with already registered applications. As other applications talk to each other, they know that video file is to be opened like with MPlayer, or mpv or VLC or similar, but Emacs doesn't know that. It is one example of overall lack of integration. Dired is file management. It can open video files, but user has to configure it. Configuration is really difficult. Then customization in Emacs implies user has to know where is variable... dired-guess-shell-alist-user and then to enter something like this: Regexp: \.gif\' Lisp expression: "sxiv -a" That is not integration, not comfortable for users. In other file managers you can choose "Open with" and if you choose like "VLC" you are asked if you wish to remember this, and if you don't remember, VLC will be offered in the list "Open with" as one of priorities as it was used previously. And configuration is this visual, impromptu, comfortable for user. Emacs Dired should know that video files are opened with special other software most of times. Instead, we have different key to launch a file like & and Enter to edit it in Dired, it could be all one key with a prefix, Enter alone should know that video files or other types are most probably not opened by Emacs. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ [-- Attachment #2: 2021-10-04-12:07:17.jpg --] [-- Type: image/jpeg, Size: 42022 bytes --] ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Lack of integration in Emacs - it was Re: How to rename files to numbers in Eshell? 2021-10-04 10:15 ` Jean Louis @ 2021-10-04 11:22 ` Emanuel Berg via Users list for the GNU Emacs text editor 0 siblings, 0 replies; 38+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-04 11:22 UTC (permalink / raw) To: help-gnu-emacs Jean Louis wrote: >>> Yes. As compared to other software Emacs offers >>> opportunity to integrate many features in one place. >>> It helps user operate computer easier. Though it goes >>> through peculiar Emacs way as compared to other software. >> >> Or other software is peculiar compared to Emacs, Emacs is >> from 1976. > > It still remains in old times. We have modern times, > new needs. > > Example is "recent files" integration: > > - Open "pluma" editor, it will offer "Recent files", related > to other editors and software which opened "recent files" > > - "Gedit" will offer "Recent files" and will see recent > files opened by "pluma" and other software > > - Emacs does not see recent files opened by other editors, > but it should. Integration in operating systems is there, > provisioned, prepared, but we don't have it. [...] Instead of complaining about all and everything you should either start implementing these features yourself (if they aren't anywhere to be found already) _or_ you should give up the idea of brining in zillions of clueless smartphone users into the Emacs realm. Because I don't think that would ever happen even _if_ Emacs had everything you are telling us it doesn't have. > Example are Emacs email clients, each so much different to > each other and none of them really ready for end users, none > may be compared to Evolution or Thunderbird for example. On the contrary, this is one area that we, with Gnus, is on top of things. > Old fashioned, hard to use. I use it all time, but my > personal satisfaction is far from what a modern user in year > 2021 can handle. You do? > Computing enthusiasm is not there any more, it drives me, > but not the people around me [...] Again what does it matter what other people do? If they are happy using smartphones, so be it. -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-12 19:03 ` Jean Louis 2021-09-13 9:28 ` Jean Louis @ 2021-09-22 14:46 ` Emanuel Berg via Users list for the GNU Emacs text editor 1 sibling, 0 replies; 38+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-22 14:46 UTC (permalink / raw) To: help-gnu-emacs Jean Louis wrote: > (defun rcd-image-date-match (file) > (string-match "[[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][_-]" file)) Badness 1632321754: use the postfix operator for repitition, \{n\} > (defun sort-images (&optional prefix) Badness 1632321536: unused lexical argument > (dir (concat "/home/data1/protected/Media/Pictures/Pictures/Year-" year "/" month "/" year "-" month "-" day "/")) > (destination (concat "/home/data1/protected/Media/Pictures/Pictures/Year-" year "/" month "/" year "-" month "-" day "/" file-base "." file-ext))) Badness 1632321545: same data hard-coded twice (damn) > (mkdir dir t) > (message (concat "Copy file to: " destination)) Badness 1632321563: "destination" should be spelled "dst" to line up with "src", also it is just too long and bulky even for Lisp. > (if (y-or-n-p (concat "Overwrite: " destination)) > (rename-file file destination t)) Badness 1632321690: `if' with only one branch should be `when'. Conclusion: Hey, no one said it's supposed to be easy ... -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-11 13:40 ` Jean Louis 2021-09-12 8:44 ` Felix E. Klee @ 2021-09-22 14:27 ` Emanuel Berg via Users list for the GNU Emacs text editor 1 sibling, 0 replies; 38+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-22 14:27 UTC (permalink / raw) To: help-gnu-emacs Jean Louis wrote: > This may serve as starting point: > > (defun renumber-files (&optional files) > "This function works within Dired or Directory Editor in GNU > Emacs. It will rename bunch of files and renumber them > automatically by date and number of the file. It is useful when > you are renaming less important images or bunch of files with > irrelevant file names." > (interactive) > (let* ((files (or files (dired-get-marked-files))) > (count 1)) > (dolist (file files) > (let* ((extension (file-name-extension file)) > (filename (format "%s-%06.f.%s" (format-time-string "%F") count extension))) > (rename-file file filename) > (setq count (+ count 1)))))) > > Then in eshell: > > $ renumber-files * That's the spirit Jean - we do _everything_ in Elisp, however the time, place, and manner of invocation is entirely optional and up to the user's preference and discretion. It's interface-agnostic (or client-agnostic) computing for YOU! However your style has, in your phrasing, "a bunch" of flaws ... as in formally Second line should not have indentation First line is not a complete sentence Argument ‘files’ should appear (as FILES) in the doc string The first `let*' does not have to be parallel but can be the sequential `let'. It also lacks a (require 'dired) because of `dired-get-marked-files'. And there is no need to increment the count manually with the error-prone out-of-baseline `setq' when you instead can have a twin iterate/increment loop with `cl-loop' _or_ if you insist to do it manually you still don't need setq but can use `cl-incf' and if you insist on setq you can still use `1+' But that's just me insisting! Wait, let's just increment manually ... +1 Sweet :) -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 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-16 12:15 ` Felix E. Klee 2021-09-16 15:11 ` Nick Dokos 1 sibling, 1 reply; 38+ messages in thread From: Felix E. Klee @ 2021-09-16 12:15 UTC (permalink / raw) To: help-gnu-emacs "Felix E. Klee" <felix.klee@inka.de> writes: > $ listify *.jpg > $ setq my-files $$ > $ setq my-numbers $(number-sequence 1 (length my-files)) > $ setq my-pairs $(mapcar* 'cons my-files my-numbers) > $ for pair in $my-pairs { setq a (car pair); setq b (cdr pair); > mv $a "$b".jpg } I just learned about [Eshell backticks][1]. So the first two lines can be merged, even improving readability IMHO: $ setq my-files ${listify *.jpg} $ setq my-numbers $(number-sequence 1 (length my-files)) $ setq my-pairs $(mapcar* 'cons my-files my-numbers) $ for pair in $my-pairs { setq a (car pair); setq b (cdr pair); mv $a "$b".jpg } Now the question remains if there is a more terse way to do the rest of the steps. [1]: https://www.emacswiki.org/emacs/Eshell ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-16 12:15 ` Felix E. Klee @ 2021-09-16 15:11 ` Nick Dokos 2021-09-16 16:07 ` Felix E. Klee 0 siblings, 1 reply; 38+ messages in thread From: Nick Dokos @ 2021-09-16 15:11 UTC (permalink / raw) To: help-gnu-emacs "Felix E. Klee" <felix.klee@inka.de> writes: > I just learned about [Eshell backticks][1]. > > [1]: https://www.emacswiki.org/emacs/Eshell > The link should be https://www.emacswiki.org/emacs/EshellBackticks -- Nick "There are only two hard problems in computer science: cache invalidation, naming things, and off-by-one errors." -Martin Fowler ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: How to rename files to numbers in Eshell? 2021-09-16 15:11 ` Nick Dokos @ 2021-09-16 16:07 ` Felix E. Klee 0 siblings, 0 replies; 38+ messages in thread From: Felix E. Klee @ 2021-09-16 16:07 UTC (permalink / raw) To: help-gnu-emacs Nick Dokos <ndokos@gmail.com> writes: > "Felix E. Klee" <felix.klee@inka.de> writes: > >> I just learned about [Eshell backticks][1]. >> >> [1]: https://www.emacswiki.org/emacs/Eshell >> > > The link should be https://www.emacswiki.org/emacs/EshellBackticks Sorry, somehow this got chopped. Latest iteration, still convoluted: $ setq my-files ${listify *.jpg} $ (let ((i 0)) (mapcar (lambda (x) (eshell/mv x (format "%d.jpg" (cl-incf i)))) my-files)) Eshell is lacking the ease with which commands, functions, and executables can be mixed. If I wanted to use “/usr/bin/mv”, I guess I would need to wrap the call in another function, and I don’t even know which one. ^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2021-10-04 11:22 UTC | newest] Thread overview: 38+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.