all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: 60130@debbugs.gnu.org
Subject: bug#60130: [PATCH] ; * lisp/subr.el (internal--with-narrowing): Simplify
Date: Fri, 16 Dec 2022 23:12:58 +0000	[thread overview]
Message-ID: <87len70wp1.fsf@posteo.net> (raw)

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

Tags: patch


I am not sure if I am missing something, but shouldn't the above patch
be "simpler" and more idiomatic?


In GNU Emacs 29.0.60 (build 5, x86_64-pc-linux-gnu, GTK+ Version
 3.24.35, cairo version 1.16.0) of 2022-12-14 built on quetzal
Repository revision: 622838b957e240d700585050e9ddbd036e690513
Repository branch: emacs-29
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --with-pgtk --with-imagemagick'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-subr.el-internal-with-narrowing-Simplify.patch --]
[-- Type: text/patch, Size: 923 bytes --]

From 1d2e59dfc56e10b4576f7ae7524abceb5e5b74c6 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Sat, 17 Dec 2022 00:11:46 +0100
Subject: [PATCH] ; * lisp/subr.el (internal--with-narrowing): Simplify

---
 lisp/subr.el | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index e142eaa810..b21cce1669 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3956,10 +3956,9 @@ with-narrowing
 (defun internal--with-narrowing (start end body &optional tag)
   "Helper function for `with-narrowing', which see."
   (save-restriction
-    (progn
-      (narrow-to-region start end)
-      (if tag (narrowing-lock tag))
-      (funcall body))))
+    (narrow-to-region start end)
+    (when tag (narrowing-lock tag))
+    (funcall body)))
 
 (defun find-tag-default-bounds ()
   "Determine the boundaries of the default tag, based on text at point.
-- 
2.35.1


             reply	other threads:[~2022-12-16 23:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-16 23:12 Philip Kaludercic [this message]
2022-12-16 23:31 ` bug#60130: [PATCH] ; * lisp/subr.el (internal--with-narrowing): Simplify Gregory Heytings
2022-12-16 23:40   ` Philip Kaludercic
2022-12-17  7:52     ` Eli Zaretskii
2022-12-17 11:19       ` Philip Kaludercic
2022-12-17 11:31         ` Eli Zaretskii
2022-12-17 11:50           ` Philip Kaludercic

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

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

  git send-email \
    --in-reply-to=87len70wp1.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=60130@debbugs.gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.