Xah Talk Show 2019-12-09 emacs lisp live coding + tutorial. command to convert png to jpg while in html buffer
topics talked:
- emacs. program to convert to jpg while in html buffer. get on to coding it fast. We did 1 hour demo of these commands few days ago.
- Elisp: File and Directory Functions
- ELisp: Get User Input
- Emacs: Xah Dired Mode (xah-dired.el)
- Emacs: xah-find.el, Find Replace in Pure Elisp
(defun xah-convert-png-to-jpg-inline () "convert the image file under cursor in a html file, from jpg to png, then, linkify it in html. Version 2019-12-09" (interactive) (let ( inputPath cmdStr fileCoreName ) (setq inputPath (thing-at-point 'filename)) (setq fileCoreName (file-name-sans-extension inputPath)) (setq cmdStr (format "convert %s.png %s.jpg" fileCoreName fileCoreName )) (shell-command cmdStr ) (when (yes-or-no-p "Delete the png file?") (delete-file inputPath)) (search-backward "<" ) (insert fileCoreName ".jpg") (insert "\n") (backward-char 2) (xah-html-image-linkify) ;; ))