Merge branch 'master' into feature-add-git-timemachine

This commit is contained in:
Henrik Lissner 2017-04-27 18:08:33 -04:00 committed by GitHub
commit 6efaf8987f
9 changed files with 204 additions and 68 deletions

View file

@ -31,19 +31,50 @@
(def-package! browse-at-remote
:commands (browse-at-remote browse-at-remote-get-url))
(def-package! git-timemachine
:commands (git-timemachine git-timemachine-toggle)
:config
(require 'magit-blame)
(add-hook! 'git-timemachine-mode-hook #'evil-force-normal-state)
;; Sometimes I forget `git-timemachine' is enabled in a buffer, so instead of
;; showing revision details in the minibuffer, show them in
;; `header-line-format', which is always visible.
(setq git-timemachine-show-minibuffer-details nil)
(defun +vcs|toggle-header-line ()
(if git-timemachine-mode
(+vcs*update-header-line)
(setq-local header-line-format nil)))
(defun +vcs*update-header-line (&rest _)
(when (and git-timemachine-mode git-timemachine-revision)
(let* ((revision git-timemachine-revision)
(date-relative (nth 3 revision))
(date-full (nth 4 revision))
(author (if git-timemachine-show-author (concat (nth 6 revision) ": ") ""))
(sha-or-subject (if (eq git-timemachine-minibuffer-detail 'commit) (car revision) (nth 5 revision))))
(setq-local
header-line-format
(format "%s%s [%s (%s)]"
(propertize author 'face 'git-timemachine-minibuffer-author-face)
(propertize sha-or-subject 'face 'git-timemachine-minibuffer-detail-face)
date-full date-relative)))))
(add-hook 'git-timemachine-mode-hook #'+vcs|toggle-header-line)
(advice-add #'git-timemachine-show-revision :after #'+vcs*update-header-line)
;; Force evil to rehash keybindings for the current state
(add-hook 'git-timemachine-mode-hook #'evil-force-normal-state)
(map! :map git-timemachine-mode-map
:nv "p" 'git-timemachine-show-previous-revision
:nv "n" 'git-timemachine-show-next-revision
:nv "g" 'git-timemachine-show-nth-revision
:nv "q" 'git-timemachine-quit
:nv "w" 'git-timemachine-kill-abbreviated-revision
:nv "W" 'git-timemachine-kill-revision
:nv "b" 'git-timemachine-blame))
:nv "p" #'git-timemachine-show-previous-revision
:nv "n" #'git-timemachine-show-next-revision
:nv "g" #'git-timemachine-show-nth-revision
:nv "q" #'git-timemachine-quit
:nv "w" #'git-timemachine-kill-abbreviated-revision
:nv "W" #'git-timemachine-kill-revision
:nv "b" #'git-timemachine-blame))
(def-package! magit
:commands magit-status

View file

@ -1,18 +0,0 @@
# Go
Go support, including auto-completion (gocode), eldoc support (go-eldoc), REPL
support (gore), refactoring commands (gorename), syntax-checking (flycheck),
auto-formatting (gofmt), and snippets (yasnippet).
Snippets can be found in `private/hlissner/snippets/go-mode`.
## External Dependencies
Run `make bootstrap go` to install these.
+ Go (`brew install go`, `pacman -S go`)
+ gocode `go get -u github.com/nsf/gocode` (completion)
+ gore `go get -u github.com/motemen/gore` (REPL)
+ guru `golang.org/x/tools/cmd/guru` (code navigation commands)
+ gorename `golang.org/x/tools/cmd/gorename` (refactoring commands)

View file

@ -0,0 +1,37 @@
* Go
Go support, including auto-completion, eldoc support (go-eldoc), REPL support,
refactoring commands, syntax-checking (flycheck), auto-formatting (gofmt) and
snippets (yasnippet).
+ [[https://golang.org][Homepage]]
+ [[../../modules/private/hlissner/snippets/go-mode][Snippets]]
+ [[../../modules/feature/file-templates/templates/go-mode][File templates]]
** Installation
*** MacOS
#+BEGIN_SRC sh :results output
brew install go
#+END_SRC
*** Arch Linux
#+BEGIN_SRC sh :dir /sudo:: :results output
pacman --needed --noconfirm -S go
#+END_SRC
** Dependencies
You'll need to set up ~GOPATH~. This is mine:
#+BEGIN_SRC sh
export GOPATH=~/.go
#+END_SRC
Then install the necessary packages:
#+BEGIN_SRC sh :results output
go get -u github.com/nsf/gocode # completion
go get -u github.com/motemen/gore # REPL
go get -u golang.org/x/tools/cmd/guru # code navigation commands
go get -u golang.org/x/tools/cmd/gorename # refactoring commands
#+END_SRC

View file

@ -17,7 +17,7 @@
(add-to-list 'recentf-exclude #'+org-is-agenda-file)
;;
(map! :map org-agenda-mode-amp
(map! :map org-agenda-mode-map
:e "<escape>" #'org-agenda-Quit
:e "m" #'org-agenda-month-view
:e "C-j" #'org-agenda-next-item

View file

@ -34,6 +34,14 @@
translate
)))
;; In a recent update, `org-babel-get-header' was removed from org-mode, which
;; is something a fair number of babel plugins use. So until those plugins update...
(defun org-babel-get-header (params key &optional others)
(delq nil
(mapcar
(lambda (p) (when (funcall (if others #'not #'identity) (eq (car p) key)) p))
params)))
;; I prefer C-c C-c for confirming over the default C-c '
(map! :map org-src-mode-map "C-c C-c" 'org-edit-src-exit)
;; I know the keybindings, no need for the header line

View file

@ -146,7 +146,9 @@ with `org-cycle'). Also removes babel result blocks, if run from a code block."
(cond ((org-at-heading-p)
(outline-toggle-children))
((org-at-item-p)
(org-cycle))))
(let ((window-beg (window-start)))
(org-cycle)
(set-window-start nil window-beg)))))
;;;###autoload
(defun +org/dwim-at-point ()

View file

@ -44,10 +44,11 @@
(defun +org|hook ()
"Run everytime `org-mode' is enabled."
(setq line-spacing 1)
(visual-line-mode +1)
(when (and (featurep 'evil) evil-mode)
(evil-org-mode +1))
(visual-line-mode +1)
(setq line-spacing 1)
(unless org-agenda-inhibit-startup
;; My version of the 'overview' #+STARTUP option: expand first-level
@ -106,11 +107,11 @@
outline-blank-line t
org-indent-mode-turns-on-hiding-stars t
org-adapt-indentation nil
org-blank-before-new-entry '((heading . nil) (plain-list-item . auto))
org-cycle-separator-lines 1
org-cycle-include-plain-lists t
org-ellipsis " ... "
org-entities-user '(("flat" "\\flat" nil "" "" "266D" "")
;; org-ellipsis " ... "
org-ellipsis ""
org-entities-user '(("flat" "\\flat" nil "" "" "266D" "")
("sharp" "\\sharp" nil "" "" "266F" ""))
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t
@ -119,6 +120,7 @@
org-hide-emphasis-markers nil
org-hide-leading-stars t
org-hide-leading-stars-before-indent-mode t
org-hidden-keywords nil
org-image-actual-width nil
org-indent-indentation-per-level 2
org-pretty-entities nil
@ -130,17 +132,14 @@
org-use-sub-superscripts '{}
;; Behavior
org-blank-before-new-entry '((heading . nil) (plain-list-item . auto))
org-catch-invisible-edits 'show
org-checkbox-hierarchical-statistics nil
org-enforce-todo-checkbox-dependencies t
org-completion-use-ido nil ; Use ivy/counsel for refiling
org-enforce-todo-checkbox-dependencies nil
org-confirm-elisp-link-function nil
org-default-priority ?C
org-hidden-keywords nil
org-hierarchical-todo-statistics t
org-log-done t
org-loop-over-headlines-in-active-region t
org-outline-path-complete-in-steps nil
org-refile-use-outline-path t
org-special-ctrl-a/e t
@ -148,7 +147,6 @@
org-archive-location (concat +org-dir "/archived/%s::")
org-refile-targets '((nil . (:maxlevel . 2))) ; display full path in refile completion
;; Latex
org-highlight-latex-and-related '(latex)
org-latex-create-formula-image-program 'dvipng
@ -173,6 +171,12 @@
'default)
:background nil t)))
;; Use ivy/helm if either is available
(when (or (featurep! :completion ivy)
(featurep! :completion helm))
(setq-default org-completion-use-ido nil
org-outline-path-complete-in-steps nil))
(let ((ext-regexp (regexp-opt '("GIF" "JPG" "JPEG" "SVG" "TIF" "TIFF" "BMP" "XPM"
"gif" "jpg" "jpeg" "svg" "tif" "tiff" "bmp" "xpm"))))
(setq iimage-mode-image-regex-alist
@ -180,25 +184,20 @@
ext-regexp "\\)\\(\\]\\]\\|>\\|'\\)?") . 2)
(,(concat "<\\(http://.+\\." ext-regexp "\\)>") . 1))))
;; Fontify checkboxes and dividers
(defface org-list-bullet
'((t (:inherit font-lock-keyword-face)))
"Face for list bullets"
:group 'doom)
;;; Custom fontification
;; I like how org-mode fontifies checked TODOs and want this to extend to
;; checked checkbox items, so we remove the old checkbox highlight rule...
(font-lock-remove-keywords
'org-mode
'(("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- X]\\]\\)"
1 'org-checkbox prepend)))
'org-mode '(("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- X]\\]\\)"
1 'org-checkbox prepend)))
(font-lock-add-keywords
'org-mode '(;; ...and replace it with my own
("^[ \t]*\\(\\(?:[-+]\\|[0-9]+[).]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[X\\][^\n]*\n\\)"
("^[ \t]*\\(?:[-+*]\\|[0-9]+[).]\\)[ \t]+\\(\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\(?:X\\|\\([0-9]+\\)/\\2\\)\\][^\n]*\n\\)"
1 'org-headline-done t)
("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- ]\\]\\)"
1 'org-checkbox prepend)
1 'org-checkbox append)
;; Also highlight list bullets
("^ *\\([-+]\\|[0-9]+[).]\\) " 1 'org-list-bullet append)
("^ *\\([-+]\\|[0-9]+[).]\\) " 1 'org-list-dt append)
;; and separators
("^ *\\(-----+\\)$" 1 'org-meta-line)))