unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Tino Calancha <tino.calancha@gmail.com>
Cc: 54804@debbugs.gnu.org, spwhitton@spwhitton.name,
	schwab@linux-m68k.org, rpluim@gmail.com, uyennhi.qm@gmail.com
Subject: bug#54804: 29.0.50; zap-to-char: case sensitive for upper-case letter
Date: Fri, 13 May 2022 09:48:41 +0300	[thread overview]
Message-ID: <83czgind12.fsf@gnu.org> (raw)
In-Reply-To: <878rr6oidh.fsf@gmail.com> (message from Tino Calancha on Thu, 12 May 2022 17:55:38 +0200)

> From: Tino Calancha <tino.calancha@gmail.com>
> Cc: 54804@debbugs.gnu.org,  Robert Pluim <rpluim@gmail.com>,  Eli Zaretskii
>  <eliz@gnu.org>,  uyennhi.qm@gmail.com,  spwhitton@spwhitton.name
> Date: Thu, 12 May 2022 17:55:38 +0200
> 
>     * lisp/misc.el (zap-up-to-char): Add an optional arg INTERACTIVE.
>     Perform a case-sensitive search when INTERACTIVE is non-nil and
>     CHAR is an upper-case character.

I don't understand why the need for the new INTERACTIVE argument.  It
is also undocumented in the doc strings.

> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -672,6 +672,12 @@ recreate it anew next time 'imenu' is invoked.
>  
>  * Editing Changes in Emacs 29.1
>  
> +---
> +** 'zap-to-char' case sensitivity on interactive calls.

NEWS is read in Outline mode, and its text should make sense when only
the headings are visible.  The above heading doesn't have enough
information to be useful without the body, because it says almost
nothing about the change.  Here's a better heading:

  ** 'zap-to-char' and 'zap-up-to-char' are case-sensitive for upper-case chars

> +The command now behaves as case-sensitive for interactive calls when is
> +invoked with an uppercase argument, regardless of the
> +`case-fold-search' value.  Likewise, for 'zap-up-to-char'.

The body should describe both commands equally.

> -(defun zap-up-to-char (arg char)
> +(defun zap-up-to-char (arg char &optional interactive)
>    "Kill up to, but not including ARGth occurrence of CHAR.
>  Case is ignored if `case-fold-search' is non-nil in the current buffer.
>  Goes backward if ARG is negative; error if CHAR not found.
> -Ignores CHAR at point."
> +Ignores CHAR at point.
> +Called interactively, do a case sensitive search if CHAR

"If called interactively, ..."

And, as mentioned above, I don't think I understand why we need to do
this only in interactive calls.  Non-interactive invocations already
have a way to request case-sensitivity, by let-binding
case-fold-search, right?

> diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el
> index dcab811bb5..2baf7124d7 100644
> --- a/test/lisp/simple-tests.el
> +++ b/test/lisp/simple-tests.el
> @@ -971,5 +971,27 @@ test-undo-region
>      ;;(should (= (length (delq nil (undo-make-selective-list 5 9))) 0))
>      (should (= (length (delq nil (undo-make-selective-list 6 9))) 0))))
>  
> +\f
> +;;; Tests for `zap-to-char'

Should we have the tests for zap-* functions in one place, rather than
two?

> +(defmacro with-simple-test (original result &rest body)
> +  (declare (indent 2) (debug (stringp stringp body)))
> +  `(with-temp-buffer
> +     (insert ,original)
> +     (goto-char (point-min))
> +     ,@body
> +     (should (equal (buffer-string) ,result))))

This macro is specific to zap-* functions, I think.  So its name
should reflect that fact.

Thanks.





  reply	other threads:[~2022-05-13  6:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08 22:03 bug#54804: 29.0.50; zap-to-char: case sensitive for upper-case letter Tino Calancha
2022-04-09  6:03 ` Eli Zaretskii
2022-04-16 10:58   ` Tino Calancha
2022-04-16 11:33     ` Eli Zaretskii
2022-05-09 16:17       ` Sean Whitton
2022-05-10 21:14       ` Tino Calancha
2022-05-11 11:15         ` Eli Zaretskii
2022-05-11 14:43           ` Tino Calancha
2022-05-11 14:50             ` Lars Ingebrigtsen
2022-05-11 15:00             ` Robert Pluim
2022-05-11 15:19               ` Tino Calancha
2022-05-11 15:27               ` Andreas Schwab
2022-05-11 15:38                 ` Tino Calancha
2022-05-11 16:11                   ` Andreas Schwab
2022-05-11 16:18                     ` Tino Calancha
2022-05-12 15:55                       ` Tino Calancha
2022-05-13  6:48                         ` Eli Zaretskii [this message]
2022-05-17 12:34                           ` Tino Calancha
2022-05-17 12:41                             ` Eli Zaretskii
2022-05-17 12:51                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-17 12:53                                 ` Tino Calancha
2022-05-17 13:38                                   ` Eli Zaretskii
2022-05-17 14:31                                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-17 19:32                             ` Juri Linkov
2022-05-18  7:25                           ` Tino Calancha
2022-05-20 22:59                         ` Sean Whitton
2022-05-21  5:38                           ` Eli Zaretskii
2022-05-21  9:30                             ` Tino Calancha
2022-05-21 18:53                             ` Sean Whitton
2022-05-11 15:57             ` Eli Zaretskii

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=83czgind12.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=54804@debbugs.gnu.org \
    --cc=rpluim@gmail.com \
    --cc=schwab@linux-m68k.org \
    --cc=spwhitton@spwhitton.name \
    --cc=tino.calancha@gmail.com \
    --cc=uyennhi.qm@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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