unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Help debugging backtrace
@ 2013-10-23 20:25 Alex Bennée
  2013-10-24  0:44 ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Bennée @ 2013-10-23 20:25 UTC (permalink / raw)
  To: help-gnu-emacs


Hi,

I'm having problems with my chromebook extension [1] when I kill the
frame. Message shows the following backtrace:

crmbk-delete-frame-handler: saved config
turning off mode
crmbk-frame-mode: cleaning up, running hooks: (crmbk-reset-search crmbk-reenable-touchpad crmbk-remove-powerd-hooks)
Error during redisplay: (run-hook-with-args crmbk-delete-frame-handler #<frame Edit Server Frame 0x3830530>) signaled (invalid-function (lambda "Clean-up any hooks into powerd and it's dbus interface" (message (format "in crmbk-remove-powerd-hooks: %s" post-command-hook)) (remove-hook (quote post-command-hook) (quote crmbk-notify-powerd-user-activity)) (message "done")))

I've been adding (messages) to the hooks but they never get called. I
did try using gdb and got this backtrace:

Breakpoint 3, safe_eval_handler (arg=63086294, nargs=3, args=0x7fff8305a690) at xdisp.c:2426
2426	  add_to_log ("Error during redisplay: %S signaled %S",
#0  safe_eval_handler (arg=63086294, nargs=3, args=0x7fff8305a690) at xdisp.c:2426
#1  0x00000000005c8121 in internal_condition_case_n (bfun=0x5cabcd <Ffuncall>, nargs=3, args=0x7fff8305a690, handlers=12777858, 
    hfun=0x42f89f <safe_eval_handler>) at eval.c:1403
#2  0x000000000042fae0 in safe_call (nargs=3, func=12897042) at xdisp.c:2461
#3  0x000000000042fb92 in safe_call2 (fn=12897042, arg1=12957218, arg2=63025613) at xdisp.c:2494
#4  0x00000000004200f6 in delete_frame (frame=63025613, force=12777810) at frame.c:1198
#5  0x00000000004209ae in Fdelete_frame (frame=12777810, force=12777810) at frame.c:1483
#6  0x00000000005caf8b in Ffuncall (nargs=1, args=0x7fff8305aa30) at eval.c:2781
#7  0x00000000005c5a3c in Fcall_interactively (function=12821010, record_flag=12777810, keys=12813029) at callint.c:852
#8  0x00000000005cafb6 in Ffuncall (nargs=4, args=0x7fff8305ad38) at eval.c:2785
#9  0x0000000000611dd6 in exec_byte_code (bytestr=59268177, vector=58672925, maxdepth=16, args_template=12777810, nargs=0, args=0x0)
    at bytecode.c:900
#10 0x00000000005cb96d in funcall_lambda (fun=58673005, nargs=3, arg_vector=0x7fff8305b248) at eval.c:3010
#11 0x00000000005cb158 in Ffuncall (nargs=4, args=0x7fff8305b240) at eval.c:2827
#12 0x00000000005ca99f in call3 (fn=12914226, arg1=12821010, arg2=12777810, arg3=12777810) at eval.c:2603
#13 0x0000000000541016 in Fcommand_execute (cmd=12821010, record_flag=12777810, keys=12777810, special=12777810) at keyboard.c:10241
#14 0x000000000052fdee in command_loop_1 () at keyboard.c:1587
#15 0x00000000005c7d04 in internal_condition_case (bfun=0x52f59b <command_loop_1>, handlers=12829490, hfun=0x52ee90 <cmd_error>) at eval.c:1289
#16 0x000000000052f2b4 in command_loop_2 (ignore=12777810) at keyboard.c:1168
#17 0x00000000005c76d8 in internal_catch (tag=12825330, func=0x52f28e <command_loop_2>, arg=12777810) at eval.c:1060
#18 0x000000000052f264 in command_loop () at keyboard.c:1147
#19 0x000000000052e9dd in recursive_edit_1 () at keyboard.c:779
#20 0x000000000052eb83 in Frecursive_edit () at keyboard.c:843
#21 0x000000000052ca0a in main (argc=2, argv=0x7fff8305b9e8) at emacs.c:1528

Lisp Backtrace:
"delete-frame" (0x8305aa38)
"ad-Orig-call-interactively" (0x8305ad40)
"call-interactively" (0x8305b248)
"delete-frame" (0x8305aa38)
"ad-Orig-call-interactively" (0x8305ad40)
"call-interactively" (0x8305b248)
Missing argument 0 in user function.
A debugging session is active.

	Inferior 1 [process 30226] will be detached.

Quit anyway? (y or n) Detaching from program: /home/alex/src/emacs/install/bin/emacs, process 30226

Any ideas what's going on?

[1] https://github.com/stsquad/emacs-chromebooks

-- 
Alex Bennée



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

* Re: Help debugging backtrace
  2013-10-23 20:25 Help debugging backtrace Alex Bennée
@ 2013-10-24  0:44 ` Michael Heerdegen
  2013-10-24  9:54   ` Alex Bennée
  2013-10-24 10:19   ` Alex Bennée
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Heerdegen @ 2013-10-24  0:44 UTC (permalink / raw)
  To: help-gnu-emacs

Alex Bennée <kernel-hacker@bennee.com> writes:

> crmbk-frame-mode: cleaning up, running hooks: (crmbk-reset-search
> crmbk-reenable-touchpad crmbk-remove-powerd-hooks) Error during
> redisplay: (run-hook-with-args crmbk-delete-frame-handler #<frame Edit
> Server Frame 0x3830530>) signaled (invalid-function (lambda "Clean-up
> any hooks into powerd and it's dbus interface" (message (format "in
> crmbk-remove-powerd-hooks: %s" post-command-hook)) (remove-hook (quote
> post-command-hook) (quote crmbk-notify-powerd-user-activity)) (message
> "done")))

This error message says that an invalid function was called.  It is this
one (you're missing to specify the argument list):

(defun crmbk-remove-powerd-hooks
  "Clean-up any hooks into powerd and it's dbus interface"
  (remove-hook 'post-command-hook 'crmbk-notify-powerd-user-activity))


Regards,

Michael.




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

* Re: Help debugging backtrace
  2013-10-24  0:44 ` Michael Heerdegen
@ 2013-10-24  9:54   ` Alex Bennée
  2013-10-24 10:19   ` Alex Bennée
  1 sibling, 0 replies; 8+ messages in thread
From: Alex Bennée @ 2013-10-24  9:54 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs


michael_heerdegen@web.de writes:

> Alex Bennée <kernel-hacker@bennee.com> writes:
>
>> crmbk-frame-mode: cleaning up, running hooks: (crmbk-reset-search
>> crmbk-reenable-touchpad crmbk-remove-powerd-hooks) Error during
>> redisplay: (run-hook-with-args crmbk-delete-frame-handler #<frame Edit
>> Server Frame 0x3830530>) signaled (invalid-function (lambda "Clean-up
>> any hooks into powerd and it's dbus interface" (message (format "in
>> crmbk-remove-powerd-hooks: %s" post-command-hook)) (remove-hook (quote
>> post-command-hook) (quote crmbk-notify-powerd-user-activity)) (message
>> "done")))
>
> This error message says that an invalid function was called.  It is this
> one (you're missing to specify the argument list):
>
> (defun crmbk-remove-powerd-hooks
>   "Clean-up any hooks into powerd and it's dbus interface"
>   (remove-hook 'post-command-hook 'crmbk-notify-powerd-user-activity))

Ahh seems so obvious now, I should have noticed. I was surprised though:

(defun my-test-defun
  "This is a test"
  (message " in my test"))

(defun my-test-defun2 ()
  "This is a test"
  (message " in my test 2"))

You can happily C-x C-e eval-last-sexp both of those defuns without
complaint. The error in the defun only shows up when you try and execute them.

-- 
Alex Bennée




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

* Re: Help debugging backtrace
  2013-10-24  0:44 ` Michael Heerdegen
  2013-10-24  9:54   ` Alex Bennée
@ 2013-10-24 10:19   ` Alex Bennée
  2013-10-24 10:57     ` Michael Heerdegen
                       ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Alex Bennée @ 2013-10-24 10:19 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs


michael_heerdegen@web.de writes:

> Alex Bennée <kernel-hacker@bennee.com> writes:
>
>> crmbk-frame-mode: cleaning up, running hooks: (crmbk-reset-search
>> crmbk-reenable-touchpad crmbk-remove-powerd-hooks) Error during
>> redisplay: (run-hook-with-args crmbk-delete-frame-handler #<frame Edit
>> Server Frame 0x3830530>) signaled (invalid-function (lambda "Clean-up
>> any hooks into powerd and it's dbus interface" (message (format "in
>> crmbk-remove-powerd-hooks: %s" post-command-hook)) (remove-hook (quote
>> post-command-hook) (quote crmbk-notify-powerd-user-activity)) (message
>> "done")))
>
> This error message says that an invalid function was called.  It is this
> one (you're missing to specify the argument list):
>
> (defun crmbk-remove-powerd-hooks
>   "Clean-up any hooks into powerd and it's dbus interface"
>   (remove-hook 'post-command-hook 'crmbk-notify-powerd-user-activity))

Ahh seems so obvious now, I should have noticed. I was surprised though:

(defun my-test-defun
  "This is a test"
  (message " in my test"))

(defun my-test-defun2 ()
  "This is a test"
  (message " in my test 2"))

You can happily C-x C-e eval-last-sexp both of those defuns without
complaint. The error in the defun only shows up when you try and execute them.

-- 
Alex Bennée




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

* Re: Help debugging backtrace
  2013-10-24 10:19   ` Alex Bennée
@ 2013-10-24 10:57     ` Michael Heerdegen
  2013-10-24 11:04     ` `defun' doesn't complain when arglist is missing Nicolas Richard
       [not found]     ` <mailman.4604.1382612629.10748.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Michael Heerdegen @ 2013-10-24 10:57 UTC (permalink / raw)
  To: help-gnu-emacs

Alex Bennée <kernel-hacker@bennee.com> writes:

> Ahh seems so obvious now, I should have noticed. I was surprised though:
>
> (defun my-test-defun
>   "This is a test"
>   (message " in my test"))
>
> (defun my-test-defun2 ()
>   "This is a test"
>   (message " in my test 2"))

Mmh, that's not optimal, right.  OTOH, when you try to compile a file
containing the first form, you even get an error (not just a warning,
compilation fails).

Compiling your elisp code is always a good mean to do some automatic
sanity checks.  It catches quite a lot of such typo mistakes.


Regards,

Michael.




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

* `defun' doesn't complain when arglist is missing.
  2013-10-24 10:19   ` Alex Bennée
  2013-10-24 10:57     ` Michael Heerdegen
@ 2013-10-24 11:04     ` Nicolas Richard
  2013-10-24 17:14       ` Stefan Monnier
       [not found]     ` <mailman.4604.1382612629.10748.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 8+ messages in thread
From: Nicolas Richard @ 2013-10-24 11:04 UTC (permalink / raw)
  To: Alex Bennée; +Cc: Michael Heerdegen, help-gnu-emacs

Alex Bennée <kernel-hacker@bennee.com> writes:
> You can happily C-x C-e eval-last-sexp both of those defuns without
> complaint. The error in the defun only shows up when you try and execute them.

I was caught by this a few times. Wouldn't it make sense to add 

  (unless (and (listp arglist)
               (null (delq t (mapcar #'symbolp arglist))))
    (error "Malformed arglist: %s" arglist))

near the beginning of "defun" in byte-run.el ? Or am I being naive
again ?


I guess it's not there for a reason, but what is it ?

-- 
Nico.



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

* Re: `defun' doesn't complain when arglist is missing.
  2013-10-24 11:04     ` `defun' doesn't complain when arglist is missing Nicolas Richard
@ 2013-10-24 17:14       ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2013-10-24 17:14 UTC (permalink / raw)
  To: help-gnu-emacs

> I was caught by this a few times. Wouldn't it make sense to add 
>   (unless (and (listp arglist)
>                (null (delq t (mapcar #'symbolp arglist))))
>     (error "Malformed arglist: %s" arglist))
> near the beginning of "defun" in byte-run.el ?

Indeed.  Please send a patch via M-x report-emacs-bug, thank you,


        Stefan




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

* Re: `defun' doesn't complain when arglist is missing.
       [not found]     ` <mailman.4604.1382612629.10748.help-gnu-emacs@gnu.org>
@ 2013-10-24 21:23       ` Pascal J. Bourguignon
  0 siblings, 0 replies; 8+ messages in thread
From: Pascal J. Bourguignon @ 2013-10-24 21:23 UTC (permalink / raw)
  To: help-gnu-emacs

Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:

> Alex Bennée <kernel-hacker@bennee.com> writes:
>> You can happily C-x C-e eval-last-sexp both of those defuns without
>> complaint. The error in the defun only shows up when you try and execute them.
>
> I was caught by this a few times. Wouldn't it make sense to add 
>
>   (unless (and (listp arglist)
>                (null (delq t (mapcar #'symbolp arglist))))
>     (error "Malformed arglist: %s" arglist))
>
> near the beginning of "defun" in byte-run.el ? Or am I being naive
> again ?
>
>
> I guess it's not there for a reason, but what is it ?


    (require 'cl)
    (unless (and (listp arglist) (every (lambda (arg) (and arg (symbolp arg))) arglist))
      (error "Malformed arglist: %s" arglist))


or if you insist on not using cl,

    (dolist (arg (if (listp arglist) arglist '("")))
       (unless (and arg (symbolp arg))
          (error "Malformed arglist: %s" arglist)))


-- 
__Pascal Bourguignon__
http://www.informatimago.com/


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

end of thread, other threads:[~2013-10-24 21:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-23 20:25 Help debugging backtrace Alex Bennée
2013-10-24  0:44 ` Michael Heerdegen
2013-10-24  9:54   ` Alex Bennée
2013-10-24 10:19   ` Alex Bennée
2013-10-24 10:57     ` Michael Heerdegen
2013-10-24 11:04     ` `defun' doesn't complain when arglist is missing Nicolas Richard
2013-10-24 17:14       ` Stefan Monnier
     [not found]     ` <mailman.4604.1382612629.10748.help-gnu-emacs@gnu.org>
2013-10-24 21:23       ` Pascal J. Bourguignon

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