News for hackers. Stuff that matters.
Re:Use GNU Emacs by sn41 on Friday March 03, 2023 @04:28AM (#35007508)
OK. Here's a usecase where I found emacs to be wonderful.

I had to email the grades, together with totals, and class averages to many students in a class.

I tried fiddling with Excel and Google spreadsheets and scripted mail merges. Then I realized I could do it emacs.

Export the gradesheet into csv, and convert to an org table.

Carefully record a macro where you copy paste the name of the student the mark columns into a mail window (I used gnus), copy paste them into a calc window, do the calculation, copy the result onto the mail, and email the student. Go to the org buffer, and go to the next line. This took about 12 minutes to get right.

Keep pressing f4. Sending individual mails to 125 students took <5 minutes.

Maybe this is overkill, and I am sure excel wizards can do it in a few minutes. Nevertheless, I was surprised - if you spend time carefully recording the macro, the Emacs ecosystem (org+gnus+keyboard macros) is insanely powerful.

Re:Use GNU Emacs by kreetx on Friday March 03, 2023 @05:16AM (#35007801)
It's overkill if you ever only needed to do it once, but should the situation come up again the investment in time and effort will likely pay off.
Re:Use GNU Emacs by miroljub on Friday March 03, 2023 @08:08AM (#35009065)
It's not an overkill. He spent 12 minutes developing the solution and then 5 more minutes for actual sending of 125 emails. That's 17 minutes in total.

I assume doing the same task manually would take him at least a day or two, with the possibility of making numerous mistakes by doing it.

Re:Use GNU Emacs by tmtvl on Friday March 03, 2023 @05:28AM (#35007869)
You can do C-u 125 C-x e (or C-1 C-2 C-5 F4) to repeat a macro 125 times.
Re:Use GNU Emacs by axytol on Friday March 03, 2023 @06:58AM (#35008387)
Or if you're confident enough in your macro definition you can do C-u 0 C-x e to repeat until it reaches the end of the buffer.
Re:Use GNU Emacs by Kwpolska on Friday March 03, 2023 @05:39AM (#35007934)
The "Excel wizard" (not really) solution is to use Mail Merge in Word: https://support.microsoft.com/en-us/office/use-mail-merge-to...
Re:Use GNU Emacs by wrycoder on Friday March 03, 2023 @08:30AM (#35009316)
I would think that a Python code using the csv and email modules would be as fast or faster, and be more robust against typos.
Re:Use GNU Emacs by BeetleB on Friday March 03, 2023 @02:05PM (#35013676)
> Export the gradesheet into csv, and convert to an org table.

Your mistake was not using org first ;-)

I learned org mode while a grad TA, and one of the first times I used org tables was to keep track of student scores.

Re:Use GNU Emacs by olivertaylor on Friday March 03, 2023 @02:28PM (#35013926)
You can also do this with the system's built-in mail program. I set this up for doing bulk emails a while ago and it has proved very useful and versatile.

    (defun compose-mail-macos (&optional to subject body)
      "Compose a message using macOS's default mail program."
      (interactive)
      (start-process "Open Mail Message" nil "open"
                     (concat "mailto:"
                             (when to to) "?"
                             (when subject (concat "&subject=" (url-hexify-string subject)))
                             (when body (concat "&body=" (url-hexify-string body))))))
    
    (defun compose-mail-macos-multiple (list subject body)
      "ADDRESSES should be a list of email addresses in the form of:
    (setq mail-list '(\"Mail 1 <[email protected]>\"
                      \"Mail 2 <[email protected]>\"
                      \"Mail 3 <[email protected]>\"))"
      (while list
        (let ((to (car list)))
          (compose-mail-macos to subject body)
          (setq list (cdr list)))))