all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Cc: emacs-devel@gnu.org
Subject: hidden (updated) Elisp to do the job
Date: Sat, 18 Jan 2020 19:51:39 +0100	[thread overview]
Message-ID: <86wo9oion8.fsf@zoho.eu> (raw)

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	other threads:[~2020-01-18 18:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-18 18:51 Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2020-01-18 20:01 ` hidden (updated) Elisp to do the job Emanuel Berg via Users list for the GNU Emacs text editor

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=86wo9oion8.fsf@zoho.eu \
    --to=help-gnu-emacs@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=moasenwood@zoho.eu \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.