Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8362209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:53:23+00:00 2026-06-09T11:53:23+00:00

I use the following code in .emacs file to set default publish behavior. I

  • 0

I use the following code in .emacs file to set default publish behavior. I put the org base directory in difference locations for difference computers:

;; define machine specific directories storing my org files
(cond ((system-name-is-home) (setq org-dir "/data/org"))
      ((system-name-is-work) (setq org-dir "~/org")))

Thus I’d like to use a variable to specify :base-directory to org-dir instead of hard-coding it as "~/org". How can I do that?

(require 'org-publish)
(setq org-publish-project-alist
      '(
        ("org-notes"
         :base-directory "~/org"
         :base-extension "org"
         :publishing-directory "~/tmp/"
         :recursive t
         :publishing-function org-publish-org-to-html
         :headline-levels 4
         :auto-preamble t

         :auto-sitemap t          ; Generate sitemap.org automagically ...
         :sitemap-filename "sitemap.org" ; ... call it sitemap.org (the default) ...
         :sitemap-title "Sitemap" ; ... with title 'Sitemap'.
         )
        ("org-static"
         :base-directory "~/org"
         :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
         :publishing-directory "~/tmp/"
         :recursive t
         :publishing-function org-publish-attachment
         )
        ("org" :components ("org-notes" "org-static"))
        ))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:53:24+00:00Added an answer on June 9, 2026 at 11:53 am

    One way to do it will be using ` (backquote) and , (comma). From GNU Emacs Lisp Reference Manual,

    Backquote constructs allow you to quote a list, but selectively evaluate elements of that list. In the simplest case, it is identical to the special form quote. (…) The special marker ‘,‘ inside of the argument to backquote indicates a value that isn’t constant. The Emacs Lisp evaluator evaluates the argument of ‘,‘, and puts the value in the list structure.

    So you can write your program as follows:

    (require 'org-publish)
    (setq org-publish-project-alist
          `(                              ; XXX: backquote
            ("org-notes"
             :base-directory ,org-dir     ; XXX: comma
             :base-extension "org"
             :publishing-directory "~/tmp/"
             :recursive t
             :publishing-function org-publish-org-to-html
             :headline-levels 4
             :auto-preamble t
    
             :auto-sitemap t          
             :sitemap-filename "sitemap.org" 
             :sitemap-title "Sitemap"
             )
            ("org-static"
             :base-directory ,org-dir     ; XXX: comma
             :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
             :publishing-directory "~/tmp/"
             :recursive t
             :publishing-function org-publish-attachment
             )
            ("org" :components ("org-notes" "org-static"))
            ))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the following code to copy a particular directory and its contents to
I Use following code for single file drag and drop. private void FormRegion2_DragEnter_1(object sender,
I use the following code to set an alarm. struct itimerval timer; struct sigaction
I use following code for guarantee startTime variable set once only: public class Processor
I use following code to open a file. When I was prompt to open/save
I use following code to select file but i can select one file only.
I use following code: Create a retry policy, when error, retry after 1 second,
I just use following code to add an image to my project, var paper
I use VS2010, C# to develop Silverlight 4 app, I use following code in
I have an array of objects, and i use following code to get in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.