unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60130: [PATCH] ; * lisp/subr.el (internal--with-narrowing): Simplify
@ 2022-12-16 23:12 Philip Kaludercic
  2022-12-16 23:31 ` Gregory Heytings
  0 siblings, 1 reply; 7+ messages in thread
From: Philip Kaludercic @ 2022-12-16 23:12 UTC (permalink / raw)
  To: 60130

[-- 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-17 11:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-16 23:12 bug#60130: [PATCH] ; * lisp/subr.el (internal--with-narrowing): Simplify Philip Kaludercic
2022-12-16 23:31 ` 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

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