unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* favorite subject DWIM
@ 2021-08-12 10:41 Emanuel Berg via Users list for the GNU Emacs text editor
  2021-08-15  4:00 ` Abhiseck Paira
  0 siblings, 1 reply; 3+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-08-12 10:41 UTC (permalink / raw)
  To: help-gnu-emacs

I've done this so many times each time doing it in a slightly
different way (I'm sure) so I thought one would do an "ideal"
DWIM function and find out once for all how to do it...

So instead of "(list bg ed)", do something funkadelic...

?

;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;;   https://dataswamp.org/~incal/public_html/emacs-init/dwim.el

(defun test-dwim (&optional beg end)
  (interactive (when (use-region-p)
                 (list (region-beginning) (region-end)) ))
  (let ((bg (or beg (point-min)))
        (ed (or end (point-max))) )
    (list bg ed) ))

(when nil
  (progn
    (set-mark 10)
    (forward-line 3)
    (call-interactively #'test-dwim) ) ; (10 500)

  (call-interactively #'test-dwim)     ; ( 1 604)

  (test-dwim 30 100)                   ; (30 100)

  (test-dwim)                          ; ( 1 604)
)

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-15  4:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-12 10:41 favorite subject DWIM Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15  4:00 ` Abhiseck Paira
2021-08-15  4:30   ` Emanuel Berg via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).