From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Filippo A. Salustri" Subject: Re: accessing org-lowest-priority in .emacs Date: Thu, 16 Jun 2011 12:05:49 -0400 Message-ID: References: <9626.1308231546@alphaville.dokosmarshall.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf301fb8814ef9b804a5d6712f Return-path: Received: from eggs.gnu.org ([140.186.70.92]:51374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXF4r-0003Ec-QS for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 12:05:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXF4q-000732-1E for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 12:05:53 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:55758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXF4p-00072m-7d for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 12:05:51 -0400 Received: by wwb39 with SMTP id 39so1423738wwb.30 for ; Thu, 16 Jun 2011 09:05:50 -0700 (PDT) In-Reply-To: <9626.1308231546@alphaville.dokosmarshall.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: emacs-orgmode mailing list --20cf301fb8814ef9b804a5d6712f Content-Type: text/plain; charset=ISO-8859-1 I must be a moron. But I'm still having problems. Here's what's in my Preferences.el: .... (require 'org-install) (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) ; use it for *.org. (add-hook 'org-mode-hook 'turn-on-font-lock) ; font lock on always. (defvar fas/org-priority-scale (/ (* 1000 (- org-lowest-priority org-highest-priority)) 10)) .... When I start aquamacs, I get an error that org-lowest-priority is not defined. Help? Cheers. Fil On 16 June 2011 09:39, Nick Dokos wrote: > Filippo A. Salustri wrote: > > > > I've got code of this form in my Preferences.el (aquamacs-speak for > .emacs): > > > > (defvar fas/org-some-variable > > (/ 10 (* 1000 (- org-lowest-priority org-highest-priority)))) > > > > But org-lowest-priority & org-highest-priority aren't defined at that > > point in Preferences.el. I need to defer the calculation till org is > > running. > > > > You just need to defer it until org is loaded: just put it after the > (require 'org-install). If you are depending on an autoloaded function > to be called in order to load org, you can just (require 'org) at some > place in Preferences.el and put the defvar after it. Or you can > initialize it in a hook - org-load-hook is the one to use here: > > (add-to-list 'org-load-hook > (function > (lambda () > (setq fas/org-some-variable > (/ 10 (* 1000 (- org-lowest-priority > org-highest-priority))))))) > > Nick > > > > > > > > -- \V/_ Filippo A. Salustri, Ph.D., P.Eng. Mechanical and Industrial Engineering Ryerson University 350 Victoria St, Toronto, ON M5B 2K3, Canada Tel: 416/979-5000 ext 7749 Fax: 416/979-5265 Email: salustri@ryerson.ca http://deseng.ryerson.ca/~fil/ --20cf301fb8814ef9b804a5d6712f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I must be a moron. =A0But I'm still having problems.
Here's wha= t's in my Preferences.el:

....
= (require 'org-install)
(add-to-list 'auto-mode-alist '= ;("\\.org\\'" . org-mode)) ; use it for *.org.
(add-hook 'org-mode-hook 'turn-on-font-lock) =A0 =A0 =A0 =A0 = =A0 =A0 ; font lock on always.

(defvar fas/org-pri= ority-scale
=A0 (/ (* 1000 (- org-lowest-priority org-highest-pri= ority)) 10))
....

When I start aquamacs, I get an error th= at org-lowest-priority is not defined.

Help?
=

Cheers.
Fil


On 16 June 2011 09:39, Nick Dokos <nicholas.dokos@hp.com> wrote:
Filippo A. Salustri <salustri@ryerson.ca> wrote:


> I've got code of this form in my Preferences.el (aquamacs-speak fo= r .emacs):
>
> (defvar fas/org-some-variable
> =A0 (/ 10 (* 1000 (- org-lowest-priority org-highest-priority))))
>
> But org-lowest-priority & org-highest-priority aren't defined = at that
> point in Preferences.el. =A0I need to defer the calculation till org i= s
> running.
>

You just need to defer it until org is loaded: just put it after the<= br> (require 'org-install). If you are depending on an autoloaded function<= br> to be called in order to load org, you can just (require 'org) at some<= br> place in Preferences.el and put the defvar after it. Or you can
initialize it in a hook - org-load-hook is the one to use here:

(add-to-list 'org-load-hook
=A0 =A0 =A0 =A0 =A0 =A0 (function
=A0 =A0 =A0 =A0 =A0 =A0 =A0 (lambda ()
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(setq =A0fas/org-some-variable
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (/ 10 (* 1000 (- org-lowest-pr= iority org-highest-priority)))))))

Nick










--
\V/_
Filippo= A. Salustri, Ph.D., P.Eng.
Mechanical and Industrial Engineering
Rye= rson University
350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: = 416/979-5000 ext 7749
Fax: 416/979-5265
Email: salustri@ryerson.ca
http://deseng.ryerson.ca/~fil/

--20cf301fb8814ef9b804a5d6712f--