emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Wrong type argument: characterp, 134217782 (??)
@ 2016-01-23 13:36 vendo.libri
  2016-01-23 20:42 ` Eric S Fraga
  0 siblings, 1 reply; 8+ messages in thread
From: vendo.libri @ 2016-01-23 13:36 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2503 bytes --]

First of all, I really like using Org-mode!
A couple of days ago I discovered I could rapidly insert occasional math expressions in org files with CDLaTeX so I tried to activate it with 'M-x org-cdlatex-mode' but Org mode couldn't find cdlatex.el as it wasn't present in the emacs' folders. I downloaded cdlatex.el version 4.7 (2014) from Carsten Dominik's gitHub repo as suggested by Rasmus in this mailing-list. I found all the load paths with 'C-h v RET load-path', picked one, placed cdlatex.el in it and proceeded to activate CDLaTeX in an org file, to try it out.
Initially everything seemed to work fine, for example 'C-c {' yielded a math environment of my choice. Then I discovered that the backquote symbol was not recognized. Everytime I press it, I get the 'Wrong type argument: characterp, 134217782' message in the mini-buffer. This happens only if I'm in CDLaTeX mode, if I turn it off, backquote gives no error and get printed on screen.
I soon realized that the majority of commands in CDLaTeX are triggered by this fundamental key, without it, CDLaTeX is pretty much useless! I posted my problem on emacs.stackexchange.com but I've received mixed suggestions and ended up more confused than before. If I type 'C-h k' and press the backquote key, I learn this (see everything enclosed within <pre> tags):
<pre>` (translated from <M-kp-9>) runs the command cdlatex-math-symbol,which is an interactive Lisp function in `cdlatex.el'.
It is bound to `, <menu-bar> <Org> <LaTeX> <Insert math symbol>.
(cdlatex-math-symbol)
Read a char from keyboard and insert corresponding math char.The combinations are defined in `cdlatex-math-symbol-alist'.  If not in a LaTeX math environment, you also get a pair of dollars.</pre>
I have the tilde and backquote associated to the same key on my keyboard, it's the key right below the 'Esc' key, in the upper left corner. I also have these lines in .emacs file:<pre>;;; a key for tilde symbol(define-key key-translation-map (kbd "M-2") (kbd "~"));;; a key for backtick symbol(define-key key-translation-map (kbd "M-6") "")(define-key key-translation-map (kbd "M-9") (kbd "`"))</pre>
Somebody pointed out that I should change the key associated with backquote but I'd really like to keep it in that position because it's efficient when I type. I really don't know what's the problem here and how to fix it. Can someone please explain it to me please and possibly help me fix it?
I'm using Windows 7, emacs 24.4, Org 8.2, cdlatex 4.7 (2014), AUCTEX 11.88.

