From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Re: Return value not as expected in Emacs Lisp function Date: Fri, 09 Aug 2013 14:03:06 +0200 Message-ID: <8761vfm5qd.fsf@gmail.com> References: <8738qlfic3.fsf@gmail.com> <87pptpnrba.fsf@informatimago.com> <87pptpdscs.fsf@gmail.com> <87li4bolvs.fsf@informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1376049834 8450 80.91.229.3 (9 Aug 2013 12:03:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 9 Aug 2013 12:03:54 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 09 14:03:55 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V7lQA-0004D2-Bu for geh-help-gnu-emacs@m.gmane.org; Fri, 09 Aug 2013 14:03:54 +0200 Original-Received: from localhost ([::1]:45419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7lQA-00084y-0O for geh-help-gnu-emacs@m.gmane.org; Fri, 09 Aug 2013 08:03:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7lPk-0007su-IW for help-gnu-emacs@gnu.org; Fri, 09 Aug 2013 08:03:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7lPe-00089m-Mn for help-gnu-emacs@gnu.org; Fri, 09 Aug 2013 08:03:28 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:50945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7lPe-00089c-44 for help-gnu-emacs@gnu.org; Fri, 09 Aug 2013 08:03:22 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1V7lPc-0003gO-8S for help-gnu-emacs@gnu.org; Fri, 09 Aug 2013 14:03:20 +0200 Original-Received: from g231225193.adsl.alicedsl.de ([92.231.225.193]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 09 Aug 2013 14:03:20 +0200 Original-Received: from tjolitz by g231225193.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 09 Aug 2013 14:03:20 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 61 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: g231225193.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:+fBhpXqJn2p9HKabskKGt4680Qk= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:92791 Archived-At: "Pascal J. Bourguignon" writes: > Thorsten Jolitz writes: > >> ,----------------------------------------------------------------- >> | "(prog (click NIL 1) (press NIL 1) (click NIL 4) (click NIL 1))" >> `----------------------------------------------------------------- >> >> is actually PicoLisp, a lisp-1 with NIL and T syntax (uppercase!). I >> thought the 'prog in the beginning (PicoLisp's 'progn) would make it >> clear its not Elisp. At least C-h f doesn' show me a 'prog function in >> Elisp. >> >> But thanks for your answer, I did not know `prin1-to-string', and finally >> looked up the difference between lisp-1 and lisp-2. > > Ok, that explains the 'lst. > > Now, emacs has one good characteristic that helps in manipilating sexps > from other lisps: it has no module or package system and it has case > sensitive symbols, with no lisp reader to upcase them automatically by > default. > > Therefore, you can perfectly manipulate picolisp sexps as emacs lisp > sexps. Unless you have to deal with reader macros or other strange > syntaxes, my advice would be to stick to sexps, this has big advantages > over strings. But isn't the communication between the two lisps (picolisp and elisp) always done with strings? It `comint-send-string' or `process-send-string', no matter if that string contains a sexp or something else. Of course, both lisps can then "read-from-string" the sexps they recieve from the other program if the syntax matches, but they are send and arrive as strings - right? > As for the misplaced parenthesis problem, be sure to let emacs > auto-indent lisp (any) code for you, selectnig a region and typing C-M-\ > (indent-region), or using paredit (strongly advised, to edit any kind of > sexps), typing M-q (paredit-reindent-defun) from time to time inside > sexps. > > Then you will be shocked by any misplaced parenthesis, since it will > imply very strange indentation, like this: > > > (defun hostname () > (interactive "Hello" > (cond ((boundp 'system-name) system-name) > ((fboundp 'system-name) (system-name))) > (t (shell-command-to-string > "echo -n $( (hostname -f 2>/dev/null) || (hostname 2>/dev/null) )")))) > > where it is obvious that there's a missing closing parenthesis for > interactive, and that the cond is closed too early (before the (t …) > branch. ok, thx for the tip. -- cheers, Thorsten