help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hidden (updated) Elisp to do the job


From: Emanuel Berg
Subject: hidden (updated) Elisp to do the job
Date: Sat, 18 Jan 2020 19:51:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Here is even more Elisp for your viewing
pleasure. Keep up the good job!

And... what... does the first function _do_,
really?!

(PS. Save for the esoteric/dual feature, the
 other time file - mentioned - is more
 interesting. And more spooky... :) DS.)

But now, check out the new stuff first hand:
  <https://dataswamp.org/~incal/emacs-init/time-my-insert.el>

Or read it right here:

PZ


;; this file: http://user.it.uu.se/~embe8573/emacs-init/time-my-insert.el
;;            https://dataswamp.org/~incal/emacs-init/time-my-insert.el


;; also see: http://user.it.uu.se/~embe8573/emacs-init/time-my.el
;;           https://dataswamp.org/~incal/emacs-init/time-my.el


;; see example file LAST in this file to get
;; the (point) immediately :)

;; eval this to go to the example:
;;   (progn (re-search-forward "example") (recenter 0))

(require 'subr-x)

(defun insert-shell-command (cmd)
  (interactive "s Command: ")
  (let ((pos (point))
        (end (point-max)) )
    (shell-command cmd 1)
    (goto-char (+ pos (- (point-max) end 1))) )
  (delete-char 1) )

(defun get-date ()
  (string-trim
   (shell-command-to-string "date +\"%Y-%m-%d\"") ))

(defun insert-date ()
  (interactive)
  (insert (get-date)) )
(defalias 'today #'insert-date)
;; (insert-date)

(defun insert-time ()
  (interactive)
  (insert-shell-command "date +\"%H:%M\"") )

(defun updated ()
  (save-excursion
    (let ((start (point)))
      (insert "  ")
      (insert-date)
      (insert "  ")
      (insert-time)
      (delete-char (- (point) start)) ))
  (save-buffer)
  )


;; example file:

;;
;;               list of things to study
;;    ---------------------------------------------
;;
;;
;;      the Emacs manual
;;
;;      tatoos on Kate Moss's body
;;
;;      more X-Men and Alita comics
;;
;;      big book on computer architecture (maybe)
;;
;;      my hygrometer
;;
;;
;;    .............................................
;;            (updated)  2020-01-18  19:22
;;

;;                     ^eval me!

(provide 'time-my-insert)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]