From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: vincent.belaiche@gmail.com (Vincent =?iso-8859-1?Q?Bela=EFche?=) Newsgroups: gmane.emacs.devel Subject: RE: SES local variables to define printers Date: Sun, 26 May 2013 09:16:48 +0200 Message-ID: <80a9nixlb3.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1369552669 24736 80.91.229.3 (26 May 2013 07:17:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 May 2013 07:17:49 +0000 (UTC) Cc: =?iso-8859-1?Q?Vincent_Bela=EFche?= To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 26 09:17:48 2013 Return-path: Envelope-to: ged-emacs-devel@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 1UgVD9-0000O2-9z for ged-emacs-devel@m.gmane.org; Sun, 26 May 2013 09:17:47 +0200 Original-Received: from localhost ([::1]:48247 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgVD8-0001pt-Jh for ged-emacs-devel@m.gmane.org; Sun, 26 May 2013 03:17:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgVCz-0001pi-34 for emacs-devel@gnu.org; Sun, 26 May 2013 03:17:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UgVCr-0006C8-L9 for emacs-devel@gnu.org; Sun, 26 May 2013 03:17:37 -0400 Original-Received: from smtp02.smtpout.orange.fr ([80.12.242.124]:29963 helo=smtp.smtpout.orange.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgVCr-0006Bp-CK for emacs-devel@gnu.org; Sun, 26 May 2013 03:17:29 -0400 Original-Received: from CHOUNEK ([92.135.235.217]) by mwinf5d49 with ME id gXHT1l0024i6Ly403XHT6h; Sun, 26 May 2013 09:17:28 +0200 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.12.242.124 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:159809 Archived-At: > From: monnier@iro.umontreal.ca > To: vincent.b.1@hotmail.fr > CC: emacs-devel@gnu.org > Subject: Re: SES local variables to define printers > Date: Sat, 25 May 2013 21:17:10 -0400 > > > Here is an example "example.ses", if you open it with the current SES it > > will generate an error "Invalid printer" while it used to work --- don't > > remember with which version, but that sort of thing was working one year > > or so ago. > > It doesn't work with any of Debian's Emacs-24.1, Emacs-23.4, or > Emacs-22.3. It must have been something different. > Well, since that was 1 year ago or so that I was using this sheet I may have done some hack at that time... sorry for the bold assertion that this *WAS wORKING*, I must admit that I am not so sure now. Now, having thought a bit more about it, I think that in most sheets I have the local variables my-tbc-time and my-checked-time defined as local variables, and the printer function defined as e.g. (lambda (x) (funcall my-tbc-time x)) rather than just my-tbc-time. I don't know why in the faulty one-year-old-sheet it was done with just my-tbc-time for the printer. Probably I had the symbol-function slot also defined somewhere else --- like in my *scratch* --- to the same function and that was hiding that defining locally the function in the value slot was not working. > > If you take my patch (attached as ses.el.gz) and configure > > ses-enable-local-variables you will have desired printing. > > How 'bout: > > You add to your .emacs > > (defun my-checked-time (x) > (let ((calc-float-format '(fix 1)) (calc-hms-format "%sh %sm %ss")) > (math-format-value x))) > (defun my-tbc-time (x) > (let ((calc-float-format '(fix 1))(calc-hms-format "?? %sh %sm %ss")) > (math-format-value x))) > > and then you can use those printer functions in your ses files. > > It's simple and safe, and it works without any changes. > > Well, it also means that your .emacs will grow endlessly as you create new sheets, and also that you cannot archive the sheet+printer in the same batch easily. Definitely I would not buy this one. Maybe another way would be to use ede mode, and to have the printer functions defined in some prj.el file. I must admit that I am not an experienced user of ede, I use it only inderectly through JDEE and I am not well aware of how ede ensures security. Anyway there could be some safe macro ses-printer-def placed in the EDE prj.el file to define needed printer functions, and ses-printer-def would make some check that the printer uses only functions without border effect and without any loop structure. Anyway, the simpler is to have printer functions configured as: (lambda (x) (funcall my-tbc-time x)) > Stefan Vincent.