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

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

favorite subject DWIM


From: Emanuel Berg
Subject: favorite subject DWIM
Date: Thu, 12 Aug 2021 12:41:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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




reply via email to

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