Emacs

From StrelaWiki
Jump to navigation Jump to search

2020-05

Emacs + AUCTeX
  • Obidve moznosti zapisu su rovnocenne, druha moznost je viac "zjednotena".
zapis 1 zapis 2
(eval-after-load "tex"
  '(add-to-list 'TeX-command-list
                '("mucha-make" "make" TeX-run-TeX nil ; make call latexmk
                  (latex-mode)
                  :help "Run mucha-make")))
(eval-after-load "tex"
  '(add-to-list 'TeX-command-list
                '("mucha-make-clean" "make clean" TeX-run-command nil
                  (latex-mode)
                  :help "Run mucha-make-clean")))
(add-hook 'LaTeX-mode-hook
          (lambda () (setq TeX-command-default "mucha-make")))
(add-hook 'LaTeX-mode-hook
          (lambda ()
            (add-to-list 'TeX-command-list
                         '("mucha-make" "make" TeX-run-TeX nil ; make call latexmk
                           (latex-mode)
                           :help "Run mucha-make"))
            (add-to-list 'TeX-command-list
                         '("mucha-make-clean" "make clean" TeX-run-command nil
                           (latex-mode)
                           :help "Run mucha-make-clean"))
            (setq TeX-command-default "mucha-make")
            ))
  • AUCTeX nepredpoklada priamu moznost spoluprace s latexmk. Dane riesenie vsak nie je uplne na 100% korektne, avsak nie je chybne.
  • Problem spociva v tom, ze latexmk spusta proces kompilacie ako jeden prikaz (celok), ale od potrebnosti (cislovanie referencii, citacii, bibtex, ...) spusta LaTeX vo viacerych krokoch, run-och az do pozadovaneho finale. AUCTeX vsak tento output parse-uje ako celok (vysledok jedneho prikazu), a teda, na zaciatku output-u vidi (podobne ako latexmk) rozne LaTeX Warning, ktore suvisia s potrebnostou cislovania referencii, citacii. latexmk vsak spusti znova LaTeX v 2, 3, atd. kroku, run-e a to vsetko v ramci jedneho prikazu. Prave preto pouzivanie samotneho latexmk je take vyhodne. Ak by sme "naucili" AUCTeX parse-ovat od posledneho kroku, run-u prikazu latexmk, tak je vsetko bez problemov na 100% korektne. Tento problem je vsak len "chyba na krase". V praxi sa prejavi len pri prvom spusteni kompilacie, kedy AUCTeX "chybne predpoklada" (output parse-uje od zaciatku), ze v procese kompilacie sa vyskytol LaTeX Warning a referuje nam, ze je potrebne spustit kompilaciu este raz (latexmk to vsak uz vykonal v ramci jedneho prikazu v 2, 3, atd. kroku, run-e).
  • Najdene rozne riesenia [1], [2], [3], [4], [5] v skutocnosti nie su riesenia, ale skor obchadzanie problemu. Roznymi sposobmi v podstate oklamu AUCTeX error parser. Korektne riesenie (subjektivne, bez vchadzania do hlbky) by asi bolo spravne naucit AUCTeX parse-ovat output od posledneho run-u, kroku prikazu latexmk, a nie od jeho zaciatku. Normalne AUCTeX sam vola prikaz pre LaTeX, potom (podla potreby) vola bibtex, rozhoduje sa (prave na zaklade error parser), ci je potrebne znova volat prikaz LaTeX, t.j. tam je takato funkcionalita error parser vhodna, potrebna.
  • C-c C-l (bound M-x TeX-recenter-output-buffer) zobrazuje output, vysledok kompilacie. Ak potrebujeme zobrazovat jednotlive errors, warnings najprv prepnut M-x TeX-toggle-debug-warnings (bound C-c C-t C-w), znova prekompilovat a potom volat funkciu M-x TeX-error-overview. Zobrazia sa LaTeX Warnings, aj tie, ktore AUCTeX error praser ignoruje (typicky LaTeX Warning: `h' float specifier changed to `ht'). AUCTeX na GitHub-e, napr. ako funguje error parser pozerat tex-buf.el subor.
  • Pravdepodobne existuje riesenie auctex-latexmk. Tento balik robi presne to, co je tu vyssie spomenute, re-search-backward "^Run number [0-9]+ of rule output parse-uje od posledneho run-u, kroku prikazu latexmk.

Emacs

$ git clone --depth 1 git://git.savannah.gnu.org/emacs.git

$ git clone --depth=10 --branch=master git://git.savannah.gnu.org/emacs.git
$ git clone --depth 1 git://git.savannah.gnu.org/emacs.git
$ bzr branch bzr://bzr.savannah.gnu.org/emacs/trunk
emacs %F --geometry=80x67-0+0

~/.emacs

(set-default-font "DejaVu Sans Mono-10")

alebo ten isty efekt (vratane velkosti fontu) so suborom /usr/share/X11/app-defaults/Emacs

Emacs*Font: -unknown-DejaVu Sans Mono-normal-normal-normal-*-12-*-*-*-m-0-iso8859-1

aky konkretny font prave pouzivam zistim C-u C-x =

Emacs-ovaie

M-x => function
C-h v var RET => variable value
C-h f fun RET => function value
M-x set-variable RET var RET value RET => set variable value
M-x load-file RET ~/.emacs RET => reload .emacs file without restarting

nastavenie premenej (LISP):

(setq-default fill-column 75)
(setq line-number-mode nil)
(setq column-number-mode t)
(setq default-input-method "cyrillic-yawerty")
(setq flyspell-default-dictionary "ru-lebedev-io")

nastavenie premenej (v konkretnom subore):

-*- mode: name; var: value; ... -*-

-*- mode: C; coding: latin-1; -*-
-*- mode: Lisp; fill-column: 75; comment-column: 50; -*-
-*- coding: utf-8 -*-
-*- mode: LaTeX; coding: utf-8; -*-

M-x prefer-coding-system RET SPC

(prefer-coding-system 'utf-8)

M-x set-input-method RET SPC <=> C-\

(set-input-method 'cyrillic-yawerty)

M-x set-language-environment RET SPC

(set-language-environment 'Latin-1) 			 ;; Latin-1 nazov variable
(set-language-environment "Latin-1") 			 ;; konkretna hodnota
(set-language-environment 'UTF-8)

M-x set-default-font RET

(set-default-font "Bitstream Vera Sans Mono-8")
(set-default-font 'Bitstream Vera Sans Mono-8) 	 ;; nefunguje, neexistujuca variable

M-x flyspell-mode RET

(flyspell-mode t)


(load "/free2/mucha/other/root-help.el.new")
(add-to-list 'load-path (expand-file-name "/free2/mucha/other"))
(load "root-help.el.new") 		 ;; priamy load
(require 'root-help) 			 ;; alebo pomocou require

C-x b Select or create a buffer named buffer (switch-to-buffer)
M-x c-set-style Customizing C Indentation

M-x linum-mode LineNumbers
M-/ pripadne C-M-/ Dynamic Abbrev Expansion

Spelling

Pouzivanie spell checker(s) v Emacs-e

AUCTeX

$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/auctex co auctex
$ cd auctex
$ ./autogen.sh
$ ./configure
$ make
$ make install

BibTeX

.emacs

wget https://raw.github.com/gist/413006/.emacs -O ~/.emacs