[-- Attachment #2: Type: text/html, Size: 3004 bytes --]

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

* Re: Wrong type argument: characterp, 134217782 (??)
  2016-01-23 13:36 vendo.libri
@ 2016-01-23 20:42 ` Eric S Fraga
  2016-01-24  1:11   ` Charles C. Berry
  0 siblings, 1 reply; 8+ messages in thread
From: Eric S Fraga @ 2016-01-23 20:42 UTC (permalink / raw)
  To: vendo.libri@libero.it; +Cc: emacs-orgmode

On Saturday, 23 Jan 2016 at 14:36, vendo.libri@libero.it wrote:

[...]

> Then I discovered that the backquote symbol was not
> recognized. Everytime I press it, I get the 'Wrong type argument:
> characterp, 134217782' message in the mini-buffer.  

Maybe try

  M-x toggle-debug-on-error

and see where that error is arising to see if that gives us a hint as to
what may be wrong.  I am not sure if the cdlatex code you downloaded has
been updated for later versions of emacs...
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3.3-475-g58af2e

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

* Re: Wrong type argument: characterp, 134217782 (??)
  2016-01-23 20:42 ` Eric S Fraga
@ 2016-01-24  1:11   ` Charles C. Berry
  2016-01-24  4:57     ` Charles C. Berry
  0 siblings, 1 reply; 8+ messages in thread
From: Charles C. Berry @ 2016-01-24  1:11 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

On Sat, 23 Jan 2016, Eric S Fraga wrote:

> On Saturday, 23 Jan 2016 at 14:36, vendo.libri@libero.it wrote:
>
> [...]
>
>> Then I discovered that the backquote symbol was not
>> recognized. Everytime I press it, I get the 'Wrong type argument:
>> characterp, 134217782' message in the mini-buffer.
>
> Maybe try
>
>  M-x toggle-debug-on-error
>
> and see where that error is arising to see if that gives us a hint as to
> what may be wrong.  I am not sure if the cdlatex code you downloaded has
> been updated for later versions of emacs...


Funny, I get `apply: Wrong type argument: characterp, 134217785'

(not `134217782'), which is what M-9 is recognized as:

#+BEGIN_SRC emacs-lisp
(read-char) ; type C-c C-c y M-9 *here*
#+END_SRC

#+RESULTS:
: 134217785

on my MacBook and that makes some sense as cdlatex.el uses `(read-char)' 
once it is triggered by a back tic. And I guess that `read-char' is immune 
to keymapping for good reason.

For the record, this happens with

#+BEGIN_SRC elisp
   (define-key key-translation-map (kbd "M-9") (kbd "`"))
#+END_SRC


set in org-cdlatex-mode when the first back tic (or M-9) is followed by a 
M-9 and it also happens for other key events that do not map to characters 
like `C-S-s' after the back tic.

So the easiest fix is *don't do that*.

I suppose this counts as a bug in cdlatex, but it seems easy enough to 
work around.

HTH,

Chuck

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

* Re: Wrong type argument: characterp, 134217782 (??)
  2016-01-24  1:11   ` Charles C. Berry
@ 2016-01-24  4:57     ` Charles C. Berry
  0 siblings, 0 replies; 8+ messages in thread
From: Charles C. Berry @ 2016-01-24  4:57 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

On Sat, 23 Jan 2016, Charles C. Berry wrote:

> On Sat, 23 Jan 2016, Eric S Fraga wrote:
>
>> On Saturday, 23 Jan 2016 at 14:36, vendo.libri@libero.it wrote:
>> 
>> [...]
>> 
>>> Then I discovered that the backquote symbol was not
>>> recognized. Everytime I press it, I get the 'Wrong type argument:
>>> characterp, 134217782' message in the mini-buffer.
>> 
>> Maybe try
>>
>>  M-x toggle-debug-on-error
>> 
>> and see where that error is arising to see if that gives us a hint as to
>> what may be wrong.  I am not sure if the cdlatex code you downloaded has
>> been updated for later versions of emacs...
>
>
> Funny, I get `apply: Wrong type argument: characterp, 134217785'
>
> (not `134217782'), which is what M-9 is recognized as:
>
> #+BEGIN_SRC emacs-lisp
> (read-char) ; type C-c C-c y M-9 *here*
> #+END_SRC
>
> #+RESULTS:
> : 134217785
>
> on my MacBook and that makes some sense as cdlatex.el uses `(read-char)' once 
> it is triggered by a back tic. And I guess that `read-char' is immune to 
> keymapping for good reason.
>
> For the record, this happens with
>
> #+BEGIN_SRC elisp
>  (define-key key-translation-map (kbd "M-9") (kbd "`"))
> #+END_SRC
>
>
> set in org-cdlatex-mode when the first back tic (or M-9) is followed by a M-9 
> and it also happens for other key events that do not map to characters like 
> `C-S-s' after the back tic.
>
> So the easiest fix is *don't do that*.
>
> I suppose this counts as a bug in cdlatex, but it seems easy enough to work 
> around.

Just to be clear on what such a workaround would amount to:

With M-9 defined as above, customize `cdlatex-math-symbol-prefix' to any 
of the unused symbols.

Suppose it is ':'. Then in a buffer in which org-cdlatex-mode is 
operative,

M-9 : : : : ...

cycles thru the different levels until the user selects another 
letter/symbol in the menu.

HTH,

Chuck

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

* Re: Wrong type argument: characterp, 134217782 (??)
@ 2016-01-24 22:14 vendo.libri
  2016-01-25  4:54 ` Charles C. Berry
  0 siblings, 1 reply; 8+ messages in thread
From: vendo.libri @ 2016-01-24 22:14 UTC (permalink / raw)
  To: emacs-orgmode

Ok, so if I want to use this character '•' (a bullet mark) to trigger math 
expression, what should I write in my .emacs file regarding the `cdlatex-math-
symbol-prefix' variable? (Please help me out, I know nothing about how to write 
elisp).
Since you mention this might be a bug with CDLaTeX, I'd like to add that 
pressing TAB after '-' (dash) in an itemize environment doesn't put '\item'. I 
believe it's an empty command.

P.

>----Messaggio originale----
>Da: Charles C. Berry <ccberry@ucsd.edu>
>Data: 24-gen-2016 5.57
>A: "Eric S Fraga"<e.fraga@ucl.ac.uk>
>Cc: "vendo.libri@libero.it"<vendo.libri@libero.it>, <emacs-orgmode@gnu.org>
>Ogg: Re: Wrong type argument: characterp, 134217782 (??)
>
>On Sat, 23 Jan 2016, Charles C. Berry wrote:
>
>> On Sat, 23 Jan 2016, Eric S Fraga wrote:
>>
>>> On Saturday, 23 Jan 2016 at 14:36, vendo.libri@libero.it wrote:
>>> 
>>> [...]
>>> 
>>>> Then I discovered that the backquote symbol was not
>>>> recognized. Everytime I press it, I get the 'Wrong type argument:
>>>> characterp, 134217782' message in the mini-buffer.
>>> 
>>> Maybe try
>>>
>>>  M-x toggle-debug-on-error
>>> 
>>> and see where that error is arising to see if that gives us a hint as to
>>> what may be wrong.  I am not sure if the cdlatex code you downloaded has
>>> been updated for later versions of emacs...
>>
>>
>> Funny, I get `apply: Wrong type argument: characterp, 134217785'
>>
>> (not `134217782'), which is what M-9 is recognized as:
>>
>> #+BEGIN_SRC emacs-lisp
>> (read-char) ; type C-c C-c y M-9 *here*
>> #+END_SRC
>>
>> #+RESULTS:
>> : 134217785
>>
>> on my MacBook and that makes some sense as cdlatex.el uses `(read-char)' 
once 
>> it is triggered by a back tic. And I guess that `read-char' is immune to 
>> keymapping for good reason.
>>
>> For the record, this happens with
>>
>> #+BEGIN_SRC elisp
>>  (define-key key-translation-map (kbd "M-9") (kbd "`"))
>> #+END_SRC
>>
>>
>> set in org-cdlatex-mode when the first back tic (or M-9) is followed by a M-
9 
>> and it also happens for other key events that do not map to characters 
like 
>> `C-S-s' after the back tic.
>>
>> So the easiest fix is *don't do that*.
>>
>> I suppose this counts as a bug in cdlatex, but it seems easy enough to 
work 
>> around.
>
>Just to be clear on what such a workaround would amount to:
>
>With M-9 defined as above, customize `cdlatex-math-symbol-prefix' to any 
>of the unused symbols.
>
>Suppose it is ':'. Then in a buffer in which org-cdlatex-mode is 
>operative,
>
>M-9 : : : : ...
>
>cycles thru the different levels until the user selects another 
>letter/symbol in the menu.
>
>HTH,
>
>Chuck
>

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

* Re: Wrong type argument: characterp, 134217782 (??)
  2016-01-24 22:14 vendo.libri
@ 2016-01-25  4:54 ` Charles C. Berry
  0 siblings, 0 replies; 8+ messages in thread
From: Charles C. Berry @ 2016-01-25  4:54 UTC (permalink / raw)
  To: vendo.libri@libero.it; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1639 bytes --]

On Sun, 24 Jan 2016, vendo.libri@libero.it wrote:

> Ok, so if I want to use this character '•' (a bullet mark) to trigger math
> expression, what should I write in my .emacs file regarding the `cdlatex-math-
> symbol-prefix' variable?

The bullet is not a *character* per se in emacs.

So you cannot do that.

The left quote (back tic) is used to trigger math symbol selection. You 
cannot easily change that, but you can remap a key as you did for M-9 and 
that will allow you to enter the selection menus. But you cannot use that 
character (M-9) to change levels. You can customize 
`cdlatex-math-symbol-prefix' to set a symbol for that purpose.

(Please help me out, I know nothing about how to write
> elisp).

Elisp is not needed.

You need to use the customize interface. See

 	(info "(emacs) Customization Groups")

Briefly, type

M-x customize RET

Then type `cdlatex-math' in the search box and click `search'.

Then click on the mark left of Cdlatex Math Symbol Prefix, delete the '`' 
and type in the character you want to traverse levels in the math symbo 
menus. Then change the state. `Save for Future Sessions' will modify your 
.emacs for you.


> Since you mention this might be a bug with CDLaTeX, I'd like to add that
> pressing TAB after '-' (dash) in an itemize environment doesn't put '\item'. I
> believe it's an empty command.
>

It works fine for me. Be sure you have org-cdlatex-mode enabled and that 
you really are in a suitable environment. If you see messages like

 	if: No open environment at point.
or
 	if: No item defined for abc environment.

in the *Messages* buffer, you have erred.

HTH,

Chuck

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

* Re: Wrong type argument: characterp, 134217782 (??)
@ 2016-01-25 20:41 vendo.libri
  2016-01-26  0:03 ` Charles C. Berry
  0 siblings, 1 reply; 8+ messages in thread
From: vendo.libri @ 2016-01-25 20:41 UTC (permalink / raw)
  To: emacs-orgmode

Chuck, 
Thank you for addressing my issue with backquote and CDLaTeX.

From your explanation I gather my problem just split in two.

1. Remap an alternative key to type ` (backquote or back-tick, as you prefer), 
possibly a key that CDLaTeX understands so it allows me to enter the "math 
symbols menu". There's no work-around here, it's only backquote that grants the 
access to said menu.

2. Choose an alternative character that lets me cycle through the 3 levels of 
the math symbols menu. This is done by modifying the "cdlatex-math-symbol-
prefix".

I've managed to solve problem n.2, i.e. instead of backquote I now have '@' to 
cycle through the menu. I did this with the command "M-x customize-option RET" 
followed by "cdlatex-math-symbol-prefix", changing to '@' and saving everything 
into my .emacs file for future sessions.

Problem n.2 appears a little bit more complicated to me, since the remapping 
that you cite was done for me by other emacs expert users. Nevertheless here's 
my attempt:

    ;;; a key for backquote symbol
    (define-key key-translation-map (kbd "M-6") "")
    (define-key key-translation-map (kbd "M-9") (kbd "`"))
    ;;;this one's only for CDLaTeX math insertion
    (define-key key-translation-map (kbd "C-1") (kbd "`")) 

I press Ctrl and 1 together and that's equivalent to backquote. This solution 
works and solves problem n.1 too allowing me to enter the math symbols menu. 
However I was wondering if there's a way to remap backquote so that the minor 
mode CDLatex doesn't override Org-mode's keymap, specifically its mapping of 
the backquote character. 

I've read the "Mastering Key Bindings in emacs" article on www.masteringemacs.
org (link: https://www.masteringemacs.org/article/mastering-key-bindings-emacs) 
and there seems to be a keymap called "minor-mode-map-alist". Can it be used to 
"talk" to CDLaTeX? Something like "(define-key minor-mode-map-alist (kbd "M-9") 
(kbd "`")) " perhaps? I'm not sure how to write this remapping command and I 
don't want to break emacs' configuration. Can you give me some pointers?

Thank you again for taking the time to get into this hairy business.


>----Messaggio originale----
>Da: Charles C. Berry <ccberry@ucsd.edu>
>Data: 25-gen-2016 5.54
>A: "vendo.libri@libero.it"<vendo.libri@libero.it>
>Cc: <emacs-orgmode@gnu.org>
>Ogg: Re: Wrong type argument: characterp, 134217782 (??)
>
>On Sun, 24 Jan 2016, vendo.libri@libero.it wrote:
>
>> Ok, so if I want to use this character '•' (a bullet mark) to trigger math
>> expression, what should I write in my .emacs file regarding the `cdlatex-
math-
>> symbol-prefix' variable?
>
>The bullet is not a *character* per se in emacs.
>
>So you cannot do that.
>
>The left quote (back tic) is used to trigger math symbol selection. You 
>cannot easily change that, but you can remap a key as you did for M-9 and 
>that will allow you to enter the selection menus. But you cannot use that 
>character (M-9) to change levels. You can customize 
>`cdlatex-math-symbol-prefix' to set a symbol for that purpose.
>
>(Please help me out, I know nothing about how to write
>> elisp).
>
>Elisp is not needed.
>
>You need to use the customize interface. See
>
> 	(info "(emacs) Customization Groups")
>
>Briefly, type
>
>M-x customize RET
>
>Then type `cdlatex-math' in the search box and click `search'.
>
>Then click on the mark left of Cdlatex Math Symbol Prefix, delete the '`' 
>and type in the character you want to traverse levels in the math symbo 
>menus. Then change the state. `Save for Future Sessions' will modify your 
>.emacs for you.
>
>
>> Since you mention this might be a bug with CDLaTeX, I'd like to add that
>> pressing TAB after '-' (dash) in an itemize environment doesn't put 
'\item'. I
>> believe it's an empty command.
>>
>
>It works fine for me. Be sure you have org-cdlatex-mode enabled and that 
>you really are in a suitable environment. If you see messages like
>
> 	if: No open environment at point.
>or
> 	if: No item defined for abc environment.
>
>in the *Messages* buffer, you have erred.
>
>HTH,
>
>Chuck
>

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

* Re: Wrong type argument: characterp, 134217782 (??)
  2016-01-25 20:41 Wrong type argument: characterp, 134217782 (??) vendo.libri
@ 2016-01-26  0:03 ` Charles C. Berry
  0 siblings, 0 replies; 8+ messages in thread
From: Charles C. Berry @ 2016-01-26  0:03 UTC (permalink / raw)
  To: vendo.libri@libero.it; +Cc: emacs-orgmode

On Mon, 25 Jan 2016, vendo.libri@libero.it wrote:

> Chuck,
> Thank you for addressing my issue with backquote and CDLaTeX.
>
[snip]

> However I was wondering if there's a way to remap backquote so that the minor
> mode CDLatex doesn't override Org-mode's keymap, specifically its mapping of
> the backquote character.
>

There is. But I would not go there.

If you need to enter a back tic escape it with "C-q `"

See C-h f quoted-insert RET

Chuck

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

end of thread, other threads:[~2016-01-26  0:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 20:41 Wrong type argument: characterp, 134217782 (??) vendo.libri
2016-01-26  0:03 ` Charles C. Berry
  -- strict thread matches above, loose matches on Subject: below --
2016-01-24 22:14 vendo.libri
2016-01-25  4:54 ` Charles C. Berry
2016-01-23 13:36 vendo.libri
2016-01-23 20:42 ` Eric S Fraga
2016-01-24  1:11   ` Charles C. Berry
2016-01-24  4:57     ` Charles C. Berry

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).