* bug#8108: 24.0.50; debugging pre-write-conversion in define-coding-system
@ 2011-02-24 7:40 Werner LEMBERG
2011-04-21 5:48 ` Werner LEMBERG
2016-12-10 15:12 ` npostavs
0 siblings, 2 replies; 7+ messages in thread
From: Werner LEMBERG @ 2011-02-24 7:40 UTC (permalink / raw)
To: 8108
----------------------------------------------------------------------
I'm updating my cjk-enc.el package (part of the CJK bundle for LaTeX)
to replace make-coding-system with define-coding-system. However, I
can't debug it.
In previous Emacs versions, I've instrumented the function used for
the pre-write-conversion hook, and the debugger correctly stops there.
However, with a recent Emacs (bzr version 103411 from today) this no
longer works. Is this a bug? Am I missing something?
Here's an example, defining an encoding called `foo-coding'. Trying
to instrument `foo-encode', then saving an arbitrary test file with
`foo-coding', the debugger doesn't get invoked.
(define-coding-system
'foo-coding
"Coding-system foo"
:mnemonic ?c
:coding-type 'emacs-mule
:charset-list '(ascii)
:pre-write-conversion 'foo-encode)
(defun foo-encode (from to)
(insert "foo"))
----------------------------------------------------------------------
In GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.22.1)
of 2011-02-24 on linux-nvf0.site
Windowing system distributor `The X.Org Foundation', version 11.0.10903000
configured using `configure 'MAKEINFO=/usr/bin/makeinfo''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: de_DE.UTF-8
value of $XMODIFIERS: @im=none
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Summary
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
column-number-mode: t
transient-mark-mode: t
Recent input:
M-x m e w <return> <return> d d SPC d d x i <return>
d x M-x e m a c s - v e <tab> <tab> <return> g B a
<tab> <return> C-r e m a c s C-r C-a <return> M-x e
m a c s - b <tab> C-g b u f <backspace> <backspace>
b u g <tab> <tab> C-g M-x e m a c s - <tab> C-g M-x
b u g <tab> <tab> C-g M-x r e p o <tab> r t <tab>
<return>
Recent messages:
Refiling and deleting...done
GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.22.1) of 2011-02-24 on linux-nvf0.site
Scanning +Backup...done
Mark saved where search started
Quit [2 times]
Making completion list...
Quit
Making completion list...
Quit
Making completion list...
Load-path shadows:
None found.
Features:
(shadow emacsbug url-util url-parse auth-source eieio byte-opt
bytecomp byte-compile assoc gnus-util time-date password-cache
url-vars mm-util mail-prsvr multi-isearch pp mew-varsx mew-unix
cal-menu calendar cal-loaddefs mew-auth mew-config mew-imap2 mew-imap
mew-nntp2 mew-nntp mew-pop mew-smtp mew-ssl mew-ssh mew-net
mew-highlight mew-sort mew-fib mew-ext mew-refile mew-demo mew-attach
mew-draft mew-message mew-thread mew-virtual mew-summary4 mew-summary3
mew-summary2 mew-summary mew-search mew-pick mew-passwd mew-scan
mew-syntax mew-bq mew-smime mew-pgp mew-header mew-exec mew-mark
mew-mime mew-edit mew-decode mew-encode mew-cache mew-minibuf
mew-complete mew-addrbook mew-local mew-vars3 mew-vars2 mew-vars
mew-env mew-mule3 mew-mule mew-gemacs mew-key mew-func mew-blvs
mew-const mew tex regexp-opt advice help-fns advice-preload tex-site
auto-loads quail help-mode easymenu view cjktilde disp-table tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image fringe lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces
cus-face files text-properties overlay md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8108: 24.0.50; debugging pre-write-conversion in define-coding-system
2011-02-24 7:40 bug#8108: 24.0.50; debugging pre-write-conversion in define-coding-system Werner LEMBERG
@ 2011-04-21 5:48 ` Werner LEMBERG
2011-04-21 9:06 ` Eli Zaretskii
2016-12-10 15:12 ` npostavs
1 sibling, 1 reply; 7+ messages in thread
From: Werner LEMBERG @ 2011-04-21 5:48 UTC (permalink / raw)
To: 8108
Any takers? The very problem is that cjk-enc.el, after being adapted
to define-coding-system, completely fails: I no longer get any
reasonable output, and all CJK characters disappear in the output.
But without being able to debug I can't tell what and where exactly it
is failing...
Maybe there is a simple workaround?
Werner
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8108: 24.0.50; debugging pre-write-conversion in define-coding-system
2011-04-21 5:48 ` Werner LEMBERG
@ 2011-04-21 9:06 ` Eli Zaretskii
2011-12-26 20:03 ` Werner LEMBERG
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2011-04-21 9:06 UTC (permalink / raw)
To: Werner LEMBERG; +Cc: 8108
> Date: Thu, 21 Apr 2011 07:48:19 +0200 (CEST)
> From: Werner LEMBERG <wl@gnu.org>
>
>
> Any takers?
I don't know enough about Edebug to help you understand why it doesn't
get activated. However, if you can tell which version of Emacs was
last that did invoke the debugger, I could try looking for the changes
that could have caused that. E.g., does that work in Emacs 23.x?
> The very problem is that cjk-enc.el, after being adapted
> to define-coding-system, completely fails: I no longer get any
> reasonable output, and all CJK characters disappear in the output.
> But without being able to debug I can't tell what and where exactly it
> is failing...
Are you comfortable with debugging on the C level, or does the
solution have to be on the Lisp level?
If the former, it looks like the pre-write-conversion function is
invoked in this fragment from encode_coding_object:
args[0] = CODING_ATTR_PRE_WRITE (attrs);
args[1] = make_number (BEG);
args[2] = make_number (Z);
safe_call (3, args);
By stepping into the safe_call function, then into Funcall that it
calls, you should be able to see how the Lisp interpreter runs the
code of you pre-write-conversion function and where it fails. It is
less convenient than debugging in Lisp, but you still should be able
to display all the forms that are being evaluated, show the Lisp
backtrace with "xbacktrace", and even step into C-level primitives you
invoke from your pre-write-conversion function, something you cannot
do from Lisp.
Alternatively, maybe post here the code of your pre-write-conversion
function, perhaps someone will be able to find the problem just by
looking at the code.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8108: 24.0.50; debugging pre-write-conversion in define-coding-system
2011-04-21 9:06 ` Eli Zaretskii
@ 2011-12-26 20:03 ` Werner LEMBERG
2011-12-27 3:52 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Werner LEMBERG @ 2011-12-26 20:03 UTC (permalink / raw)
To: eliz; +Cc: 8108
> I don't know enough about Edebug to help you understand why it
> doesn't get activated.
The problem has been solved meanwhile, thanks to Hin-Tak Leung who
kindly revised `cjk-enc.el'. It is not a bug in Emacs, but
`char-charset' and `split-char' work differently in Emacs 23 and
newer, and I missed this change.
Please close this bug report as invalid.
Werner
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8108: 24.0.50; debugging pre-write-conversion in define-coding-system
2011-12-26 20:03 ` Werner LEMBERG
@ 2011-12-27 3:52 ` Eli Zaretskii
0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2011-12-27 3:52 UTC (permalink / raw)
To: Werner LEMBERG; +Cc: 8108-done
> Date: Mon, 26 Dec 2011 21:03:44 +0100 (CET)
> Cc: 8108@debbugs.gnu.org
> From: Werner LEMBERG <wl@gnu.org>
>
>
> The problem has been solved meanwhile, thanks to Hin-Tak Leung who
> kindly revised `cjk-enc.el'. It is not a bug in Emacs, but
> `char-charset' and `split-char' work differently in Emacs 23 and
> newer, and I missed this change.
>
> Please close this bug report as invalid.
Done.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8108: 24.0.50; debugging pre-write-conversion in define-coding-system
2011-02-24 7:40 bug#8108: 24.0.50; debugging pre-write-conversion in define-coding-system Werner LEMBERG
2011-04-21 5:48 ` Werner LEMBERG
@ 2016-12-10 15:12 ` npostavs
2016-12-10 17:44 ` Werner LEMBERG
1 sibling, 1 reply; 7+ messages in thread
From: npostavs @ 2016-12-10 15:12 UTC (permalink / raw)
To: Werner LEMBERG; +Cc: 8108
Werner LEMBERG <wl@gnu.org> writes:
> ----------------------------------------------------------------------
>
>
> I'm updating my cjk-enc.el package (part of the CJK bundle for LaTeX)
> to replace make-coding-system with define-coding-system. However, I
> can't debug it.
>
> In previous Emacs versions, I've instrumented the function used for
> the pre-write-conversion hook, and the debugger correctly stops there.
> However, with a recent Emacs (bzr version 103411 from today) this no
> longer works. Is this a bug? Am I missing something?
Not sure which version this corresponds to, but in [1]
encode_coding_object started using safe_call instead of a plain call to
run the pre-write-conversion function. safe_call intentionally disables
the debugger while running the function:
/* Use Qt to ensure debugger does not run,
so there is no possibility of wanting to redisplay. */
val = internal_condition_case_n (Ffuncall, nargs, args, Qt,
safe_eval_handler);
[1]: Tue Mar 29 00:34:38 2005
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d4850d674381d9493c94d30f8944a765e79537eb
(decode_coding_object): Use safe_call1 instead of call1.
(encode_coding_object): Use safe_call instead of call2.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8108: 24.0.50; debugging pre-write-conversion in define-coding-system
2016-12-10 15:12 ` npostavs
@ 2016-12-10 17:44 ` Werner LEMBERG
0 siblings, 0 replies; 7+ messages in thread
From: Werner LEMBERG @ 2016-12-10 17:44 UTC (permalink / raw)
To: npostavs; +Cc: 8108
>> I'm updating my cjk-enc.el package (part of the CJK bundle for
>> LaTeX) to replace make-coding-system with define-coding-system.
>> However, I can't debug it.
>
> Not sure which version this corresponds to, but in [1]
> encode_coding_object started using safe_call instead of a plain call
> to run the pre-write-conversion function. safe_call intentionally
> disables the debugger while running the function:
>
> /* Use Qt to ensure debugger does not run,
> so there is no possibility of wanting to redisplay. */
> val = internal_condition_case_n (Ffuncall, nargs, args, Qt,
> safe_eval_handler);
>
> [1]: Tue Mar 29 00:34:38 2005
> http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d4850d674381d9493c94d30f8944a765e79537eb
> (decode_coding_object): Use safe_call1 instead of call1.
> (encode_coding_object): Use safe_call instead of call2.
Thanks for checking. Ken'ichi, can you shed some light why you
changed this? How shall I proceed?
Werner
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-12-10 17:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-24 7:40 bug#8108: 24.0.50; debugging pre-write-conversion in define-coding-system Werner LEMBERG
2011-04-21 5:48 ` Werner LEMBERG
2011-04-21 9:06 ` Eli Zaretskii
2011-12-26 20:03 ` Werner LEMBERG
2011-12-27 3:52 ` Eli Zaretskii
2016-12-10 15:12 ` npostavs
2016-12-10 17:44 ` Werner LEMBERG
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.