unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Abhiseck Paira <abhiseckpaira@disroot.org>
To: Emanuel Berg <moasenwood@zoho.eu>
Cc: help-gnu-emacs@gnu.org
Subject: Re: favorite subject DWIM
Date: Sun, 15 Aug 2021 09:30:49 +0530	[thread overview]
Message-ID: <8735rbe4r2.fsf@disroot.org> (raw)
In-Reply-To: <8735rfueqg.fsf@zoho.eu>

[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]



> ;;; -*- 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2021-08-15  4:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-08-15  4:30   ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=8735rbe4r2.fsf@disroot.org \
    --to=abhiseckpaira@disroot.org \
    --cc=help-gnu-emacs@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.
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).