emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* (require 'cl) seems not to be compiled
@ 2010-06-10 17:37 manonfire
  2010-06-27 10:00 ` David Maus
  0 siblings, 1 reply; 8+ messages in thread
From: manonfire @ 2010-06-10 17:37 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

some time ago I had a problem with agenda pdf export due to flet macro not
found,
which could be worked around by putting (require 'cl) in .emacs.

http://comments.gmane.org/gmane.emacs.orgmode/21837


Carsten Dominik pointed out this is unnecessary because of

(eval-when-compile
   (require 'cl))

in the sources.


But I still can't get it to work on several different systems with Ubuntu.
It doesn't seem to be compiled in.

- I think I can rule out version conflicts, never installed system wide
anymore and on a new installation of Ubuntu 10.04 32bit with Emacs 23.1.1
(i486) from the repositories.
-- That means: unzipping org-6.36c.zip and doing a simple make in the
resulting directory, didn't change the makefile.
- no errors or significant warnings during the make process
- tried to remove all .el files from the lisp subdirectory to make sure
that only .elc files are loaded.

Do I have to edit the makefile for installing org as normal user in my
home directory, so that the compiler finds cl.el or something?

Everything else seems to work, though, but there might be performance
issues or other instabilities when something is not compiled correctly,
and, of course, orgmode is all about perfectonism ;)


So, again, the steps until the error occurs are
-load org file with C-x C-f
-display agenda with C-c a a
-try to export: C-x C-w agenda.pdf
--> Symbol's function definition is void: flet




The test org file contains

* Item 1
** Item 1.1 <2010-06-12 Sa>
* Item 2
** TODO Item 2.1
   SCHEDULED: <2010-06-10 Do>



My .emacs:

(setq load-path (cons "~/app/org-6.36c/lisp" load-path))
(setq load-path (cons "~/app/org-6.36c/contrib/lisp" load-path))


(require 'org-install)

;;(require 'cl)

(setq org-directory "~/orgfiles/")

;;(global-font-lock-mode 1)


(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(inhibit-startup-screen t)
 '(initial-buffer-choice nil)
 '(org-agenda-files (quote ("~/orgfiles/test.org")))
 '(scroll-bar-mode (quote right)))

(setq visible-bell t)


(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(global-set-key "\C-c1" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)

(org-remember-insinuate)
(setq org-default-notes-file (concat org-directory "/notes.org"))
(define-key global-map "\C-cr" 'org-remember)

;; htmlize from contrib
;;(add-to-list 'load-path "~/app/org-6.36c/contrib/lisp")
;;(require 'htmlize)



; Enable habit tracking
(setq org-modules (quote (org-habit)))
; global STYLE property values for completion
(setq org-global-properties (quote (("STYLE_ALL" . "habit"))))
; position the habit graph on the agenda to the right of the default
(setq org-habit-graph-column 50)


; TODO state logging
(setq org-log-done 'time)


; save clock history across Emacs sessions
(setq org-clock-persist 'history)
(org-clock-persistence-insinuate)


;;(setq org-agenda-exporter-settings
;;      '((ps-number-of-columns 2)
;;	(ps-landscape-mode t)
;;	(org-agenda-add-entry-text-maxlines 5)
;;	(htmlize-output-type 'css)))

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

* Re: (require 'cl) seems not to be compiled
  2010-06-10 17:37 (require 'cl) seems not to be compiled manonfire
@ 2010-06-27 10:00 ` David Maus
  2010-06-27 14:30   ` [PATCH] Make sure `flet' is fbound when executing `org-write-agenda' David Maus
  2010-06-27 14:30   ` David Maus
  0 siblings, 2 replies; 8+ messages in thread
From: David Maus @ 2010-06-27 10:00 UTC (permalink / raw)
  To: manonfire; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1059 bytes --]

 wrote:
>Hello,

>some time ago I had a problem with agenda pdf export due to flet macro not
>found,
>which could be worked around by putting (require 'cl) in .emacs.

>http://comments.gmane.org/gmane.emacs.orgmode/21837


>Carsten Dominik pointed out this is unnecessary because of

>(eval-when-compile
>   (require 'cl))

>in the sources.


>But I still can't get it to work on several different systems with Ubuntu.
>It doesn't seem to be compiled in.

I can reproduce this, have an idea about what's happening, but none
about howto best fix this.  The problem is, that lisp structure that
uses the flet macro in `org-write-agenda' is passed as argument eq
quoted list to `org-let'.  The byte compiler doesn't compile the lisp
structure, it is evaluated by `org-let' at runtime.

Thus, if no other package had loaded cl before `org-write-agenda' is
called, passes the lisp structure to `org-let, which evaluates it and
flet is found not to be fbound.

HTH
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* [PATCH] Make sure `flet' is fbound when executing `org-write-agenda'
  2010-06-27 10:00 ` David Maus
@ 2010-06-27 14:30   ` David Maus
  2010-06-27 14:30   ` David Maus
  1 sibling, 0 replies; 8+ messages in thread
From: David Maus @ 2010-06-27 14:30 UTC (permalink / raw)
  To: emacs-orgmode

Well, something I could come up is this: Simply check if flet is
fbound in the lisp structure that is evaluated at runtime.  If it is
not, require 'cl.

David Maus (1):
  Make sure `flet' is fbound when executing `org-write-agenda'.

 lisp/org-agenda.el |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

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

* [PATCH] Make sure `flet' is fbound when executing `org-write-agenda'.
  2010-06-27 10:00 ` David Maus
  2010-06-27 14:30   ` [PATCH] Make sure `flet' is fbound when executing `org-write-agenda' David Maus
@ 2010-06-27 14:30   ` David Maus
  2010-06-27 15:00     ` Štěpán Němec
  1 sibling, 1 reply; 8+ messages in thread
From: David Maus @ 2010-06-27 14:30 UTC (permalink / raw)
  To: emacs-orgmode

* org-agenda.el (org-write-agenda): Make sure `flet' is fbound
at runtime.
---
 lisp/org-agenda.el |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 8035add..957bbf2 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2464,6 +2464,8 @@ higher priority settings."
 		beg (or (next-single-property-change beg 'org-filtered)
 			(point-max))))
 	     (run-hooks 'org-agenda-before-write-hook)
+	     ;; make sure flet is fbound at runtime
+	     (unless (fboundp 'flet) (require 'cl))
 	     (cond
 	      ((org-bound-and-true-p org-mobile-creating-agendas)
 	       (org-mobile-write-agenda-for-mobile file))
-- 
1.7.1

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

* Re: [PATCH] Make sure `flet' is fbound when executing `org-write-agenda'.
  2010-06-27 14:30   ` David Maus
@ 2010-06-27 15:00     ` Štěpán Němec
  2010-06-27 16:01       ` [PATCH] Use backquotes to make byte compiler expand `flet' macro David Maus
  2010-06-27 16:01       ` David Maus
  0 siblings, 2 replies; 8+ messages in thread
From: Štěpán Němec @ 2010-06-27 15:00 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode

David Maus <dmaus@ictsoc.de> writes:

> * org-agenda.el (org-write-agenda): Make sure `flet' is fbound
> at runtime.
> ---
>  lisp/org-agenda.el |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 8035add..957bbf2 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -2464,6 +2464,8 @@ higher priority settings."
>  		beg (or (next-single-property-change beg 'org-filtered)
>  			(point-max))))
>  	     (run-hooks 'org-agenda-before-write-hook)
> +	     ;; make sure flet is fbound at runtime
> +	     (unless (fboundp 'flet) (require 'cl))
>  	     (cond
>  	      ((org-bound-and-true-p org-mobile-creating-agendas)
>  	       (org-mobile-write-agenda-for-mobile file))

This, while being an obvious (and correct) solution, is unfortunately
not suitable for Emacs core. You're not supposed to require the cl
package at runtime (you even get a compiler warning if you do).

Štěpán

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

* [PATCH] Use backquotes to make byte compiler expand `flet' macro.
  2010-06-27 15:00     ` Štěpán Němec
@ 2010-06-27 16:01       ` David Maus
  2010-06-27 16:01       ` David Maus
  1 sibling, 0 replies; 8+ messages in thread
From: David Maus @ 2010-06-27 16:01 UTC (permalink / raw)
  To: emacs-orgmode

> This, while being an obvious (and correct) solution, is unfortunately
> not suitable for Emacs core. You're not supposed to require the cl
> package at runtime (you even get a compiler warning if you do).

I see.  So backquotes to the rescue: Tested with Emacs 23.2

emacs -Q

(progn
  (add-to-list 'load-path "~/code/org-mode/git/lisp/")

  (require 'org-install)
  (require 'org)

  (fboundp 'flet))

=> nil

M-x org-agenda RET a C-x C-w ~/test.pdf RET

Happily creates the pdf.

David Maus (1):
  Use backquotes to make byte compiler expand `flet' macro.

 lisp/org-agenda.el |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

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

* [PATCH] Use backquotes to make byte compiler expand `flet' macro.
  2010-06-27 15:00     ` Štěpán Němec
  2010-06-27 16:01       ` [PATCH] Use backquotes to make byte compiler expand `flet' macro David Maus
@ 2010-06-27 16:01       ` David Maus
  2010-06-28  4:29         ` Carsten Dominik
  1 sibling, 1 reply; 8+ messages in thread
From: David Maus @ 2010-06-27 16:01 UTC (permalink / raw)
  To: emacs-orgmode

* org-agenda.el (org-write-agenda): Use backquotes to expand
`flet' at compile time.
---
 lisp/org-agenda.el |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 8035add..9056206 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2450,7 +2450,7 @@ higher priority settings."
    ((string-match "\\.html?\\'" file) (require 'htmlize))
    ((string-match "\\.ps\\'" file) (require 'ps-print)))
   (org-let (if nosettings nil org-agenda-exporter-settings)
-    '(save-excursion
+    `(save-excursion
        (save-window-excursion
 	 (org-agenda-mark-filtered-text)
 	 (let ((bs (copy-sequence (buffer-string))) beg)
@@ -2482,14 +2482,14 @@ higher priority settings."
 	       (message "HTML written to %s" file))
 	      ((string-match "\\.ps\\'" file)
 	       (require 'ps-print)
-	       (flet ((ps-get-buffer-name () "Agenda View"))
-		 (ps-print-buffer-with-faces file))
+	       ,(flet ((ps-get-buffer-name () "Agenda View"))
+		  (ps-print-buffer-with-faces file))
 	       (message "Postscript written to %s" file))
 	      ((string-match "\\.pdf\\'" file)
 	       (require 'ps-print)
-	       (flet ((ps-get-buffer-name () "Agenda View"))
-		 (ps-print-buffer-with-faces
-		  (concat (file-name-sans-extension file) ".ps")))
+	       ,(flet ((ps-get-buffer-name () "Agenda View"))
+		  (ps-print-buffer-with-faces
+		   (concat (file-name-sans-extension file) ".ps")))
 	       (call-process "ps2pdf" nil nil nil
 			     (expand-file-name
 			      (concat (file-name-sans-extension file) ".ps"))
-- 
1.7.1

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

* Re: [PATCH] Use backquotes to make byte compiler expand `flet' macro.
  2010-06-27 16:01       ` David Maus
@ 2010-06-28  4:29         ` Carsten Dominik
  0 siblings, 0 replies; 8+ messages in thread
From: Carsten Dominik @ 2010-06-28  4:29 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode

Hi David,

this is a great solution, thanks.

- Carsten

On Jun 27, 2010, at 6:01 PM, David Maus wrote:

> * org-agenda.el (org-write-agenda): Use backquotes to expand
> `flet' at compile time.
> ---
> lisp/org-agenda.el |   12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 8035add..9056206 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -2450,7 +2450,7 @@ higher priority settings."
>    ((string-match "\\.html?\\'" file) (require 'htmlize))
>    ((string-match "\\.ps\\'" file) (require 'ps-print)))
>   (org-let (if nosettings nil org-agenda-exporter-settings)
> -    '(save-excursion
> +    `(save-excursion
>        (save-window-excursion
> 	 (org-agenda-mark-filtered-text)
> 	 (let ((bs (copy-sequence (buffer-string))) beg)
> @@ -2482,14 +2482,14 @@ higher priority settings."
> 	       (message "HTML written to %s" file))
> 	      ((string-match "\\.ps\\'" file)
> 	       (require 'ps-print)
> -	       (flet ((ps-get-buffer-name () "Agenda View"))
> -		 (ps-print-buffer-with-faces file))
> +	       ,(flet ((ps-get-buffer-name () "Agenda View"))
> +		  (ps-print-buffer-with-faces file))
> 	       (message "Postscript written to %s" file))
> 	      ((string-match "\\.pdf\\'" file)
> 	       (require 'ps-print)
> -	       (flet ((ps-get-buffer-name () "Agenda View"))
> -		 (ps-print-buffer-with-faces
> -		  (concat (file-name-sans-extension file) ".ps")))
> +	       ,(flet ((ps-get-buffer-name () "Agenda View"))
> +		  (ps-print-buffer-with-faces
> +		   (concat (file-name-sans-extension file) ".ps")))
> 	       (call-process "ps2pdf" nil nil nil
> 			     (expand-file-name
> 			      (concat (file-name-sans-extension file) ".ps"))
> -- 
> 1.7.1
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

end of thread, other threads:[~2010-06-28  4:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-10 17:37 (require 'cl) seems not to be compiled manonfire
2010-06-27 10:00 ` David Maus
2010-06-27 14:30   ` [PATCH] Make sure `flet' is fbound when executing `org-write-agenda' David Maus
2010-06-27 14:30   ` David Maus
2010-06-27 15:00     ` Štěpán Němec
2010-06-27 16:01       ` [PATCH] Use backquotes to make byte compiler expand `flet' macro David Maus
2010-06-27 16:01       ` David Maus
2010-06-28  4:29         ` Carsten Dominik

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).