emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple major modes


From: Johan Bockgård
Subject: Re: Multiple major modes
Date: Sat, 07 Jul 2007 02:48:20 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1.50 (gnu/linux)

Richard Stallman <address@hidden> writes:

> This suggests an idea to me.  Maybe Emacs could highlight the function
> definition somehow, to indicate that the function has been advised.

FWIW, there is already an entry in TODO

    ** Emacs Lisp mode could put an overlay on the defun for every
      function that has advice.  The overlay could have `after-text'
      like " [Function has advice]".  It might look like (defun foo
      [Function has advice] (x y) The overlay could also be a button
      that you could use to view the advice.

> That might solve the problem that makes advising bad for debugging.

Here's an example where advice can be really confusing:

;; See ad-default-compilation-action
(require 'bytecomp)

(defun foo (x y)
  (+ x y))

(defadvice foo (before bar activate)
  (car x))

(foo 1 2)
  =>

Debugger entered--Lisp error: (wrong-type-argument listp 1)
  foo(1 2)
  eval((foo 1 2))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp)


(If the advice is not compiled "car(1)" is present in the backtrace.)

-- 
Johan Bockgård





reply via email to

[Prev in Thread] Current Thread [Next in Thread]