all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chris Gregory <czipperz@gmail.com>
To: emacs-devel@gnu.org
Subject: Simplify internal_catch()
Date: Tue, 27 Dec 2016 19:54:39 -0600	[thread overview]
Message-ID: <87k2aku8bk.fsf@gmail.com> (raw)

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

This patch simplifies the structure of the internal_catch function.
If my change to prog_ignore is accepted (shown below), use the diff_with.  Otherwise
use diff_without.

THIS IS NOT THE DIFF FOR THIS PATCH!
diff --git a/src/eval.c b/src/eval.c
index e50e26a..abd4028 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -458,7 +458,11 @@ usage: (progn BODY...)  */)
 void
 prog_ignore (Lisp_Object body)
 {
-  Fprogn (body);
+  while (CONSP (body))
+    {
+      eval_sub (XCAR (body));
+      body = XCDR (body);
+    }
 }

THE DIFF FOR THIS PATCH is in the attachments.

-- 
Chris Gregory


[-- Attachment #2: diff_with --]
[-- Type: application/octet-stream, Size: 1146 bytes --]

diff --git a/src/eval.c b/src/eval.c
index abd4028..53e1f59 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1087,23 +1087,20 @@ internal_catch (Lisp_Object tag,
 		Lisp_Object (*func) (Lisp_Object), Lisp_Object arg)
 {
   /* This structure is made part of the chain `catchlist'.  */
-  struct handler *c = push_handler (tag, CATCHER);
+  struct handler *c;
+  Lisp_Object val;
+
+  c = push_handler (tag, CATCHER);
 
-  /* Call FUNC.  */
   if (! sys_setjmp (c->jmp))
-    {
-      Lisp_Object val = func (arg);
-      clobbered_eassert (handlerlist == c);
-      handlerlist = handlerlist->next;
-      return val;
-    }
+    /* Call FUNC.  */
+    val = func (arg);
   else
-    { /* Throw works by a longjmp that comes right here.  */
-      Lisp_Object val = handlerlist->val;
-      clobbered_eassert (handlerlist == c);
-      handlerlist = handlerlist->next;
-      return val;
-    }
+    /* Throw works by a longjmp that comes right here.  */
+    val = handlerlist->val;
+  clobbered_eassert (handlerlist == c);
+  handlerlist = handlerlist->next;
+  return val;
 }
 
 /* Unwind the specbind, catch, and handler stacks back to CATCH, and

[-- Attachment #3: diff_without --]
[-- Type: application/octet-stream, Size: 1146 bytes --]

diff --git a/src/eval.c b/src/eval.c
index e50e26a..29a479a 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1083,23 +1083,20 @@ internal_catch (Lisp_Object tag,
 		Lisp_Object (*func) (Lisp_Object), Lisp_Object arg)
 {
   /* This structure is made part of the chain `catchlist'.  */
-  struct handler *c = push_handler (tag, CATCHER);
+  struct handler *c;
+  Lisp_Object val;
+
+  c = push_handler (tag, CATCHER);
 
-  /* Call FUNC.  */
   if (! sys_setjmp (c->jmp))
-    {
-      Lisp_Object val = func (arg);
-      clobbered_eassert (handlerlist == c);
-      handlerlist = handlerlist->next;
-      return val;
-    }
+    /* Call FUNC.  */
+    val = func (arg);
   else
-    { /* Throw works by a longjmp that comes right here.  */
-      Lisp_Object val = handlerlist->val;
-      clobbered_eassert (handlerlist == c);
-      handlerlist = handlerlist->next;
-      return val;
-    }
+    /* Throw works by a longjmp that comes right here.  */
+    val = handlerlist->val;
+  clobbered_eassert (handlerlist == c);
+  handlerlist = handlerlist->next;
+  return val;
 }
 
 /* Unwind the specbind, catch, and handler stacks back to CATCH, and

             reply	other threads:[~2016-12-28  1:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28  1:54 Chris Gregory [this message]
2016-12-28  2:50 ` Simplify internal_catch() Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2016-12-28  6:33 Chris Gregory
2016-12-28  8:48 ` Andreas Schwab
2016-12-28 16:45 ` Stefan Monnier
2016-12-28 19:24   ` Paul Eggert
2016-12-28 19:28     ` Stefan Monnier
2016-12-31 21:29       ` Paul Eggert
2016-12-28  7:34 [no subject] Chris Gregory
2016-12-28  7:42 ` Simplify internal_catch () Paul Eggert

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=87k2aku8bk.fsf@gmail.com \
    --to=czipperz@gmail.com \
    --cc=emacs-devel@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.