I'm happy to announce the release of Clon version 1.0b17. This version notably introduces support for ABCL and expands the documentation in the portability section. Grab it here.
Didier Verna's scientific blog: Lisp, Emacs, LaTeX and random stuff. |
Monday, January 24 2011
By Didier Verna on Monday, January 24 2011, 18:06 - Lisp
I'm happy to announce the release of Clon version 1.0b17. This version notably introduces support for ABCL and expands the documentation in the portability section. Grab it here.
Thursday, December 16 2010
By Didier Verna on Thursday, December 16 2010, 16:30 - LaTeX
Tuesday, December 14 2010
By Didier Verna on Tuesday, December 14 2010, 15:24 - LaTeX
Friday, December 3 2010
By Didier Verna on Friday, December 3 2010, 22:00 - LaTeX
Tuesday, November 30 2010
By Didier Verna on Tuesday, November 30 2010, 13:27 - Lisp
Thursday, November 18 2010
By Didier Verna on Thursday, November 18 2010, 08:20 - Lisp
Thursday, November 11 2010
By Didier Verna on Thursday, November 11 2010, 20:24 - Lisp
Tuesday, November 9 2010
By Didier Verna on Tuesday, November 9 2010, 08:27 - Lisp
Tuesday, September 21 2010
By Didier Verna on Tuesday, September 21 2010, 08:21 - Lisp
Tuesday, August 31 2010
By Didier Verna on Tuesday, August 31 2010, 14:31 - Lisp
Thursday, February 25 2010
By xemacs on Thursday, February 25 2010, 13:25 - (X)Emacs
Monday, February 15 2010
By Didier Verna on Monday, February 15 2010, 17:03 - Lisp
Monday, September 21 2009
By Didier Verna on Monday, September 21 2009, 16:27 - LaTeX
By Didier Verna on Monday, September 21 2009, 08:27 - LaTeX
Monday, September 14 2009
By Didier Verna on Monday, September 14 2009, 07:49 - LaTeX
Wednesday, July 22 2009
By Didier Verna on Wednesday, July 22 2009, 11:42 - LaTeX
Wednesday, April 1 2009
By Didier Verna on Wednesday, April 1 2009, 08:41 - Lisp
Tuesday, July 1 2008
By Didier Verna on Tuesday, July 1 2008, 13:07 - Lisp
[cell drawWithFrame: frame inView: view];will translate into this in CLL:
(#/drawWithFrame:inView: cell frame view). Indeed, Objective C is designed around the record-based model (methods belong to classes), so the cell object receives the drawWithFrame:inView: message via the funny bracket syntax. On the other hand, the Lisp translation involves a generic function call with the usual funcall syntax. The dispatch occurs on the first argument (the cell), and the rest is actual arguments to the message.
cl-indent-function
will indent this as an ordinary function call, like this:(#/drawWithFrame:inView: cellwhich is awfull. What I want is the following indentation:
frame view
(#/drawWithFrame:inView: cellThis kind of indentation is normally achieved by putting a
frame view
common-lisp-indent-function
property of 1 on the function symbol. However, you don't want to do that on all possible ObjC message by hand (and you don't know them all in advance anyway). The following advice on common-lisp-indent-function
(from the cl-indent
package does the trick. It dynamically puts the property on each relevant symbol every time it is subject to indentation. A bit brute force, but it works smoothly.(defadvice common-lisp-indent-function (before ccl-objc-bridge activate)
"Improve indentation scheme of the CCL Objective-C bridge.
Currently, this does the following:
- All (#/doThis:withThat: ...) forms are indented as per a
lisp-indent-function property of 1. This effectively treats the first argument
(an object or a class) as special. The indentation you get is:
(#/function arg1 instead of: (#/function arg1
arg2 ...) arg2 ...)"
(let ((containing-form-start (elt state 1)))
(save-excursion
(goto-char containing-form-start)
(forward-char 1)
(cond ((looking-at "#/\\(\\w\\|:\\)*:")
;; We're looking at a (#/doThis:withThat: ...) form. In its holy
;; brokenness, common-lisp-indent-function with the help of
;; parse-partial-sexp will consider that the function name in
;; this form is "/functioncall:". Our trick here is to
;; dynamically put a lisp-indent-function property of 1 on this
;; symbol, so that the subsequent (original) indenting function
;; will handle it.
(let* ((beg (progn (forward-char 1) (point)))
(sym (progn
(forward-sexp 1)
(intern (downcase (buffer-substring beg
(point)))))))
(put sym 'common-lisp-indent-function 1)))))))
(put 'slet 'common-lisp-indent-function
'((&whole 4 &rest (&whole 1 1 2)) &body))
(put 'slet* 'common-lisp-indent-function
'((&whole 4 &rest (&whole 1 1 2)) &body))
Wednesday, June 4 2008
By Didier Verna on Wednesday, June 4 2008, 10:04 - LaTeX
\lstinputlisting
inside a Beamer block.xkeyval
package to create a "title" option:\define@cmdkey[dvl]{lst}[@dvl@lst@]{title}{}
%% \dvlinputlisting{overlay}{title}{lstoption=,...}{file}
\newcommand\dvlinputlisting[4]{%
\begin{block}#1{#2}
%% #### WARNING: I need this hack because keyval-style options
%% mess up the parsing.
\expandafter\lstinputlisting\expandafter[#3]{#4}
\end{block}}
%% Language-specific shortcuts:
%% The title option is used for the beamer block's title.
%% All other options are passed to listings.
%% \XXXinputlisting<overlay>[title=,lstoption=,...]{file}
\newcommand<>\clinputlisting[2][]{%
\def\@dvl@lst@title{Lisp}%
\setkeys*[dvl]{lst}{#1}%
\edef\@dvl@lst@options{language=lisp,\XKV@rm}%
\dvlinputlisting{#3}{\@dvl@lst@title}{\@dvl@lst@options}{#2.lisp}}
\clinputlisting<2->[title={Example 1}, gobble=2]{ex1}
\lstinputlisting
as before to include it. Clever right ?\jobname.dvl
. In the ending, we call our previous macro \dvlinputlisting
on that file (actually, on a dynamically created argument list called \@dvl@args
:\usepackage{verbatim}
\newwrite\lstvrb@out
\def\@dvllisting{%
\begingroup
\@bsphack
\immediate\openout\lstvrb@out\jobname.dvl
\let\do\@makeother\dospecials\catcode`\^^M\active
\def\verbatim@processline{%
\immediate\write\lstvrb@out{\the\verbatim@line}}%
\verbatim@start}
\def\@enddvllisting{%
\immediate\closeout\lstvrb@out
\@esphack
\endgroup
\expandafter\dvlinputlisting\@dvl@args}
\newenvironment<>{cllisting}[1][]{%
\def\@dvl@lst@title{Lisp}%
\setkeys*[dvl]{lst}{#1}%
\edef\@dvl@lst@options{language=lisp,\XKV@rm}%
\xdef\@dvl@args{{#2}{\@dvl@lst@title}{\@dvl@lst@options}{%
\jobname.dvl}}
\@dvllisting}{%
\@enddvllisting}
\begin{cllinsting}<2->[title={Example 1},gobble=2]
(defun foo (x) (* 2 x))
\end{cllisting}
Wednesday, February 27 2008
By xemacs on Wednesday, February 27 2008, 18:01 - (X)Emacs
« previous entries - page 2 of 3 - next entries »