I am using both mutt and emacs to write mail.
I use, until recent time, this code into my .emacs :
; corrector
(add-hook 'mail-mode-hook 'flyspell-mode)
; Do not cut words
(global-visual-line-mode t)
; open mail-mode when emacs is invoked by mutt
(add-to-list 'auto-mode-alist '("/mutt" . mail-mode))
; wrap email body
(add-hook 'mail-mode-hook 'turn-on-auto-fill)
(add-hook 'mail-mode-hook 'turn-on-filladapt-mode)
But it is not working anymore. When I write a email with emacs I have no flyspell enable and the mail-mode does not wrap the text.
When I try to launch the mail-mode manually, I have a error :
File mode specification error: (void-function turn-on-filladapt-mode)
Making completion list... [2 times]
run-hooks: Symbol's function definition is void: turn-on-filladapt-mode
The problem was caused by the missing package emacs-goodies.el (in debian sid) which include filladapt.
Related
I use the python3 pweave library (http://mpastell.com/pweave/usage.html) for literate programming.
pweave uses as text mode markdown, as code mode python3,
and it is possible to use noweb (https://en.wikipedia.org/wiki/Noweb) literate programming syntax.
For correct syntax highlighting in emacs I aimed to use the polymode library (https://polymode.github.io/ and https://github.com/polymode).
I use emacs version26.1.
And I was able to install polymode from melpa.
Unfortunate there is no pre-existing polymode for
host-mode: markdown, inner-mode: python3, syntax: noweb
so I tried, based on documentation and the existing code, to write my one
poly-pweave-mode, by putting the following lisp code into my .emacs file.
(require 'polymode-classes)
(defcustom pm-host/pweave-text
(pm-host-chunkmode :name "pweave-text"
:mode 'markdown-mode)
"markdown host chunkmode"
:group 'poly-hostmodes
:type 'object)
(defcustom pm-inner/pweave-code
(pm-inner-chunkmode :name "pweave-code"
:head-matcher "^[ \t]*<<\\(.*\\)>>="
:tail-matcher "^[ \t]*#.*$"
:mode 'python-mode)
"noweb static python3 inner chunkmode."
:group 'poly-innermodes
:type 'object)
(define-polymode poly-pweave-mode
:hostmode 'pm-host/pweave-text
:innermode 'pm-inner/pweave-code)
(add-to-list 'auto-mode-alist '("\\.pymd" . poly-pweave-mode))
But somehow emacs is not eating this.
When I open emacs I get the following error:
Warning (initialization): An error occurred while loading `/Users/abc/.emacs':
Symbol's function definition is void: pm-host-chunkmode
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
What do I wrong?
How I could get the desired polymode running?
This is the solution how to specify a markdown-python3-noweb polymode
;; define pwn polymode
(require 'poly-noweb)
(require 'poly-markdown)
(defcustom pm-inner/noweb-python
(clone pm-inner/noweb
:name "noweb-python"
:mode 'python-mode)
"Noweb for Python"
:group 'poly-innermodes
:type 'object)
(define-polymode poly-pweave-mode poly-markdown-mode
:innermodes '(pm-inner/noweb-python :inherit))
(add-to-list 'auto-mode-alist '("\\.pymd" . poly-pweave-mode))
My thank goes to Vitalie Spinu, the author of the polymode package, who helped me resolving this question!
For a detailed discussion have a look at polymode issue 180 at github.
Alternatively I found this post at emacs stack exchange: https://emacs.stackexchange.com/questions/20136/pythontex-and-auctex So, following this post, this is the solution to get to a markdown-python3-noweb mmm-mode
;; define pwn multi major modes mode
(require 'mmm-auto)
(mmm-add-classes
'((noweb-python
:submode python-mode
:face mmm-default-submode-face
:front "^<<.*>>=\n"
:back "^#$")))
(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class 'markdown-mode nil 'noweb-python)
(add-to-list 'auto-mode-alist '("\\.pymd" . markdown-mode))
My thank belongs to Jean Pierre, whose detailed explanation in the post made it a piece of cake to get it running for my case!
I'm trying to use the Edinburgh Concurrency Workbench (http://homepages.inf.ed.ac.uk/perdita/cwb/) with Emacs under Windows. I have placed the file cwb.el under C:\emacs\emacs-22.3\emacs-stuff. My .emacs file is located at C:\emacs and has the following content:
(setq load-path ; Look in my own library first.
(cons (expand-file-name "C:\emacs\emacs-22.3\emacsstuff")
load-path))
(autoload 'cwb "cwb" "Run a CWB process." t)
(autoload 'cwb-file-mode "cwb" "Major mode for editing CWB source." t)
(add-hook 'cwb-load-hook
(function
(lambda ()
(setq cwb-program-name "cwb7")))) ;; only necessary if your v7 isn't
;; called cwb
Yet, when I enter "M-x cwb", I get "Cannot open load file: cwb".
I tried to follow the instruction here: http://homepages.inf.ed.ac.uk/perdita/cwb/doc/emacs.html.
Thanks
In Emacs Lisp strings, backslash is an escape character, similar to C, so "C:\emacs\emacs-22.3\emacsstuff" ends up being "C:^[macs^[macs-22.3^[macsstuff". (You can try it with either M-: or M-x ielm.)
You can either write the path with forward slashes instead ("C:/emacs/emacs-22.3/emacsstuff") or use double backslashes ("C:\\emacs\\emacs-22.3\\emacsstuff").
I am running emacs 23.3.1 on ubuntu 12.04 with auctex 11.86. Whenever I go to compile a latex document (using C-c C-c), if there are no errors, everything compiles just fine. However, if there are any errors it will tell me to use C-` to view errors, if I do so, I get this error message
Use M-x make-directory RET RET to create the directory and its parents
and it goes away after a couple seconds. Then it takes me to another screen that explains the error in the latex code. However, now I cannot simply do C-x 1 to get back to the latex code. I have to C-x C-c and restart emacs.
This is my .emacs file
(setq backup-by-copying t
backup-directory-alist '(("." . "~/.emacsBkups"))
delete-old-versions t
kept-new-versions 5
kept-old-versions 2
version-control t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq TeX-PDF-mode t)
;;(require 'ess-site)
;;(ess-toggle-underscore nil)
(require 'whitespace)
(setq whitespace-style '(lines-tail face))
(add-hook 'c-mode-hook 'whitespace-mode)
(add-hook 'c++-mode-hook 'whitespace-mode)
(add-hook 'python-mode-hook 'whitespace-mode)
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
(c-set-offset (quote cpp-macro) 0 nil)
(setq TeX-view-program-list '(("Evince" "evince --page-index=%(outpage) %o")))
(setq TeX-view-program-selection '((output-pdf "Evince")))
Sometimes AUCTeX gets confused parsing the log of (La)TeX compilation and isn't able to guess the correct line raising the error. In some cases AUCTeX issues an obscure message "Error occured after last TeX file closed", when there are unbalanced parentheses, in your case it suggests you to create a new directory. To help AUCTeX finding the correct line raising the error you can add the -file-line-error option to latex or pdflatex by customizing the variable LaTeX-command-style. To do this add the following code to your .emacs:
(setq LaTeX-command-style '(("" "%(PDF)%(latex) -file-line-error %S%(PDFout)")))
See also the AUCTeX FAQ:
8. Why does TeX-next-error (C-c `) fail?
When writing the log file, TeX puts information related to a file,
including error messages, between a pair of parentheses. AUCTeX
determines the file where the error happened by parsing the log file
and counting the parentheses. This can fail when there are other,
unbalanced parentheses present.
As a workaround you can activate so-called file:line:error messages
for the log file. (Those are are easier to parse, but may lack some
details.) Either you do this in the configuration of your TeX system
(consult its manual to see where this is) or you add a command line
switch to the (la)tex call, e.g. by customizing LaTeX-command-style or
TeX-command-list.
I am trying to add the following code to my .emacs init file:
(TeX-add-symbols '("eqref" TeX-arg-ref))
But I cannot get it to work. I get the following error when running emacs t.tex (t.tex is here a sample text file) from the command line:
Warning (initialization): An error occurred while loading `.emacs':
Symbol's function definition is void: TeX-add-symbols
I am using GNU Emacs version 23.3.1 on Ubuntu 12.04. My .emacs init file looks like
(setq TeX-auto-parse t)
(setq TeX-electric-escape t)
(setq reftex-label-alist '((nil ?e nil "~\\eqref{%s}" nil nil)))
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(TeX-add-symbols '("eqref" TeX-arg-ref))
If I enter ESC-: (i.e. running the command eval-expression) and enter
(TeX-add-symbols '("eqref" TeX-arg-ref)) at the prompt it works fine. (That is after running this, I can enter \eqref in the buffer and it works as expected.. But this is not a good solution, having to enter this code manually each time I edit a file.. That is the reason why I try to set it up in the .emacs file..)
Background information for this question:
I have a problem with using the AucTeX style amsmath.el.. it seems that it is not loaded properly on my machine.. For more information, see Using \eqref with RefTeX.
You have to evaluate the code after LaTeX-mode is activated, otherwise you get the error Symbol's function definition is void: TeX-add-symbols. You can add that function to the hook of LaTeX-mode. In order to override possible other eqref macro definitions, you should add a dummy (ignore) to the definition of the macro. This code, in your .emacs, does the trick:
(add-hook 'LaTeX-mode-hook
'(lambda ()
(TeX-add-symbols '("eqref" TeX-arg-ref (ignore)))))
I have the following line in my emacs init file.
(setq auto-mode-alist (cons `("\*nrepl\*" . paredit-mode) auto-mode-alist))
I check that this works by creating a new buffer called *nrepl* Ctrl-x-f *nrepl*. Yes, the *nrepl* buffer has Paredit active, paredit-mode was enabled.
I close the *nrepl* buffer without saving it.
I start up a nrepl session by typing M-x nrepl-jack-in. The nrepl server starts up and I am presented with the nrepl repl. The nrepl repl is also called *nrepl*, however Paredit is not enabled.
What am I doing wrong?
You're confusing buffers and files: auto-mode-alist matches file names against regexps to decide which mode to use when editing those files. But *nrepl* is a buffer that does not contain a file, so auto-mode-alist has no effect for it.
Instead, you probably want to figure out which major-mode *nrepl* uses and then use (add-hook '<the-major-mode>-hook 'paredit-mode).
To put it simply - you need the following code:
(add-hook 'nrepl-mode-hook 'paredit-mode) ; for nrepl.el <= 0.1.8
(add-hook 'nrepl-repl-mode-hook 'paredit-mode) ; for nrepl.el > 0.1.8
Which is equivalent to the longer form:
(add-hook 'nrepl-mode-hook (lambda () (paredit-mode +1)))
(add-hook 'nrepl-mode-hook 'paredit-mode)
is what they suggest on the nrepl github page