unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: New branch feature/named-lambdas.
Date: Mon, 17 Jul 2023 10:14:46 +0000	[thread overview]
Message-ID: <ZLUUloS4Lj0M98I7@ACM> (raw)

Hello, Emacs.

I've just committed the first version of branch feature/named-lambdas.

This will output the @dfn{defining symbol} of any anonymous functions in
backtraces.

For example, in

    (defun foo ()
      "foo doc string"
      (lambda (bar) "lambda doc string" (car bar)))

M-: (funcall (foo) 'baz) will produce this backtrace:

Debugger entered--Lisp error: (wrong-type-argument listp baz)
  car(baz)
  {foo} #f(compiled-function (bar) "lambda doc string" #<bytecode -0x105933d3d8452e4e>)(baz)  <=============================
  funcall({foo} #f(compiled-function (bar) "lambda doc string" #<bytecode -0x105933d3d8452e4e>) baz)
  (progn (funcall (foo) 'baz))
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  command-execute(eval-last-sexp)

..  Note the {foo} on the third and fourth lines.  This is (usually) the
defun where the lambda was defined, and is helpful in locating its
source code.

This was achieved by adding an extra defining-symbol field to each of
the three forms of function (interpreted, byte-compiled,
native-compiled).  It is indended that this version of Emacs will
continue to handle functions compiled without this enhancement.

-- 
Alan Mackenzie (Nuremberg, Germany).



             reply	other threads:[~2023-07-17 10:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 10:14 Alan Mackenzie [this message]
2023-07-17 19:52 ` New branch feature/named-lambdas Philip Kaludercic
2023-07-17 21:37   ` Alan Mackenzie
2023-07-18 11:14     ` Alan Mackenzie
2023-07-19  8:07 ` Ihor Radchenko

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=ZLUUloS4Lj0M98I7@ACM \
    --to=acm@muc.de \
    --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 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).