problems publishing org files - emacs

I am following the directions given in a worg for publishing org files to HTML. This looks like the most vanilla org to HTML publication exercise. As suggested, I eval'ed the following block:
(require 'org-publish)
(setq org-publish-project-alist
'(
("org-notes"
:base-directory "~/www/"
:base-extension "org"
:publishing-directory "~/public_html/"
:recursive t
:publishing-function org-publish-org-to-html
:headline-levels 4 ; Just the default for this project.
:auto-preamble t
)
("org-static"
:base-directory "~/www/"
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
:publishing-directory "~/public_html/"
:recursive t
:publishing-function org-publish-attachment
)
("org" :components ("org-notes" "org-static"))
;; ... add all the components here (see below)...
))
But when I run M-x org-publish-project RET org RET, I get the following error:
Symbol's value as variable is void: org-export-html-special-string-regexps
Some Googling suggests that this could be due to multiple versions of org installed. I think this isn't the case with me. I have a fresh (1 day old) installation of GNU Emacs on Mac OS X and I subsequently updated to the most recent org-mode using M-x package-install.
Any advice?
edit 1: Here is the output for M-x org-version:
Org-mode version 8.2.5h (8.2.5h-19-g0ceb68-elpa # /Users/krishnan/.emacs.d/elpa/org-20140210/)
edit 2: Debug info added:
Debugger entered--Lisp error: (void-variable org-export-html-special-string-regexps)
org-export-html-convert-special-strings("Kaushik Krishnan")
org-html-do-expand("Kaushik Krishnan")
org-html-expand("Kaushik Krishnan")
org-export-as-html(4 (:buffer-will-be-killed t :base-directory "~/www/" :base-extension "org" :publishing-directory "~/public_html/" :recursive t :publishing-function org-publish-org-to-html :headline-levels 4 :auto-preamble t) nil nil "/Users/krishnan/public_html/")
org-publish-org-to("html" (:base-directory "~/www/" :base-extension "org" :publishing-directory "~/public_html/" :recursive t :publishing-function org-publish-org-to-html :headline-levels 4 :auto-preamble t) "/Users/krishnan/www/index.org" "/Users/krishnan/public_html/")
org-publish-org-to-html((:base-directory "~/www/" :base-extension "org" :publishing-directory "~/public_html/" :recursive t :publishing-function org-publish-org-to-html :headline-levels 4 :auto-preamble t) "/Users/krishnan/www/index.org" "/Users/krishnan/public_html/")
org-publish-file("/Users/krishnan/www/index.org" ("org-notes" :base-directory "~/www/" :base-extension "org" :publishing-directory "~/public_html/" :recursive t :publishing-function org-publish-org-to-html :headline-levels 4 :auto-preamble t) t)
#[(project) "\306#!\210A\307 \310\"\307 \311\"\307 \312\"\206\313\307 \314\"\206#\315\307 \316\"\206- \307 \317\"\2068!\"\307 \320\"\307 \321\"\322\n\"#\323$\203X\324\325!\210\203a
\f\"\210#\211A##\211$\203x\326$\327#\210\202a\307 \330\"\203\222\331\307 \332\"!\210\326\333\334\307 \332\"\"\327#\210\203\233\324\335!\210\336 .\207" [project project-plist exclude-regexp sitemap-p sitemap-filename sitemap-function org-publish-initialize-cache plist-get :exclude :auto-sitemap :sitemap-filename "sitemap.org" :sitemap-function org-publish-org-sitemap :sitemap-date-format :sitemap-file-entry-format :preparation-function :completion-function org-publish-get-base-files nil run-hooks preparation-function org-publish-file t :makeindex org-publish-index-generate-theindex :base-directory expand-file-name "theindex.org" completion-function org-publish-write-cache-file org-publish-sitemap-date-format org-sitemap-date-format org-publish-sitemap-file-entry-format org-sitemap-file-entry-format files file] 6](("org-notes" :base-directory "~/www/" :base-extension "org" :publishing-directory "~/public_html/" :recursive t :publishing-function org-publish-org-to-html :headline-levels 4 :auto-preamble t))
mapc(#[(project) "\306#!\210A\307 \310\"\307 \311\"\307 \312\"\206\313\307 \314\"\206#\315\307 \316\"\206- \307 \317\"\2068!\"\307 \320\"\307 \321\"\322\n\"#\323$\203X\324\325!\210\203a
\f\"\210#\211A##\211$\203x\326$\327#\210\202a\307 \330\"\203\222\331\307 \332\"!\210\326\333\334\307 \332\"\"\327#\210\203\233\324\335!\210\336 .\207" [project project-plist exclude-regexp sitemap-p sitemap-filename sitemap-function org-publish-initialize-cache plist-get :exclude :auto-sitemap :sitemap-filename "sitemap.org" :sitemap-function org-publish-org-sitemap :sitemap-date-format :sitemap-file-entry-format :preparation-function :completion-function org-publish-get-base-files nil run-hooks preparation-function org-publish-file t :makeindex org-publish-index-generate-theindex :base-directory expand-file-name "theindex.org" completion-function org-publish-write-cache-file org-publish-sitemap-date-format org-sitemap-date-format org-publish-sitemap-file-entry-format org-sitemap-file-entry-format files file] 6] (("org-notes" :base-directory "~/www/" :base-extension "org" :publishing-directory "~/public_html/" :recursive t :publishing-function org-publish-org-to-html :headline-levels 4 :auto-preamble t) ("org-static" :base-directory "~/www/" :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf" :publishing-directory "~/public_html/" :recursive t :publishing-function org-publish-attachment)))
org-publish-projects((("org" :components ("org-notes" "org-static"))))
org-publish-project(("org" :components ("org-notes" "org-static")) nil)
call-interactively(org-publish-project record nil)
command-execute(org-publish-project record)
execute-extended-command(nil "org-publish-project")
call-interactively(execute-extended-command nil nil)

From the comments: changing
:publishing-function org-publish-org-to-html
to
:publishing-function org-html-publish-to-html
solves the problem. org-publish-org-to-html is an obsolete name.

Related

Emacs (26.3) with ivy/counsel hangs on find-file

After setting up my emacs (26.3) with use-package and ivy/counsel, among other packages, emacs is sometimes hanging on C-x C-f. C-g does work to quit the process.
I ran debug-on-quit and this was the output:
Debugger entered--Lisp error: (quit)
ffap-file-at-point()
ffap-guesser()
ffap-guess-file-name-at-point()
run-hook-with-args-until-success(ffap-guess-file-name-at-point)
ivy-thing-at-point()
ivy--reset-state(#s(ivy-state :prompt "Find file: " :collection read-file-name-internal :predicate nil :require-match confirm-after-completion :initial-input nil :history file-name-history :preselect nil :keymap (keymap (remap keymap (undo . counsel-find-file-undo)) (96 lambda (&optional arg) "nil (`nil')" (interactive "p") (if (string= "" ivy-text) (execute-kbd-macro (kbd "M-o b")) (self-insert-command arg))) (C-backspace . counsel-up-directory) (67108991 . counsel-up-directory)) :update-fn nil :sort nil :frame #<frame F1 0xc90b00> :window #<window 1 on models.py> :buffer #<buffer models.py> :text nil :action (1 ("o" counsel-find-file-action "default") ("i" ivy--action-insert "insert") ("w" ivy--action-copy "copy") ("j" find-file-other-window "other window") ("f" find-file-other-frame "other frame") ("b" counsel-find-file-cd-bookmark-action "cd bookmark") ("x" counsel-find-file-extern "open externally") ("r" counsel-find-file-as-root "open as root") ("R" find-file-read-only "read only") ("l" find-file-literally "open literally") ("k" counsel-find-file-delete "delete") ("c" counsel-find-file-copy "copy file") ("m" counsel-find-file-move "move or rename") ("d" counsel-find-file-mkdir-action "mkdir")) :unwind nil :re-builder ivy--regex-plus :matcher counsel--find-file-matcher :dynamic-collection nil :display-transformer-fn ivy-read-file-transformer :directory "/home/alazar66/code/learning/html/qijc/app/" :caller counsel-find-file :current nil :def nil :ignore t :multi-action nil :extra-props nil))
ivy-read("Find file: " read-file-name-internal :matcher counsel--find-file-matcher :initial-input nil :action counsel-find-file-action :preselect nil :require-match confirm-after-completion :history file-name-history :keymap (keymap (remap keymap (undo . counsel-find-file-undo)) (96 lambda (&optional arg) "nil (`nil')" (interactive "p") (if (string= "" ivy-text) (execute-kbd-macro (kbd "M-o b")) (self-insert-command arg))) (C-backspace . counsel-up-directory) (67108991 . counsel-up-directory)) :caller counsel-find-file)
counsel--find-file-1("Find file: " nil counsel-find-file-action counsel-find-file)
counsel-find-file()
funcall-interactively(counsel-find-file)
call-interactively(counsel-find-file nil nil)
command-execute(counsel-find-file)
In case it's helpful, here's some of my .emacs:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(when (not (package-installed-p 'use-package))
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
(use-package projectile
:ensure t
:config
(projectile-mode))
(use-package which-key
:ensure t
:config
(which-key-mode))
(use-package transpose-frame
:ensure t)
(use-package counsel
:after ivy
:config (counsel-mode))
(use-package ivy
:defer 0.1
:diminish
:ensure t
:config (ivy-mode))
(use-package swiper
:after ivy
:bind (("C-s" . swiper)
("C-r" . swiper)))

Emacs keeps throwing "Internal Server Error" behind proxy

I spent a day debugging it but can't see what's wrong in my setup. I'm using Linux (Fedora 22) running Emacs 24.5.1, behind company proxy and have environment variables "http_proxy", "https_proxy", "ftp_proxy" all setup correctly. I also have "setq url-proxy-services ..." in my init.el.
I added MELPA as a repository using:
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
But emacs keeps throwing this stack trace on error (emacs --debug-init):
Debugger entered--Lisp error: (file-error "https://melpa.org/packages/async-20150909.2257.tar" "Internal server error")
signal(file-error ("https://melpa.org/packages/async-20150909.2257.tar" "Internal server error"))
url-insert-file-contents("https://melpa.org/packages/async-20150909.2257.tar")
package-install-from-archive([cl-struct-package-desc async (20150909 2257) "Asynchronous processing in Emacs" ((emacs (24)) (cl-lib (0 5))) tar "melpa" nil ((:url . "https://github.com/jwiegley/emacs-async")) nil])
mapc(package-install-from-archive ([cl-struct-package-desc async (20150909 2257) "Asynchronous processing in Emacs" ((emacs (24)) (cl-lib (0 5))) tar "melpa" nil ((:url . "https://github.com/jwiegley/emacs-async")) nil] [cl-struct-package-desc helm-core (20151024 2233) "Development files for Helm" ((emacs (24)) (cl-lib (0 5)) (async (1 5))) tar "melpa" nil ((:url . "https://emacs-helm.github.io/helm/")) nil] [cl-struct-package-desc helm (20151024 2233) "Helm is an Emacs incremental and narrowing framework" ((emacs (24)) (cl-lib (0 5)) (async (1 5)) (helm-core (1 8 0))) tar "melpa" nil ((:url . "https://emacs-helm.github.io/helm/")) nil]))
package-download-transaction(([cl-struct-package-desc async (20150909 2257) "Asynchronous processing in Emacs" ((emacs (24)) (cl-lib (0 5))) tar "melpa" nil ((:url . "https://github.com/jwiegley/emacs-async")) nil] [cl-struct-package-desc helm-core (20151024 2233) "Development files for Helm" ((emacs (24)) (cl-lib (0 5)) (async (1 5))) tar "melpa" nil ((:url . "https://emacs-helm.github.io/helm/")) nil] [cl-struct-package-desc helm (20151024 2233) "Helm is an Emacs incremental and narrowing framework" ((emacs (24)) (cl-lib (0 5)) (async (1 5)) (helm-core (1 8 0))) tar "melpa" nil ((:url . "https://emacs-helm.github.io/helm/")) nil]))
package-install(helm)
(progn (package-install p))
(if (not (package-installed-p p)) (progn (package-install p)))
(while --dolist-tail-- (setq p (car --dolist-tail--)) (if (not (package-installed-p p)) (progn (package-install p))) (setq --dolist-tail-- (cdr --dolist-tail--)))
(let ((--dolist-tail-- ngupta/packages) p) (while --dolist-tail-- (setq p (car --dolist-tail--)) (if (not (package-installed-p p)) (progn (package-install p))) (setq --dolist-tail-- (cdr --dolist-tail--))))
eval-buffer(#<buffer *load*> nil "/home/ngupta/.emacs.d/init.el" nil t) ; Reading at buffer position 1037
load-with-code-conversion("/home/ngupta/.emacs.d/init.el" "/home/ngupta/.emacs.d/init.el" t t)
load("/home/ngupta/.emacs.d/init" t t)
#[0 "\205\262
Here's my init.el for reference:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(setq url-using-proxy t)
(setq url-proxy-services
'(("no_proxy" . "^\\(localhost\\|10.*\\)")
("http" . "www-proxy.us.mycompany.com:80")
("https" . "www-proxy.us.mycompany.com:80")
("ftp" . "www-proxy.us.mycompany.com:80")))
You can have a try with these variables
(setq url-using-proxy t)
(setq url-proxy-services
'(("no_proxy" . "^\\(localhost\\|10.*\\)")
("http" . "proxy.address.company:port")
("https" . "proxy.address.company:port")
("ftp" . "proxy.address.company:port")))

Up Arrow Sometimes Moves Up Two Spaces in Emacs

I recently setup my dev environment on a new computer, and I'm having a very odd issue where pressing the up arrow sometimes moves my cursor up two spaces instead of one. I haven't been able to spot a pattern to when it happens, and it's really frustrating. Has anyone experienced anything similar? Here's my .emacs, in case it helps:
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(unless (require 'el-get nil t)
(url-retrieve
"https://raw.github.com/dimitri/el-get/master/el-get-install.el"
(lambda (s)
(end-of-buffer)
(eval-print-last-sexp))))
(delete-trailing-whitespace)
(add-to-list 'load-path "~/.emacs.d/vendor/")
(add-to-list 'load-path "~/.emacs.d/vendor/js2-mode")
(add-to-list 'load-path "~/.emacs.d/vendor/pig-mode")
(add-to-list 'load-path "~/.emacs.d/vendor/fill-column-indicator")
(autoload 'js2-mode "js2-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.pig$" . pig-mode))
(require 'whitespace)
(require 'pig-mode)
(require 'fill-column-indicator)
`(require 'color-theme-zenburn)`
`(color-theme-zenburn)`
(setq scroll-step 1
scroll-conservatively 10000)
(setq column-number-mode t)
(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
(el-get 'sync)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
(setq-default fill-column 80)
(add-hook 'after-change-major-mode-hook 'fci-mode)
;;Whitespace stuff
; make carriage returns blue and tabs green
(custom-set-faces
'(my-carriage-return-face ((((class color)) (:background "blue"))) t)
'(my-tab-face ((((class color)) (:background "green"))) t)
)
; add custom font locks to all buffers and all files
(add-hook
'font-lock-mode-hook
(function
(lambda ()
(setq
font-lock-keywords
(append
font-lock-keywords
'(
("\r" (0 'my-carriage-return-face t))
("\t" (0 'my-tab-face t))
))))))
; transform literal tabs into a right-pointing triangle
(setq
whitespace-display-mappings ;http://ergoemacs.org/emacs/whitespace-mode.html
'(
(tab-mark 9 [9654 9] [92 9])
;others substitutions...
))
Seems to be a known issue with fci-mode in combination with Emacs v24.3 (or with Emacs, depending on who you ask).

Emacs won't set indentation to 4 spaces in any language

I'm having trouble getting Emacs to behave and set Python (or any environment) to 4-space tabs. Below is my .emacs file, and I've tried all the options under ;; --- Set python indent to 4 spaces ---, and none of them have worked. Is it possible there is some conflict or override happening with the indents?
Also, no matter how many times I set the tab-stop-list variables to be multiples of 4, they always end up as multiples of 8 when I use "Customize Emacs" from the menu and set the variables in the .emacs file.
I'm using GNU emacs for Mac OS X (http://emacsformacosx.com/).
(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.
'(ansi-color-names-vector ["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
'(custom-enabled-themes (quote (deeper-blue)))
'(indent-tabs-mode nil)
'(inhibit-startup-screen t)
'(python-guess-indent nil)
'(python-honour-comment-indentation t)
'(python-use-skeletons t)
'(speedbar-indentation-width 2)
'(tab-stop-list (quote (4 8 12 16 20 24 28 32 36 40 44 48 52 56 60))))
(custom-set-faces
;; custom-set-faces 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.
'(default ((t (:inherit nil :stipple nil :background "#181a26" :foreground "gray80" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :family "consolas"))))
'(bold ((t (:foreground "white" :weight bold))))
'(variable-pitch ((t (:family "Helvetica Neue")))))
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(unless (require 'el-get nil 'noerror)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.github.com/dimitri/el-get/master/el-get-install.el")
(let (el-get-master-branch)
(goto-char (point-max))
(eval-print-last-sexp))))
(el-get 'sync)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
;; Yet another snippet extension for emacs -------------------------------------
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
;; Develop and keep personal snippets under ~/emacs.d/mysnippets
(setq yas/root-directory "~/.emacs.d/mysnippets")
;; Load the snippets
(yas-load-directory yas/root-directory)
;; Auto headers for files ---------------------------------------------------
(add-to-list 'load-path "~/.emacs.d/plugins/")
(require 'header2)
(add-hook 'emacs-lisp-mode-hook 'auto-make-header)
;; Invoke Emacs Speaks Statistics (ESS) for R
(require 'ess-site)
; automatically get the correct mode
auto-mode-alist (append (list '("\\.c$" . c-mode)
'("\\.tex$" . latex-mode)
'("\\.S$" . S-mode)
'("\\.s$" . S-mode)
'("\\.R$" . R-mode)
'("\\.r$" . R-mode)
'("\\.html$" . html-mode)
'("\\.emacs" . emacs-lisp-mode)
)
auto-mode-alist)
;; --- Automatically close all parens and quotes ---
(add-to-list 'load-path "~/.emacs.d/plugins/autopair")
(require 'autopair)
(autopair-global-mode) ;; enable autopair in all buffers
; Match Triple-quoting in python
(add-hook 'python-mode-hook
#'(lambda ()
(setq autopair-handle-action-fns
(list #'autopair-default-handle-action
#'autopair-python-triple-quote-action))))
;; --- Add autopairing of $ in latex ---
(add-hook 'latex-mode-hook
#'(lambda ()
(push '(?$ . ?$)
(getf autopair-extra-pairs :string))))
; Show column numbers
(setq column-number-mode t)
; --- Set python indent to 4 spaces ---
;; Set indent size to 4
(setq standard-indent 4)
(setq default-tab-width 4)
;; (add-hook 'python-mode-hook '(lambda ()
;; (setq python-indent 4)))
;; (setq-default py-indent-offset 4)
;; (setq indent-tabs-mode t
;; tab-width 4
;; python-indent 4)
;; Python Hook
;; (add-hook 'python-mode-hook
;; (function (lambda ()
;; (setq indent-tabs-mode nil
;; tab-width 4))))
;; --- Remove all tabs, convert them to spaces ---
(setq indent-tabs-mode nil)
;; --- Auto complete latex ---
From C-h v default-tab-width RET
This variable is obsolete since 23.2;
use `tab-width' instead.
and for tab-width
Documentation:
*Distance between tab stops (for display of tab characters), in columns.
You can customize this variable.
When I insert
(custom-set-variables
'(tab-width 4))
into ~/.emacs and restart emacs, it is set to 4.

How can I move php-mode settings from .emacs to .dir-locals.el?

Here is the content from my .emacs file.
(add-hook 'php-mode-hook
(lambda ()
(c-set-style "bsd")
(setq indent-tabs-mode t)
(setq c-basic-offset 4)
(setq tab-width 4)
(c-set-offset 'arglist-close 'c-lineup-arglist-operators)
(c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-cont-nonempty 'c-lineup-math)
(c-set-offset 'case-label '+)
))
I want to move these formatting settings to the project specific directory. Although I can do it easily for setq statements (e.g. (setq indent-tabs-mode t)), I am not able to do it for function calls like: (c-set-offset 'arglist-intro '+).
Here is what I have put into my .dir-locals.el:
;;; Directory Local Variables
;;; See Info node `(emacs) Directory Variables' for more information.
((php-mode
(c-set-style "bsd")
(indent-tabs-mode . t)
(c-basic-offset . 4)
(tab-width . 4)
(c-set-offset 'arglist-close 'c-lineup-arglist-operators)
(c-set-offset 'arglist-intro 'c-basic-offset)
(c-set-offset 'arglist-cont-nonempty 'c-lineup-math)
(c-set-offset 'case-label '+)
))
What is wrong here?
Directory local variables are just that -- variables; not elisp forms to be evaluated. Fortunately, that is provided for via the eval pseudo-variable:
((php-mode
(indent-tabs-mode . t)
(c-basic-offset . 4)
(tab-width . 4)
(eval . (progn
(c-set-style "bsd")
(c-set-offset 'arglist-close 'c-lineup-arglist-operators)
(c-set-offset 'arglist-intro 'c-basic-offset)
(c-set-offset 'arglist-cont-nonempty 'c-lineup-math)
(c-set-offset 'case-label '+)))))
Emacs will ask you to confirm that the code is safe when it encounters it, and will save it to the safe-local-variable-values list in the custom-set-variables sections of your init file if you wish.