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

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

Re: favorite subject DWIM


From: Abhiseck Paira
Subject: Re: favorite subject DWIM
Date: Sun, 15 Aug 2021 09:30:49 +0530


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

This file is not found (404).

> (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) ))

Why do you have interactive declaration? The return value (list bg
ed) totally useless to user. Wouldn't most of the time this function be
called by some other function?

Nit-picking: I think the let form is unnecessary.

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

> (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)
> )

Since I couldn't find your file, I may be lacking context, what it seems
here you're testing the function?


-- 
Abhiseck Paira
E34E 825B 979E EB9F 8505  F80E E93D 353B 7740 0709
https://social.linux.pizza/@redstarfish

Attachment: signature.asc
Description: PGP signature


reply via email to

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