When using parenscript if I execute
(parenscript:ps (slot-value ($ "#mytextarea") 'selectionStart))
It produces the javascript
$('#mytextarea').selectionstart;
Note that se开发者_StackOverflowlectionStart
is now selectionstart
. It lost the uppercase S on the Start
!
How do I keep that uppercase S around?
Parenscript will automatically convert from the lisp naming convention (dashes separating words) to CamelCase, so:
(parenscript:ps
(slot-value ($ "#mytextarea") 'selection-start))
results in
"$('#mytextarea').selectionStart;"
As Pillsy remarked, all symbols are upper-cased by default when they are read by the Lisp compiler. There is a way of turning that off, though. See the CLHS, 23.1.2 (Effect of Readtable Case on the Lisp Reader), and the description of the accessor readtable-case
for details. As an example, you can enable the “invert” mode (which is arguably the only practical setting that is also case-sensitive) by putting the following into your Lisp source file:
#.(setf (readtable-case *readtable*) :invert)
Unfortunately, ParenScript does not seem to make much use of a custom readtable-case setting, even though it could (and, in my opinion, should) do so.
精彩评论