GNU bug report logs -
#8108
24.0.50; debugging pre-write-conversion in define-coding-system
Previous Next
To reply to this bug, email your comments to 8108 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8108
; Package
emacs
.
(Thu, 24 Feb 2011 07:42:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Werner LEMBERG <wl <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 24 Feb 2011 07:42:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
----------------------------------------------------------------------
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)
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8108
; Package
emacs
.
(Thu, 21 Apr 2011 05:49:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 8108 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8108
; Package
emacs
.
(Thu, 21 Apr 2011 09:07:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 8108 <at> debbugs.gnu.org (full text, mbox):
> Date: Thu, 21 Apr 2011 07:48:19 +0200 (CEST)
> From: Werner LEMBERG <wl <at> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#8108
; Package
emacs
.
(Mon, 26 Dec 2011 20:07:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 8108 <at> debbugs.gnu.org (full text, mbox):
> 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
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Tue, 27 Dec 2011 03:56:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Werner LEMBERG <wl <at> gnu.org>
:
bug acknowledged by developer.
(Tue, 27 Dec 2011 03:56:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 8108-done <at> debbugs.gnu.org (full text, mbox):
> Date: Mon, 26 Dec 2011 21:03:44 +0100 (CET)
> Cc: 8108 <at> debbugs.gnu.org
> From: Werner LEMBERG <wl <at> 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.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 24 Jan 2012 12:24:03 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Eli Zaretskii <eliz <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sat, 10 Dec 2016 07:28:02 GMT)
Full text and
rfc822 format available.
Did not alter fixed versions and reopened.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 10 Dec 2016 07:28:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#8108
; Package
emacs
.
(Sat, 10 Dec 2016 15:12:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 8108 <at> debbugs.gnu.org (full text, mbox):
Werner LEMBERG <wl <at> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#8108
; Package
emacs
.
(Sat, 10 Dec 2016 17:45:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 8108 <at> debbugs.gnu.org (full text, mbox):
>> 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
This bug report was last modified 8 years and 185 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.