This is my emacs configuration. Adapted from https://github.com/jamiecollinson/dotfiles
(setq user-full-name "Flávio L. C. de Moura")
(setq user-mail-address "[email protected]")
Did not work:
(bind-key “’ c” (lambda () (insert-char #o347)))
(global-set-key (kbd “<dead-acute> c”) (lambda () (interactive) (insert-string “ç”)))
(global-set-key (kbd “<dead-acute> c”) (lambda () (interactive) (insert-char #o347)))
It is working in lubuntu, but I didn’t find a solution to ubuntu.
(auto-fill-mode)
(use-package bbdb
:ensure t
:config
(setq bbdb-file "~/Dropbox/bbdb"))
(setq ispell-program-name "/usr/bin/aspell")
(setq ispell-dictionary "pt_BR")
(setq ispell-list-command "--list")
(add-hook 'org-mode-hook 'turn-on-flyspell)
(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
(autoload 'flyspell-delay-command "flyspell" "Delay on command." t)
(autoload 'tex-mode-flyspell-verify "flyspell" "" t)
(require ‘flycheck-grammarly) (setq grammarly-username “[email protected]”) (setq grammarly-password “De045kruvmej!”)
Trying scimax
As of Emacs 26.1 (C-h N : view-emacs-news shows the recent changes), the default-major-mode variable was removed. This variable occurs in 2 places in emacs/emacs-src/pvs-ilisp.el. Because of this, PVS displays the following error
error in process filter: Symbol’s value as variable is void: default-major-mode
To fix this error, add
(defvar default-major-mode nil)
Smooth scroll and keep cursor at same position when scrolling
(setq scroll-step 1)
(setq scroll-preserve-screen-position 1)
Increase and decrease font size
(global-set-key (kbd "M-=") 'text-scale-increase)
(global-set-key (kbd "M--") 'text-scale-decrease)
Don’t display the help screen on startup.
(setq inhibit-startup-screen t)
On I use ⌘ as meta
and prefer ⌥ to do nothing so I can still insert special characters like easily.
(setq mac-command-modifier 'meta
mac-option-modifier 'none)
I prefer lines to wrap.
(global-visual-line-mode 1)
Let’s turn off unwanted window decoration.
(tool-bar-mode -1)
(scroll-bar-mode -1)
I don’t want the error bell.
(setq ring-bell-function 'ignore)
When programming I like my editor to try to help me with keeping parentheses balanced.
Show parentheses matching
(show-paren-mode 1)
Highlight current line
(global-hl-line-mode 1)
(global-set-key (kbd "C-c h") 'global-hl-line-mode)
Expand parentheses for me.
(add-hook 'prog-mode-hook 'electric-pair-mode)
Magit is an awesome interface to git. Summon it with `C-x g`.
(use-package magit
:ensure t
:bind ("C-x g" . magit-status))
(setq magit-repository-directories '(("\~/workspace/" . 1)))
Display line changes in gutter based on git history. Enable it everywhere.
(use-package git-gutter
:ensure t
:config
(global-git-gutter-mode 't)
:diminish git-gutter-mode)
TimeMachine lets us step through the history of a file as recorded in git.
(use-package git-timemachine
:ensure t)
Open .v files with Proof General’s Coq mode
(use-package proof-general
:ensure t
:config
(eval-after-load "proof-script" '(progn
(define-key proof-mode-map [(C-down)]
'proof-assert-next-command-interactive)
(define-key proof-mode-map [(C-up)]
'proof-undo-last-successful-command))))
(setq pg-hide-all-proofs t)
Emacs has a great built in C/C++ mode, but we can improve on it with irony-mode
for code completion via libclang
.
(use-package irony
:ensure t
:hook (c-mode . irony-mode))
Add company mode support.
(use-package company-irony
:ensure t
:config
(add-to-list 'company-backends 'company-irony))
Add flycheck support.
(use-package flycheck-irony
:ensure t
:hook (flycheck-mode . flycheck-irony-setup))
(use-package ido
:ensure t
:config
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode t)
(setq ido-use-filename-at-point 'guess)
(setq ido-create-new-buffer 'always)
(setq ido-file-extensions-order '(".org" ".tex" ".pdf")))
(use-package ace-window
:ensure t
:init
(global-set-key [remap other-window] 'ace-window))
(with-eval-after-load 'ox-latex
(add-to-list 'org-latex-classes
'("entcs"
"\\documentclass[9pt]{entcs}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
(add-to-list 'org-latex-classes
'("myreport"
"\\documentclass[11pt]{report}"
;; ("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))))
(use-package tex
:ensure auctex
:config
(setq TeX-PDF-mode t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil))
(setenv "PATH" "/Library/TeX/texbin/:$PATH" t)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(setq TeX-view-program-selection '((output-pdf "PDF Viewer")))
(setq TeX-view-program-list
'(("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b")))
(custom-set-variables
'(TeX-source-correlate-method 'synctex)
'(TeX-source-correlate-mode t)
'(TeX-source-correlate-start-server t))
;; (require 'auctex-latexmk)
;; (auctex-latexmk-setup)
;; (setq auctex-latexmk-inherit-TeX-PDF-mode t)
;; (setq TeX-file-line-error nil)
(use-package bibtex
:ensure nil
:config
(progn
(setq bibtex-dialect 'biblatex
bibtex-align-at-equal-sign t
bibtex-text-indentation 20
bibtex-completion-bibliography '("~/Dropbox/org/zotLib.bib"))))
I should comment on these more… (setq org-agenda-files (directory-files-recursively “~/Dropbox” “\.org$”))
(setq org-html-htmlize-output-type 'css)
(setq org-latex-pdf-process
'("%latex --synctex=1 -interaction nonstopmode -output-directory %o %f"
"%bibtex %b"
"%latex --synctex=1 -interaction nonstopmode -output-directory %o %f"
"%latex --synctex=1 -interaction nonstopmode -output-directory %o %f"))
(setq org-file-apps '((auto-mode . emacs)
("\\.mm\\'" . default)
("\\.x?html?\\'" . system)
("\\.dvi\\'" . system)
("\\.pdf\\'" . default)))
(setq org-startup-indented 'f)
(setq org-deadline-warning-days 180)
(setq org-directory "~/workspace/org/")
(setq org-special-ctrl-a/e 't)
(setq org-default-notes-file (concat org-directory "notes.org"))
(setq org-src-fontify-natively 't)
(setq org-src-tab-acts-natively t)
(setq org-src-window-setup 'current-window)
(setq org-todo-keywords
'((type "TODO(t)" "PROGRESS(s@/!)" "WAITING(w@/!)" "READING(r)" "NEXT(n)" "|" "CANCELLED(c)" "DONE(d)" "READ(e)")))
(setq org-agenda-custom-commands
'(("o" "No trabalho" tags-todo "@unb"
((org-agenda-overriding-header "UnB")))
("h" "Em casa" tags-todo "@casa"
((org-agenda-overriding-header "Casa")))))
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c b") 'org-iswitchb)
(global-set-key (kbd "C-c l") 'org-store-link)
(setq org-html-postamble t)
(setq org-html-postamble-format
'(("en" "<p class=\"author\">Author: %a</p>
<p class=\"date\">Last modified: %C </p>
<p id=\"source-link\" class=\"source\"></p>")))
(setq org-publish-project-alist
'(("lc1"
:base-directory "~/workspace/LC1-github"
:base-extension "org"
:publishing-directory "~/workspace/flaviodemoura.github.io/"
:publishing-function org-html-publish-to-html
:headline-levels 3
:section-numbers nil
:with-toc nil
:html-head "<link rel="stylesheet" type="text/css" href="files/maarek.css"/>"
:html-preamble t)
("paa"
:base-directory "~/workspace/PAA-github"
:base-extension "org"
:publishing-directory "~/workspace/flaviodemoura.github.io/"
:publishing-function org-html-publish-to-html
:headline-levels 3
:section-numbers nil
:with-toc nil
:html-head "<link rel="stylesheet" type="text/css" href="files/maarek.css"/>"
:html-preamble t)
("images"
:base-directory "~/workspace/org/jpeg/"
:base-extension "jpg\\|gif\\|png"
:publishing-directory "~/workspace/flaviodemoura.github.io/files"
:publishing-function org-publish-attachment)
("ensino" :components ("lc1" "paa" ))))
(defun zp/org-find-time-file-property (property &optional anywhere)
"Return the position of the time file PROPERTY if it exists.
When ANYWHERE is non-nil, search beyond the preamble."
(save-excursion
(goto-char (point-min))
(let ((first-heading
(save-excursion
(re-search-forward org-outline-regexp-bol nil t))))
(when (re-search-forward (format "^#\\+%s:" property)
(if anywhere nil first-heading)
t)
(point)))))
(defun zp/org-has-time-file-property-p (property &optional anywhere)
"Return the position of time file PROPERTY if it is defined.
As a special case, return -1 if the time file PROPERTY exists but
is not defined."
(when-let ((pos (zp/org-find-time-file-property property anywhere)))
(save-excursion
(goto-char pos)
(if (and (looking-at-p " ")
(progn (forward-char)
(org-at-timestamp-p 'lax)))
pos
-1))))
(defun zp/org-set-time-file-property (property &optional anywhere pos)
"Set the time file PROPERTY in the preamble.
When ANYWHERE is non-nil, search beyond the preamble.
If the position of the file PROPERTY has already been computed,
it can be passed in POS."
(when-let ((pos (or pos
(zp/org-find-time-file-property property))))
(save-excursion
(goto-char pos)
(if (looking-at-p " ")
(forward-char)
(insert " "))
(delete-region (point) (line-end-position))
(let* ((now (format-time-string "[%Y-%m-%d %a %H:%M]")))
(insert now)))))
(defun zp/org-set-last-modified ()
"Update the LAST_MODIFIED file property in the preamble."
(when (derived-mode-p 'org-mode)
(zp/org-set-time-file-property "LAST_MODIFIED")))
(defun skx-org-mode-before-save-hook ()
(when (eq major-mode 'org-mode)
(zp/org-set-last-modified)))
(add-hook 'before-save-hook #'skx-org-mode-before-save-hook)
(defun org-get-agenda-files-recursively (dir)
"Get org agenda files from root DIR."
(directory-files-recursively dir "\.org$"))
(defun org-set-agenda-files-recursively (dir)
"Set org-agenda files from root DIR."
(setq org-agenda-files
(org-get-agenda-files-recursively dir)))
(defun org-add-agenda-files-recursively (dir)
"Add org-agenda files from root DIR."
(nconc org-agenda-files
(org-get-agenda-files-recursively dir)))
(setq org-agenda-files nil) ; zero out for testing
(org-set-agenda-files-recursively "~/workspace") ; test set
(org-add-agenda-files-recursively "~/pCloudDrive/orgroam") ; test add
(use-package orgit
:ensure t)
(use-package org-ref
:ensure t
:config
(setq reftex-default-bibliography '("~/Dropbox/org/zotLib.bib")
org-ref-default-bibliography '("~/Dropbox/org/zotLib.bib")
org-ref-bibliography-notes "~/Dropbox/org/notes.org"
org-ref-pdf-directory "~/Dropbox/pdfs/")
(setq bibtex-completion-bibliography "~/Dropbox/org/zotLib.bib"
bibtex-completion-library-path "~/Dropbox/pdfs"
bibtex-completion-notes-path "~/Dropbox/org/")
(setq bibtex-completion-pdf-open-function
(lambda (fpath)
(start-process "open" "*open*" "open" fpath))))
(require 'doi-utils)
(setq org-ref-latex-bib-resolve-func #'expand-file-name)
(use-package org-journal
:bind
("C-c n j" . org-journal-new-entry)
:ensure t
:defer t
:config
(setq org-journal-dir "~/Dropbox/org/journal")
(add-hook 'org-mode-hook 'turn-on-flyspell)
(setq org-agenda-file-regexp "\\`\\\([^.].*\\.org\\\|[0-9]\\\{8\\\}\\\(\\.gpg\\\)?\\\)\\'")
(add-to-list 'org-agenda-files org-journal-dir)
:custom
(org-journal-enable-agenda-integration t)
(org-journal-date-prefix "#+TITLE: ")
(org-journal-file-format "%Y-%m-%d.org")
(org-journal-date-format "%A, %d %B %Y"))
(setq org-clock-persist 'history)
(org-clock-persistence-insinuate)
(setq org-log-done 'time)