Split off emacs configs to dotemacs
This commit is contained in:
parent
cd174512ef
commit
94b05b65ef
30 changed files with 4 additions and 18949 deletions
1
.emacs.d
Submodule
1
.emacs.d
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 74ad04693c737618672b46b25436c20914ef8d62
|
5
.emacs.d/.gitignore
vendored
5
.emacs.d/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
|||
tramp
|
||||
elpa
|
||||
bookmarks
|
||||
abbrev_defs
|
||||
custom.el
|
File diff suppressed because it is too large
Load diff
|
@ -1,95 +0,0 @@
|
|||
;;; autosmiley.el --- Convert smileys into their graphical representation
|
||||
|
||||
;; Author: Damyan Pepper (gmail account, username damyanp)
|
||||
;; Created: 20060315
|
||||
|
||||
;; This program is free software; you can redistribute it and/or
|
||||
;; modify it under the terms of the GNU General Public License as
|
||||
;; published by the Free Software Foundation; either version 2, or (at
|
||||
;; your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful, but
|
||||
;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;; General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; if not, you can either send email to this
|
||||
;; program's maintainer or write to: The Free Software Foundation,
|
||||
;; Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Defines the minor mode autosmiley-mode that converts smileys like
|
||||
;; :-) into their graphical representations on the fly.
|
||||
|
||||
;; Tested on:
|
||||
;;
|
||||
;; GNU Emacs 22.0.50.1 (i386-mingw-nt5.1.2600) of 2006-03-14 on W2ONE
|
||||
;;
|
||||
;; History:
|
||||
;;
|
||||
;; 20060315 - First Release
|
||||
|
||||
|
||||
|
||||
(require 'smiley)
|
||||
|
||||
(defun autosmiley-overlay-p (overlay)
|
||||
"Return whether OVERLAY is an overlay of autosmiley mode."
|
||||
(memq (overlay-get overlay 'category)
|
||||
'(autosmiley)))
|
||||
|
||||
(defun autosmiley-remove-smileys (beg end)
|
||||
(dolist (o (overlays-in beg end))
|
||||
(when (autosmiley-overlay-p o)
|
||||
(delete-overlay o))))
|
||||
|
||||
(defvar *autosmiley-counter* 0
|
||||
"Each smiley needs to have a unique display string otherwise
|
||||
adjacent smileys will be merged into a single image. So we put
|
||||
a counter on each one to make them unique")
|
||||
|
||||
(defun autosmiley-add-smiley (beg end image)
|
||||
(let ((overlay (make-overlay beg end)))
|
||||
(overlay-put overlay 'category 'autosmiley)
|
||||
(overlay-put overlay 'display (append image (list :counter (incf *autosmiley-counter*))))))
|
||||
|
||||
|
||||
(defun autosmiley-add-smileys (beg end)
|
||||
(save-excursion
|
||||
(dolist (entry smiley-cached-regexp-alist)
|
||||
(let ((regexp (car entry))
|
||||
(group (nth 1 entry))
|
||||
(image (nth 2 entry)))
|
||||
(when image
|
||||
(goto-char beg)
|
||||
(while (re-search-forward regexp end t)
|
||||
(autosmiley-add-smiley (match-beginning group) (match-end group) image)))))))
|
||||
|
||||
|
||||
(defun autosmiley-change (beg end &optional old-len)
|
||||
(let ((beg-line (save-excursion (goto-char beg) (line-beginning-position)))
|
||||
(end-line (save-excursion (goto-char end) (line-end-position))))
|
||||
(autosmiley-remove-smileys beg-line end-line)
|
||||
(autosmiley-add-smileys beg-line end-line)))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode autosmiley-mode
|
||||
"Minor mode for automatically replacing smileys in text with
|
||||
cute little graphical smileys."
|
||||
:group 'autosmiley :lighter " :)"
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(autosmiley-remove-smileys (point-min) (point-max))
|
||||
(if autosmiley-mode
|
||||
(progn
|
||||
(unless smiley-cached-regexp-alist
|
||||
(smiley-update-cache))
|
||||
(jit-lock-register 'autosmiley-change))
|
||||
(jit-lock-unregister 'autosmiley-change)))))
|
||||
|
||||
|
||||
(provide 'autosmiley)
|
|
@ -1,156 +0,0 @@
|
|||
;;; batch-mode.el --- major mode for editing ESRI batch scrips
|
||||
;;; Copyright (C) 2002, Agnar Renolen <agnar.renolen@emap.no>
|
||||
;;; Modified (c) 2009, Matthew Fidler <matthew.fidler at gmail.com>
|
||||
;;; Fixed indents (and labels)
|
||||
|
||||
;; batch-mode.el is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; if not, write to the Free Software
|
||||
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
;; This is version 1.0 of 21 August 2002.
|
||||
|
||||
;;; Comentary:
|
||||
|
||||
;; The batch-mode provides syntax hilighting and auto-indentation for
|
||||
;; DOS batch files (.bat). and auto-idendation.
|
||||
|
||||
;; Agnar Renolen, <agnar.renolen@emap.no>
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defgroup batch nil
|
||||
"Major mode for editing batch code"
|
||||
:prefix "batch-"
|
||||
:group 'languages)
|
||||
|
||||
; (defvar batch-mode-hook nil
|
||||
; "Hooks called when batch mode fires up."
|
||||
; :type 'hook
|
||||
; :group 'batch)
|
||||
|
||||
(defvar batch-mode-map nil
|
||||
"Keymap used with batch code")
|
||||
|
||||
(defcustom batch-indent-level 4
|
||||
"Amount by which batch subexpressions are indented."
|
||||
:type 'integer
|
||||
:group 'batch)
|
||||
|
||||
(defvar batch-font-lock-keywords
|
||||
(eval-when-compile
|
||||
(list
|
||||
; since we can't specify batch comments through the syntax table,
|
||||
; we have to specify it here, and override whatever is highlighted
|
||||
'( "^[ \t]*rem\\>.*" (0 font-lock-comment-face t))
|
||||
|
||||
; since the argument to the echo command is a string, we format it
|
||||
; as a string
|
||||
'( "\\<echo\\>[ \t]*\\(.*\\)" (1 font-lock-string-face t))
|
||||
|
||||
; the argument of the goto statement is a label
|
||||
'( "\\<goto\\>[ \t]*\\([a-zA-Z0-9_]+\\)" (1
|
||||
font-lock-constant-face))
|
||||
|
||||
; the keywords of batch (which are not built-in commands)
|
||||
(concat "\\<\\(cmdextversion\\|"
|
||||
"d\\(efined\\|isableextensions\\|o\\)\\|"
|
||||
"e\\(lse\\|n\\(ableextensions\\|dlocal\\)"
|
||||
"\\|qu\\|rrorlevel\\|xist\\)\\|for\\|"
|
||||
"goto\\|i[fn]\\|n\\(eq\\|ot\\)\\|setlocal\\)\\>")
|
||||
|
||||
; built-in DOS commands
|
||||
(cons (concat "\\<\\(a\\(ssoc\\|t\\(\\|trib\\)\\)\\|break\\|"
|
||||
"c\\(a\\(cls\\|ll\\)\\|d\\|h\\(cp\\|dir\\|k\\("
|
||||
"dsk\\|ntfs\\)\\)\\|ls\\|md\\|o\\(lor\\|mp\\(\\|act\\)"
|
||||
"\\|nvert\\|py\\)\\)\\|d\\(ate\\|el\\|i\\("
|
||||
"r\\|skco\\(mp\\|py\\)\\)\\|oskey\\)\\|"
|
||||
"e\\(cho\\|rase\\|xit\\)\\|"
|
||||
"f\\(c\\|ind\\(\\|str\\)\\|for\\(\\|mot\\)\\|type\\)\\|"
|
||||
"graftabl\\|help\\|label\\|"
|
||||
"m\\(d\\|mkdir\\|o[dvr]e\\)\\|p\\(a\\(th\\|use\\)"
|
||||
"\\|opd\\|r\\(int\\|opmt\\)\\|ushd\\)\\|"
|
||||
"r\\(d\\|e\\(cover\\|n\\(\\|ame\\)\\|place\\)\\|mdir\\)\\|"
|
||||
"s\\(et\\|hift\\|ort\\|tart\\|ubst\\)\\|"
|
||||
"t\\(i\\(me\\|tle\\)\\|ree\\|ype\\)\\|"
|
||||
"v\\(er\\(\\|ify\\)\\|ol\\)\\|xcopy\\)\\>")
|
||||
'font-lock-builtin-face)
|
||||
|
||||
; variables are embeded in percent chars
|
||||
'( "%[a-zA-Z0-9_]+%?" . font-lock-variable-name-face)
|
||||
; labels are formatted as constants
|
||||
'( ":[a-zA-Z0-9_]+" . font-lock-constant-face)
|
||||
|
||||
; command line switches are hilighted as type-face
|
||||
'( "[-/][a-zA-Z0-9_]+" . font-lock-type-face)
|
||||
|
||||
; variables set should also be hilighted with variable-name-face
|
||||
'( "\\<set\\>[ \t]*\\([a-zA-Z0-9_]+\\)" (1 font-lock-variable-name-face))
|
||||
)))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun batch-mode ()
|
||||
"Major mode for editing batch scripts."
|
||||
(interactive)
|
||||
(kill-all-local-variables)
|
||||
(setq major-mode 'batch-mode)
|
||||
(setq mode-name "Avenue")
|
||||
(set (make-local-variable 'indent-line-function) 'batch-indent-line)
|
||||
(set (make-local-variable 'comment-start) "rem")
|
||||
(set (make-local-variable 'comment-start-skip) "rem[ \t]*")
|
||||
(set (make-local-variable 'font-lock-defaults)
|
||||
'(batch-font-lock-keywords nil t nil))
|
||||
(run-hooks 'batch-mode-hook))
|
||||
|
||||
(defun batch-indent-line ()
|
||||
"Indent current line as batch script"
|
||||
(let ((indent (batch-calculate-indent))
|
||||
beg shift-amt
|
||||
(old-pos (- (point-max) (point))))
|
||||
(beginning-of-line)
|
||||
(setq beg (point))
|
||||
(skip-chars-forward " \t")
|
||||
(if (looking-at ")")
|
||||
(setq indent (max (- indent batch-indent-level))))
|
||||
(message "prev indent: %d" indent)
|
||||
(setq shift-amt (- indent (current-column)))
|
||||
(if (not (zerop shift-amt))
|
||||
(progn
|
||||
(delete-region beg (point))
|
||||
; ArcView replaces tabs with single spaces, so we only insert
|
||||
; spaces to make indentation correct in ArcView.
|
||||
(insert-char ? indent)
|
||||
(if (> (- (point-max) old-pos) (point))
|
||||
(goto-char (- (point-max) old-pos)))))
|
||||
shift-amt))
|
||||
|
||||
(defun batch-calculate-indent ()
|
||||
"Return appropriate indentation for the current line as batch code."
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(current-indentation)
|
||||
(if (bobp)
|
||||
0
|
||||
(if (re-search-backward "^[ \t]*[^ \t\n\r]" nil t)
|
||||
(if (looking-at "[ \t]*\\()[ \t]*else\\|for\\|if\\)\\>[^(\n]*([^)\n]*")
|
||||
(+ (current-indentation) batch-indent-level)
|
||||
(if (looking-at "[ \t]*[^(]*)[ \t]*")
|
||||
(- (current-indentation) batch-indent-level)
|
||||
(current-indentation)))
|
||||
0))))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.bat\\'" . batch-mode))
|
||||
|
||||
(provide 'batch-mode)
|
||||
|
||||
;;; batch-mode.el ends here
|
|
@ -1,339 +0,0 @@
|
|||
;=============================================================================
|
||||
; CMake - Cross Platform Makefile Generator
|
||||
; Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
||||
;
|
||||
; Distributed under the OSI-approved BSD License (the "License");
|
||||
; see accompanying file Copyright.txt for details.
|
||||
;
|
||||
; This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
; See the License for more information.
|
||||
;=============================================================================
|
||||
;;; cmake-mode.el --- major-mode for editing CMake sources
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Provides syntax highlighting and indentation for CMakeLists.txt and
|
||||
;; *.cmake source files.
|
||||
;;
|
||||
;; Add this code to your .emacs file to use the mode:
|
||||
;;
|
||||
;; (setq load-path (cons (expand-file-name "/dir/with/cmake-mode") load-path))
|
||||
;; (require 'cmake-mode)
|
||||
;; (setq auto-mode-alist
|
||||
;; (append '(("CMakeLists\\.txt\\'" . cmake-mode)
|
||||
;; ("\\.cmake\\'" . cmake-mode))
|
||||
;; auto-mode-alist))
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;;; Code:
|
||||
;;
|
||||
;; cmake executable variable used to run cmake --help-command
|
||||
;; on commands in cmake-mode
|
||||
;;
|
||||
;; cmake-command-help Written by James Bigler
|
||||
;;
|
||||
|
||||
(defcustom cmake-mode-cmake-executable "cmake"
|
||||
"*The name of the cmake executable.
|
||||
|
||||
This can be either absolute or looked up in $PATH. You can also
|
||||
set the path with these commands:
|
||||
(setenv \"PATH\" (concat (getenv \"PATH\") \";C:\\\\Program Files\\\\CMake 2.8\\\\bin\"))
|
||||
(setenv \"PATH\" (concat (getenv \"PATH\") \":/usr/local/cmake/bin\"))"
|
||||
:type 'file
|
||||
:group 'cmake)
|
||||
;;
|
||||
;; Regular expressions used by line indentation function.
|
||||
;;
|
||||
(defconst cmake-regex-blank "^[ \t]*$")
|
||||
(defconst cmake-regex-comment "#.*")
|
||||
(defconst cmake-regex-paren-left "(")
|
||||
(defconst cmake-regex-paren-right ")")
|
||||
(defconst cmake-regex-argument-quoted
|
||||
"\"\\([^\"\\\\]\\|\\\\\\(.\\|\n\\)\\)*\"")
|
||||
(defconst cmake-regex-argument-unquoted
|
||||
"\\([^ \t\r\n()#\"\\\\]\\|\\\\.\\)\\([^ \t\r\n()#\\\\]\\|\\\\.\\)*")
|
||||
(defconst cmake-regex-token (concat "\\(" cmake-regex-comment
|
||||
"\\|" cmake-regex-paren-left
|
||||
"\\|" cmake-regex-paren-right
|
||||
"\\|" cmake-regex-argument-unquoted
|
||||
"\\|" cmake-regex-argument-quoted
|
||||
"\\)"))
|
||||
(defconst cmake-regex-indented (concat "^\\("
|
||||
cmake-regex-token
|
||||
"\\|" "[ \t\r\n]"
|
||||
"\\)*"))
|
||||
(defconst cmake-regex-block-open
|
||||
"^\\(IF\\|MACRO\\|FOREACH\\|ELSE\\|ELSEIF\\|WHILE\\|FUNCTION\\)$")
|
||||
(defconst cmake-regex-block-close
|
||||
"^[ \t]*\\(ENDIF\\|ENDFOREACH\\|ENDMACRO\\|ELSE\\|ELSEIF\\|ENDWHILE\\|ENDFUNCTION\\)[ \t]*(")
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;;
|
||||
;; Helper functions for line indentation function.
|
||||
;;
|
||||
(defun cmake-line-starts-inside-string ()
|
||||
"Determine whether the beginning of the current line is in a string."
|
||||
(if (save-excursion
|
||||
(beginning-of-line)
|
||||
(let ((parse-end (point)))
|
||||
(beginning-of-buffer)
|
||||
(nth 3 (parse-partial-sexp (point) parse-end))
|
||||
)
|
||||
)
|
||||
t
|
||||
nil
|
||||
)
|
||||
)
|
||||
|
||||
(defun cmake-find-last-indented-line ()
|
||||
"Move to the beginning of the last line that has meaningful indentation."
|
||||
(let ((point-start (point))
|
||||
region)
|
||||
(forward-line -1)
|
||||
(setq region (buffer-substring-no-properties (point) point-start))
|
||||
(while (and (not (bobp))
|
||||
(or (looking-at cmake-regex-blank)
|
||||
(not (and (string-match cmake-regex-indented region)
|
||||
(= (length region) (match-end 0))))))
|
||||
(forward-line -1)
|
||||
(setq region (buffer-substring-no-properties (point) point-start))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;;
|
||||
;; Line indentation function.
|
||||
;;
|
||||
(defun cmake-indent ()
|
||||
"Indent current line as CMAKE code."
|
||||
(interactive)
|
||||
(if (cmake-line-starts-inside-string)
|
||||
()
|
||||
(if (bobp)
|
||||
(cmake-indent-line-to 0)
|
||||
(let (cur-indent)
|
||||
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
|
||||
(let ((point-start (point))
|
||||
token)
|
||||
|
||||
; Search back for the last indented line.
|
||||
(cmake-find-last-indented-line)
|
||||
|
||||
; Start with the indentation on this line.
|
||||
(setq cur-indent (current-indentation))
|
||||
|
||||
; Search forward counting tokens that adjust indentation.
|
||||
(while (re-search-forward cmake-regex-token point-start t)
|
||||
(setq token (match-string 0))
|
||||
(if (string-match (concat "^" cmake-regex-paren-left "$") token)
|
||||
(setq cur-indent (+ cur-indent cmake-tab-width))
|
||||
)
|
||||
(if (string-match (concat "^" cmake-regex-paren-right "$") token)
|
||||
(setq cur-indent (- cur-indent cmake-tab-width))
|
||||
)
|
||||
(if (and
|
||||
(string-match cmake-regex-block-open token)
|
||||
(looking-at (concat "[ \t]*" cmake-regex-paren-left))
|
||||
)
|
||||
(setq cur-indent (+ cur-indent cmake-tab-width))
|
||||
)
|
||||
)
|
||||
(goto-char point-start)
|
||||
|
||||
; If this is the end of a block, decrease indentation.
|
||||
(if (looking-at cmake-regex-block-close)
|
||||
(setq cur-indent (- cur-indent cmake-tab-width))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
; Indent this line by the amount selected.
|
||||
(if (< cur-indent 0)
|
||||
(cmake-indent-line-to 0)
|
||||
(cmake-indent-line-to cur-indent)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun cmake-point-in-indendation ()
|
||||
(string-match "^[ \\t]*$" (buffer-substring (point-at-bol) (point))))
|
||||
|
||||
(defun cmake-indent-line-to (column)
|
||||
"Indent the current line to COLUMN.
|
||||
If point is within the existing indentation it is moved to the end of
|
||||
the indentation. Otherwise it retains the same position on the line"
|
||||
(if (cmake-point-in-indendation)
|
||||
(indent-line-to column)
|
||||
(save-excursion (indent-line-to column))))
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;;
|
||||
;; Helper functions for buffer
|
||||
;;
|
||||
(defun unscreamify-cmake-buffer ()
|
||||
"Convert all CMake commands to lowercase in buffer."
|
||||
(interactive)
|
||||
(setq save-point (point))
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "^\\([ \t]*\\)\\(\\w+\\)\\([ \t]*(\\)" nil t)
|
||||
(replace-match
|
||||
(concat
|
||||
(match-string 1)
|
||||
(downcase (match-string 2))
|
||||
(match-string 3))
|
||||
t))
|
||||
(goto-char save-point)
|
||||
)
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;;
|
||||
;; Keyword highlighting regex-to-face map.
|
||||
;;
|
||||
(defconst cmake-font-lock-keywords
|
||||
(list '("^[ \t]*\\(\\w+\\)[ \t]*(" 1 font-lock-function-name-face))
|
||||
"Highlighting expressions for CMAKE mode."
|
||||
)
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;;
|
||||
;; Syntax table for this mode. Initialize to nil so that it is
|
||||
;; regenerated when the cmake-mode function is called.
|
||||
;;
|
||||
(defvar cmake-mode-syntax-table nil "Syntax table for cmake-mode.")
|
||||
(setq cmake-mode-syntax-table nil)
|
||||
|
||||
;;
|
||||
;; User hook entry point.
|
||||
;;
|
||||
(defvar cmake-mode-hook nil)
|
||||
|
||||
;;
|
||||
;; Indentation increment.
|
||||
;;
|
||||
(defvar cmake-tab-width 2)
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;;
|
||||
;; CMake mode startup function.
|
||||
;;
|
||||
(defun cmake-mode ()
|
||||
"Major mode for editing CMake listfiles."
|
||||
(interactive)
|
||||
(kill-all-local-variables)
|
||||
(setq major-mode 'cmake-mode)
|
||||
(setq mode-name "CMAKE")
|
||||
|
||||
; Create the syntax table
|
||||
(setq cmake-mode-syntax-table (make-syntax-table))
|
||||
(set-syntax-table cmake-mode-syntax-table)
|
||||
(modify-syntax-entry ?_ "w" cmake-mode-syntax-table)
|
||||
(modify-syntax-entry ?\( "()" cmake-mode-syntax-table)
|
||||
(modify-syntax-entry ?\) ")(" cmake-mode-syntax-table)
|
||||
(modify-syntax-entry ?# "<" cmake-mode-syntax-table)
|
||||
(modify-syntax-entry ?\n ">" cmake-mode-syntax-table)
|
||||
|
||||
; Setup font-lock mode.
|
||||
(make-local-variable 'font-lock-defaults)
|
||||
(setq font-lock-defaults '(cmake-font-lock-keywords))
|
||||
|
||||
; Setup indentation function.
|
||||
(make-local-variable 'indent-line-function)
|
||||
(setq indent-line-function 'cmake-indent)
|
||||
|
||||
; Setup comment syntax.
|
||||
(make-local-variable 'comment-start)
|
||||
(setq comment-start "#")
|
||||
|
||||
; Run user hooks.
|
||||
(run-hooks 'cmake-mode-hook))
|
||||
|
||||
; Help mode starts here
|
||||
|
||||
|
||||
(defun cmake-command-run (type &optional topic)
|
||||
"Runs the command cmake with the arguments specified. The
|
||||
optional argument topic will be appended to the argument list."
|
||||
(interactive "s")
|
||||
(let* ((bufname (concat "*CMake" type (if topic "-") topic "*"))
|
||||
(buffer (get-buffer bufname))
|
||||
)
|
||||
(if buffer
|
||||
(display-buffer buffer 'not-this-window)
|
||||
;; Buffer doesn't exist. Create it and fill it
|
||||
(setq buffer (generate-new-buffer bufname))
|
||||
(setq command (concat cmake-mode-cmake-executable " " type " " topic))
|
||||
(message "Running %s" command)
|
||||
;; We don't want the contents of the shell-command running to the
|
||||
;; minibuffer, so turn it off. A value of nil means don't automatically
|
||||
;; resize mini-windows.
|
||||
(setq resize-mini-windows-save resize-mini-windows)
|
||||
(setq resize-mini-windows nil)
|
||||
(shell-command command buffer)
|
||||
;; Save the original window, so that we can come back to it later.
|
||||
;; save-excursion doesn't seem to work for this.
|
||||
(setq window (selected-window))
|
||||
;; We need to select it so that we can apply special modes to it
|
||||
(select-window (display-buffer buffer 'not-this-window))
|
||||
(cmake-mode)
|
||||
(toggle-read-only t)
|
||||
;; Restore the original window
|
||||
(select-window window)
|
||||
(setq resize-mini-windows resize-mini-windows-save)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun cmake-help-list-commands ()
|
||||
"Prints out a list of the cmake commands."
|
||||
(interactive)
|
||||
(cmake-command-run "--help-command-list")
|
||||
)
|
||||
|
||||
(defvar cmake-help-command-history nil "Topic read history.")
|
||||
|
||||
(require 'thingatpt)
|
||||
(defun cmake-get-topic (type)
|
||||
"Gets the topic from the minibuffer input. The default is the word the cursor is on."
|
||||
(interactive)
|
||||
(let* ((default-entry (word-at-point))
|
||||
(input (read-string
|
||||
(format "CMake %s (default %s): " type default-entry) ; prompt
|
||||
nil ; initial input
|
||||
'cmake-help-command-history ; command history
|
||||
default-entry ; default-value
|
||||
)))
|
||||
(if (string= input "")
|
||||
(error "No argument given")
|
||||
input))
|
||||
)
|
||||
|
||||
|
||||
(defun cmake-help-command ()
|
||||
"Prints out the help message corresponding to the command the cursor is on."
|
||||
(interactive)
|
||||
(setq command (cmake-get-topic "command"))
|
||||
(cmake-command-run "--help-command" (downcase command))
|
||||
)
|
||||
|
||||
|
||||
; This file provides cmake-mode.
|
||||
(provide 'cmake-mode)
|
||||
|
||||
;;; cmake-mode.el ends here
|
|
@ -1,259 +0,0 @@
|
|||
;;; column-marker.el --- Highlight certain character columns
|
||||
;;
|
||||
;; Filename: column-marker.el
|
||||
;; Description: Highlight certain character columns
|
||||
;; Author: Rick Bielawski <rbielaws@i1.net>
|
||||
;; Maintainer: Rick Bielawski <rbielaws@i1.net>
|
||||
;; Created: Tue Nov 22 10:26:03 2005
|
||||
;; Version:
|
||||
;; Last-Updated: Fri Jan 22 11:28:48 2010 (-0800)
|
||||
;; By: dradams
|
||||
;; Update #: 312
|
||||
;; Keywords: tools convenience highlight
|
||||
;; Compatibility: GNU Emacs 21, GNU Emacs 22, GNU Emacs 23
|
||||
;;
|
||||
;; Features that might be required by this library:
|
||||
;;
|
||||
;; None
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Highlights the background at a given character column.
|
||||
;;
|
||||
;; Commands `column-marker-1', `column-marker-2', and
|
||||
;; `column-marker-3' each highlight a given column (using different
|
||||
;; background colors, by default).
|
||||
;;
|
||||
;; - With no prefix argument, each highlights the current column
|
||||
;; (where the cursor is).
|
||||
;;
|
||||
;; - With a non-negative numeric prefix argument, each highlights that
|
||||
;; column.
|
||||
;;
|
||||
;; - With plain `C-u' (no number), each turns off its highlighting.
|
||||
;;
|
||||
;; - With `C-u C-u', each turns off all column highlighting.
|
||||
;;
|
||||
;; If two commands highlight the same column, the last-issued
|
||||
;; highlighting command shadows the other - only the last-issued
|
||||
;; highlighting is seen. If that "topmost" highlighting is then
|
||||
;; turned off, the other highlighting for that column then shows
|
||||
;; through.
|
||||
;;
|
||||
;; Examples:
|
||||
;;
|
||||
;; M-x column-marker-1 highlights the column where the cursor is, in
|
||||
;; face `column-marker-1'.
|
||||
;;
|
||||
;; C-u 70 M-x column-marker-2 highlights column 70 in face
|
||||
;; `column-marker-2'.
|
||||
;;
|
||||
;; C-u 70 M-x column-marker-3 highlights column 70 in face
|
||||
;; `column-marker-3'. The face `column-marker-2' highlighting no
|
||||
;; longer shows.
|
||||
;;
|
||||
;; C-u M-x column-marker-3 turns off highlighting for column-marker-3,
|
||||
;; so face `column-marker-2' highlighting shows again for column 70.
|
||||
;;
|
||||
;; C-u C-u M-x column-marker-1 (or -2 or -3) erases all column
|
||||
;; highlighting.
|
||||
;;
|
||||
;; These commands use `font-lock-fontify-buffer', so syntax
|
||||
;; highlighting (`font-lock-mode') must be turned on. There might be
|
||||
;; a performance impact during refontification.
|
||||
;;
|
||||
;;
|
||||
;; Installation: Place this file on your load path, and put this in
|
||||
;; your init file (`.emacs'):
|
||||
;;
|
||||
;; (require 'column-marker)
|
||||
;;
|
||||
;; Other init file suggestions (examples):
|
||||
;;
|
||||
;; ;; Highlight column 80 in foo mode.
|
||||
;; (add-hook 'foo-mode-hook (lambda () (interactive) (column-marker-1 80)))
|
||||
;;
|
||||
;; ;; Use `C-c m' interactively to highlight with face `column-marker-1'.
|
||||
;; (global-set-key [?\C-c ?m] 'column-marker-1)
|
||||
;;
|
||||
;;
|
||||
;; Please report any bugs!
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Change log:
|
||||
;;
|
||||
;; 2009/12/10 dadams
|
||||
;; column-marker-internal: Quote the face. Thx to Johan Bockgård.
|
||||
;; 2009/12/09 dadams
|
||||
;; column-marker-find: fset a symbol to the function, and return the symbol.
|
||||
;; 2008/01/21 dadams
|
||||
;; Renamed faces by dropping suffix "-face".
|
||||
;; 2006/08/18 dadams
|
||||
;; column-marker-create: Add newlines to doc-string sentences.
|
||||
;; 2005/12/31 dadams
|
||||
;; column-marker-create: Add marker to column-marker-vars inside the defun,
|
||||
;; so it is done in the right buffer, updating column-marker-vars buffer-locally.
|
||||
;; column-marker-find: Corrected comment. Changed or to progn for clarity.
|
||||
;; 2005/12/29 dadams
|
||||
;; Updated wrt new version of column-marker.el (multi-column characters).
|
||||
;; Corrected stray occurrences of column-marker-here to column-marker-1.
|
||||
;; column-marker-vars: Added make-local-variable.
|
||||
;; column-marker-create: Changed positive to non-negative.
|
||||
;; column-marker-internal: Turn off marker when col is negative, not < 1.
|
||||
;; 2005-12-29 RGB
|
||||
;; column-marker.el now supports multi-column characters.
|
||||
;; 2005/11/21 dadams
|
||||
;; Combined static and dynamic.
|
||||
;; Use separate faces for each marker. Different interactive spec.
|
||||
;; 2005/10/19 RGB
|
||||
;; Initial release of column-marker.el.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
;; Floor, Boston, MA 02110-1301, USA.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
(defface column-marker-1 '((t (:background "gray")))
|
||||
"Face used for a column marker. Usually a background color."
|
||||
:group 'faces)
|
||||
|
||||
(defvar column-marker-1-face 'column-marker-1
|
||||
"Face used for a column marker. Usually a background color.
|
||||
Changing this directly affects only new markers.")
|
||||
|
||||
(defface column-marker-2 '((t (:background "cyan3")))
|
||||
"Face used for a column marker. Usually a background color."
|
||||
:group 'faces)
|
||||
|
||||
(defvar column-marker-2-face 'column-marker-2
|
||||
"Face used for a column marker. Usually a background color.
|
||||
Changing this directly affects only new markers." )
|
||||
|
||||
(defface column-marker-3 '((t (:background "orchid3")))
|
||||
"Face used for a column marker. Usually a background color."
|
||||
:group 'faces)
|
||||
|
||||
(defvar column-marker-3-face 'column-marker-3
|
||||
"Face used for a column marker. Usually a background color.
|
||||
Changing this directly affects only new markers." )
|
||||
|
||||
(defvar column-marker-vars ()
|
||||
"List of all internal column-marker variables")
|
||||
(make-variable-buffer-local 'column-marker-vars) ; Buffer local in all buffers.
|
||||
|
||||
(defmacro column-marker-create (var &optional face)
|
||||
"Define a column marker named VAR.
|
||||
FACE is the face to use. If nil, then face `column-marker-1' is used."
|
||||
(setq face (or face 'column-marker-1))
|
||||
`(progn
|
||||
;; define context variable ,VAR so marker can be removed if desired
|
||||
(defvar ,var ()
|
||||
"Buffer local. Used internally to store column marker spec.")
|
||||
;; context must be buffer local since font-lock is
|
||||
(make-variable-buffer-local ',var)
|
||||
;; Define wrapper function named ,VAR to call `column-marker-internal'
|
||||
(defun ,var (arg)
|
||||
,(concat "Highlight column with face `" (symbol-name face)
|
||||
"'.\nWith no prefix argument, highlight current column.\n"
|
||||
"With non-negative numeric prefix arg, highlight that column number.\n"
|
||||
"With plain `C-u' (no number), turn off this column marker.\n"
|
||||
"With `C-u C-u' or negative prefix arg, turn off all column-marker highlighting.")
|
||||
(interactive "P")
|
||||
(unless (memq ',var column-marker-vars) (push ',var column-marker-vars))
|
||||
(cond ((null arg) ; Default: highlight current column.
|
||||
(column-marker-internal ',var (1+ (current-column)) ,face))
|
||||
((consp arg)
|
||||
(if (= 4 (car arg))
|
||||
(column-marker-internal ',var nil) ; `C-u': Remove this column highlighting.
|
||||
(dolist (var column-marker-vars)
|
||||
(column-marker-internal var nil)))) ; `C-u C-u': Remove all column highlighting.
|
||||
((and (integerp arg) (>= arg 0)) ; `C-u 70': Highlight that column.
|
||||
(column-marker-internal ',var (1+ (prefix-numeric-value arg)) ,face))
|
||||
(t ; `C-u -40': Remove all column highlighting.
|
||||
(dolist (var column-marker-vars)
|
||||
(column-marker-internal var nil)))))))
|
||||
|
||||
(defun column-marker-find (col)
|
||||
"Defines a function to locate a character in column COL.
|
||||
Returns the function symbol, named `column-marker-move-to-COL'."
|
||||
(let ((fn-symb (intern (format "column-marker-move-to-%d" col))))
|
||||
(fset `,fn-symb
|
||||
`(lambda (end)
|
||||
(let ((start (point)))
|
||||
(when (> end (point-max)) (setq end (point-max)))
|
||||
|
||||
;; Try to keep `move-to-column' from going backward, though it still can.
|
||||
(unless (< (current-column) ,col) (forward-line 1))
|
||||
|
||||
;; Again, don't go backward. Try to move to correct column.
|
||||
(when (< (current-column) ,col) (move-to-column ,col))
|
||||
|
||||
;; If not at target column, try to move to it.
|
||||
(while (and (< (current-column) ,col) (< (point) end)
|
||||
(= 0 (+ (forward-line 1) (current-column)))) ; Should be bol.
|
||||
(move-to-column ,col))
|
||||
|
||||
;; If at target column, not past end, and not prior to start,
|
||||
;; then set match data and return t. Otherwise go to start
|
||||
;; and return nil.
|
||||
(if (and (= ,col (current-column)) (<= (point) end) (> (point) start))
|
||||
(progn (set-match-data (list (1- (point)) (point)))
|
||||
t) ; Return t.
|
||||
(goto-char start)
|
||||
nil)))) ; Return nil.
|
||||
fn-symb))
|
||||
|
||||
(defun column-marker-internal (sym col &optional face)
|
||||
"SYM is the symbol for holding the column marker context.
|
||||
COL is the column in which a marker should be set.
|
||||
Supplying nil or 0 for COL turns off the marker.
|
||||
FACE is the face to use. If nil, then face `column-marker-1' is used."
|
||||
(setq face (or face 'column-marker-1))
|
||||
(when (symbol-value sym) ; Remove any previously set column marker
|
||||
(font-lock-remove-keywords nil (symbol-value sym))
|
||||
(set sym nil))
|
||||
(when (or (listp col) (< col 0)) (setq col nil)) ; Allow nonsense stuff to turn off the marker
|
||||
(when col ; Generate a new column marker
|
||||
(set sym `((,(column-marker-find col) (0 ',face prepend t))))
|
||||
(font-lock-add-keywords nil (symbol-value sym) t))
|
||||
(font-lock-fontify-buffer))
|
||||
|
||||
;; If you need more markers you can create your own similarly.
|
||||
;; All markers can be in use at once, and each is buffer-local,
|
||||
;; so there is no good reason to define more unless you need more
|
||||
;; markers in a single buffer.
|
||||
(column-marker-create column-marker-1 column-marker-1-face)
|
||||
(column-marker-create column-marker-2 column-marker-2-face)
|
||||
(column-marker-create column-marker-3 column-marker-3-face)
|
||||
|
||||
;;;###autoload
|
||||
(autoload 'column-marker-1 "column-marker" "Highlight a column." t)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(provide 'column-marker)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; column-marker.el ends here
|
|
@ -1,45 +0,0 @@
|
|||
(defun what-face (pos)
|
||||
"Find out which face the current position uses"
|
||||
(interactive "d")
|
||||
(let ((face (or (get-char-property (point) 'read-face-name)
|
||||
(get-char-property (point) 'face))))
|
||||
(if face
|
||||
(message "Face: %s" face)
|
||||
(message "No face at %d" pos))))
|
||||
|
||||
(defun my-comp-finish-function (buf str)
|
||||
"Don't show compilation window if everything went ok"
|
||||
(if (string-match "exited abnormally" str)
|
||||
;; there were errors
|
||||
(message "compilation errors, press C-x ` to visit")
|
||||
;; no errors, make the compilation window go away in 0.5 seconds
|
||||
(run-at-time 0.5 nil 'delete-windows-on bu)
|
||||
(message "NO COMPILATION ERRORS!")))
|
||||
|
||||
(defun bh/hide-other ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(org-back-to-heading)
|
||||
(org-shifttab)
|
||||
(org-reveal)
|
||||
(org-cycle)))
|
||||
|
||||
(defun bh/go-to-scratch ()
|
||||
(interactive)
|
||||
(switch-to-buffer "*scratch*")
|
||||
(delete-other-windows))
|
||||
|
||||
(defun bh/untabify ()
|
||||
(interactive)
|
||||
(untabify (point-min) (point-max)))
|
||||
|
||||
(defun bh/killframe ()
|
||||
(interactive)
|
||||
(unless (buffer-modified-p)
|
||||
(kill-buffer (current-buffer)))
|
||||
(delete-frame))
|
||||
|
||||
(defun show-whitespace ()
|
||||
(whitespace-mode t))
|
||||
|
||||
(provide 'functions)
|
|
@ -1 +0,0 @@
|
|||
Subproject commit ec88948e06f787fcc1c3b9951930ef00b25d0b8a
|
File diff suppressed because it is too large
Load diff
|
@ -1,544 +0,0 @@
|
|||
;;; go-mode.el --- Major mode for the Go programming language
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; For installation instructions, see go-mode-load.el
|
||||
|
||||
;;; To do:
|
||||
|
||||
;; * Indentation is *almost* identical to gofmt
|
||||
;; ** We disagree on the indentation of function literals in arguments
|
||||
;; ** There are bugs with the close brace of struct literals
|
||||
;; * Highlight identifiers according to their syntactic context: type,
|
||||
;; variable, function call, or tag
|
||||
;; * Command for adding an import
|
||||
;; ** Check if it's already there
|
||||
;; ** Factor/unfactor the import line
|
||||
;; ** Alphabetize
|
||||
;; * Remove unused imports
|
||||
;; ** This is hard, since I have to be aware of shadowing to do it
|
||||
;; right
|
||||
;; * Format region using gofmt
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
|
||||
(defvar go-mode-syntax-table
|
||||
(let ((st (make-syntax-table)))
|
||||
;; Add _ to :word: character class
|
||||
(modify-syntax-entry ?_ "w" st)
|
||||
|
||||
;; Operators (punctuation)
|
||||
(modify-syntax-entry ?+ "." st)
|
||||
(modify-syntax-entry ?- "." st)
|
||||
(modify-syntax-entry ?* "." st)
|
||||
(modify-syntax-entry ?/ "." st)
|
||||
(modify-syntax-entry ?% "." st)
|
||||
(modify-syntax-entry ?& "." st)
|
||||
(modify-syntax-entry ?| "." st)
|
||||
(modify-syntax-entry ?^ "." st)
|
||||
(modify-syntax-entry ?! "." st)
|
||||
(modify-syntax-entry ?= "." st)
|
||||
(modify-syntax-entry ?< "." st)
|
||||
(modify-syntax-entry ?> "." st)
|
||||
|
||||
;; Strings
|
||||
(modify-syntax-entry ?\" "\"" st)
|
||||
(modify-syntax-entry ?\' "\"" st)
|
||||
(modify-syntax-entry ?` "\"" st)
|
||||
(modify-syntax-entry ?\\ "\\" st)
|
||||
|
||||
;; Comments
|
||||
(modify-syntax-entry ?/ ". 124b" st)
|
||||
(modify-syntax-entry ?* ". 23" st)
|
||||
(modify-syntax-entry ?\n "> b" st)
|
||||
(modify-syntax-entry ?\^m "> b" st)
|
||||
|
||||
st)
|
||||
"Syntax table for Go mode.")
|
||||
|
||||
(defvar go-mode-keywords
|
||||
'("break" "default" "func" "interface" "select"
|
||||
"case" "defer" "go" "map" "struct"
|
||||
"chan" "else" "goto" "package" "switch"
|
||||
"const" "fallthrough" "if" "range" "type"
|
||||
"continue" "for" "import" "return" "var")
|
||||
"All keywords in the Go language. Used for font locking and
|
||||
some syntax analysis.")
|
||||
|
||||
(defvar go-mode-font-lock-keywords
|
||||
(let ((builtins '("append" "cap" "close" "complex" "copy" "imag" "len"
|
||||
"make" "new" "panic" "print" "println" "real" "recover"))
|
||||
(constants '("nil" "true" "false" "iota"))
|
||||
(type-name "\\s *\\(?:[*(]\\s *\\)*\\(?:\\w+\\s *\\.\\s *\\)?\\(\\w+\\)")
|
||||
)
|
||||
`((,(regexp-opt go-mode-keywords 'words) . font-lock-keyword-face)
|
||||
(,(regexp-opt builtins 'words) . font-lock-builtin-face)
|
||||
(,(regexp-opt constants 'words) . font-lock-constant-face)
|
||||
;; Function names in declarations
|
||||
("\\<func\\>\\s *\\(\\w+\\)" 1 font-lock-function-name-face)
|
||||
;; Function names in methods are handled by function call pattern
|
||||
;; Function names in calls
|
||||
;; XXX Doesn't match if function name is surrounded by parens
|
||||
("\\(\\w+\\)\\s *(" 1 font-lock-function-name-face)
|
||||
;; Type names
|
||||
("\\<type\\>\\s *\\(\\w+\\)" 1 font-lock-type-face)
|
||||
(,(concat "\\<type\\>\\s *\\w+\\s *" type-name) 1 font-lock-type-face)
|
||||
;; Arrays/slices/map value type
|
||||
;; XXX Wrong. Marks 0 in expression "foo[0] * x"
|
||||
;; (,(concat "]" type-name) 1 font-lock-type-face)
|
||||
;; Map key type
|
||||
(,(concat "\\<map\\s *\\[" type-name) 1 font-lock-type-face)
|
||||
;; Channel value type
|
||||
(,(concat "\\<chan\\>\\s *\\(?:<-\\)?" type-name) 1 font-lock-type-face)
|
||||
;; new/make type
|
||||
(,(concat "\\<\\(?:new\\|make\\)\\>\\(?:\\s \\|)\\)*(" type-name) 1 font-lock-type-face)
|
||||
;; Type conversion
|
||||
(,(concat "\\.\\s *(" type-name) 1 font-lock-type-face)
|
||||
;; Method receiver type
|
||||
(,(concat "\\<func\\>\\s *(\\w+\\s +" type-name) 1 font-lock-type-face)
|
||||
;; Labels
|
||||
;; XXX Not quite right. Also marks compound literal fields.
|
||||
("^\\s *\\(\\w+\\)\\s *:\\(\\S.\\|$\\)" 1 font-lock-constant-face)
|
||||
("\\<\\(goto\\|break\\|continue\\)\\>\\s *\\(\\w+\\)" 2 font-lock-constant-face)))
|
||||
"Basic font lock keywords for Go mode. Highlights keywords,
|
||||
built-ins, functions, and some types.")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Key map
|
||||
;;
|
||||
|
||||
(defvar go-mode-map
|
||||
(let ((m (make-sparse-keymap)))
|
||||
(define-key m "}" #'go-mode-insert-and-indent)
|
||||
(define-key m ")" #'go-mode-insert-and-indent)
|
||||
(define-key m ":" #'go-mode-delayed-electric)
|
||||
;; In case we get : indentation wrong, correct ourselves
|
||||
(define-key m "=" #'go-mode-insert-and-indent)
|
||||
m)
|
||||
"Keymap used by Go mode to implement electric keys.")
|
||||
|
||||
(defun go-mode-insert-and-indent (key)
|
||||
"Invoke the global binding of KEY, then reindent the line."
|
||||
|
||||
(interactive (list (this-command-keys)))
|
||||
(call-interactively (lookup-key (current-global-map) key))
|
||||
(indent-according-to-mode))
|
||||
|
||||
(defvar go-mode-delayed-point nil
|
||||
"The point following the previous insertion if the insertion
|
||||
was a delayed electric key. Used to communicate between
|
||||
`go-mode-delayed-electric' and `go-mode-delayed-electric-hook'.")
|
||||
(make-variable-buffer-local 'go-mode-delayed-point)
|
||||
|
||||
(defun go-mode-delayed-electric (p)
|
||||
"Perform electric insertion, but delayed by one event.
|
||||
|
||||
This inserts P into the buffer, as usual, then waits for another key.
|
||||
If that second key causes a buffer modification starting at the
|
||||
point after the insertion of P, reindents the line containing P."
|
||||
|
||||
(interactive "p")
|
||||
(self-insert-command p)
|
||||
(setq go-mode-delayed-point (point)))
|
||||
|
||||
(defun go-mode-delayed-electric-hook (b e l)
|
||||
"An after-change-function that implements `go-mode-delayed-electric'."
|
||||
|
||||
(when (and go-mode-delayed-point
|
||||
(= go-mode-delayed-point b))
|
||||
(save-excursion
|
||||
(save-match-data
|
||||
(goto-char go-mode-delayed-point)
|
||||
(indent-according-to-mode))))
|
||||
(setq go-mode-delayed-point nil))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Parser
|
||||
;;
|
||||
|
||||
(defvar go-mode-mark-cs-end 1
|
||||
"The point at which the comment/string cache ends. The buffer
|
||||
will be marked from the beginning up to this point (that is, up
|
||||
to and including character (1- go-mode-mark-cs-end)).")
|
||||
(make-variable-buffer-local 'go-mode-mark-cs-end)
|
||||
|
||||
(defvar go-mode-mark-cs-state nil
|
||||
"The `parse-partial-sexp' state of the comment/string parser as
|
||||
of the point `go-mode-mark-cs-end'.")
|
||||
(make-variable-buffer-local 'go-mode-mark-cs-state)
|
||||
|
||||
(defvar go-mode-mark-nesting-end 1
|
||||
"The point at which the nesting cache ends. The buffer will be
|
||||
marked from the beginning up to this point.")
|
||||
(make-variable-buffer-local 'go-mode-mark-nesting-end)
|
||||
|
||||
(defun go-mode-mark-clear-cache (b e l)
|
||||
"An after-change-function that clears the comment/string and
|
||||
nesting caches from the modified point on."
|
||||
|
||||
(save-restriction
|
||||
(widen)
|
||||
(when (< b go-mode-mark-cs-end)
|
||||
(remove-text-properties b (min go-mode-mark-cs-end (point-max)) '(go-mode-cs nil))
|
||||
(setq go-mode-mark-cs-end b
|
||||
go-mode-mark-cs-state nil))
|
||||
|
||||
(when (< b go-mode-mark-nesting-end)
|
||||
(remove-text-properties b (min go-mode-mark-nesting-end (point-max)) '(go-mode-nesting nil))
|
||||
(setq go-mode-mark-nesting-end b))))
|
||||
|
||||
(defmacro go-mode-parser (&rest body)
|
||||
"Evaluate BODY in an environment set up for parsers that use
|
||||
text properties to mark text. This inhibits changes to the undo
|
||||
list or the buffer's modification status and inhibits calls to
|
||||
the modification hooks. It also saves the excursion and
|
||||
restriction and widens the buffer, since most parsers are
|
||||
context-sensitive."
|
||||
|
||||
(let ((modified-var (make-symbol "modified")))
|
||||
`(let ((buffer-undo-list t)
|
||||
(,modified-var (buffer-modified-p))
|
||||
(inhibit-modification-hooks t)
|
||||
(inhibit-read-only t))
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(unwind-protect
|
||||
(progn ,@body)
|
||||
(set-buffer-modified-p ,modified-var)))))))
|
||||
|
||||
(defsubst go-mode-cs (&optional pos)
|
||||
"Return the comment/string state at point POS. If point is
|
||||
inside a comment or string (including the delimiters), this
|
||||
returns a pair (START . END) indicating the extents of the
|
||||
comment or string."
|
||||
|
||||
(unless pos
|
||||
(setq pos (point)))
|
||||
(if (= pos 1)
|
||||
nil
|
||||
(when (> pos go-mode-mark-cs-end)
|
||||
(go-mode-mark-cs pos))
|
||||
(get-text-property (- pos 1) 'go-mode-cs)))
|
||||
|
||||
(defun go-mode-mark-cs (end)
|
||||
"Mark comments and strings up to point END. Don't call this
|
||||
directly; use `go-mode-cs'."
|
||||
|
||||
(setq end (min end (point-max)))
|
||||
(go-mode-parser
|
||||
(let* ((pos go-mode-mark-cs-end)
|
||||
(state (or go-mode-mark-cs-state (syntax-ppss pos))))
|
||||
;; Mark comments and strings
|
||||
(when (nth 8 state)
|
||||
;; Get to the beginning of the comment/string
|
||||
(setq pos (nth 8 state)
|
||||
state nil))
|
||||
(while (> end pos)
|
||||
;; Find beginning of comment/string
|
||||
(while (and (> end pos)
|
||||
(progn
|
||||
(setq state (parse-partial-sexp pos end nil nil state 'syntax-table)
|
||||
pos (point))
|
||||
(not (nth 8 state)))))
|
||||
;; Find end of comment/string
|
||||
(let ((start (nth 8 state)))
|
||||
(when start
|
||||
(setq state (parse-partial-sexp pos (point-max) nil nil state 'syntax-table)
|
||||
pos (point))
|
||||
;; Mark comment
|
||||
(put-text-property start (- pos 1) 'go-mode-cs (cons start pos))
|
||||
(when nil
|
||||
(put-text-property start (- pos 1) 'face
|
||||
`((:background "midnight blue")))))))
|
||||
;; Update state
|
||||
(setq go-mode-mark-cs-end pos
|
||||
go-mode-mark-cs-state state))))
|
||||
|
||||
(defsubst go-mode-nesting (&optional pos)
|
||||
"Return the nesting at point POS. The nesting is a list
|
||||
of (START . END) pairs for all braces, parens, and brackets
|
||||
surrounding POS, starting at the inner-most nesting. START is
|
||||
the location of the open character. END is the location of the
|
||||
close character or nil if the nesting scanner has not yet
|
||||
encountered the close character."
|
||||
|
||||
(unless pos
|
||||
(setq pos (point)))
|
||||
(if (= pos 1)
|
||||
'()
|
||||
(when (> pos go-mode-mark-nesting-end)
|
||||
(go-mode-mark-nesting pos))
|
||||
(get-text-property (- pos 1) 'go-mode-nesting)))
|
||||
|
||||
(defun go-mode-mark-nesting (pos)
|
||||
"Mark nesting up to point END. Don't call this directly; use
|
||||
`go-mode-nesting'."
|
||||
|
||||
(go-mode-cs pos)
|
||||
(go-mode-parser
|
||||
;; Mark depth
|
||||
(goto-char go-mode-mark-nesting-end)
|
||||
(let ((nesting (go-mode-nesting))
|
||||
(last (point)))
|
||||
(while (< last pos)
|
||||
;; Find the next depth-changing character
|
||||
(skip-chars-forward "^(){}[]" pos)
|
||||
;; Mark everything up to this character with the current
|
||||
;; nesting
|
||||
(put-text-property last (point) 'go-mode-nesting nesting)
|
||||
(when nil
|
||||
(let ((depth (length nesting)))
|
||||
(put-text-property last (point) 'face
|
||||
`((:background
|
||||
,(format "gray%d" (* depth 10)))))))
|
||||
(setq last (point))
|
||||
;; Update nesting
|
||||
(unless (eobp)
|
||||
(let ((ch (unless (go-mode-cs) (char-after))))
|
||||
(forward-char 1)
|
||||
(case ch
|
||||
((?\( ?\{ ?\[)
|
||||
(setq nesting (cons (cons (- (point) 1) nil)
|
||||
nesting)))
|
||||
((?\) ?\} ?\])
|
||||
(when nesting
|
||||
(setcdr (car nesting) (- (point) 1))
|
||||
(setq nesting (cdr nesting))))))))
|
||||
;; Update state
|
||||
(setq go-mode-mark-nesting-end last))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Indentation
|
||||
;;
|
||||
|
||||
(defvar go-mode-non-terminating-keywords-regexp
|
||||
(let* ((kws go-mode-keywords)
|
||||
(kws (remove "break" kws))
|
||||
(kws (remove "continue" kws))
|
||||
(kws (remove "fallthrough" kws))
|
||||
(kws (remove "return" kws)))
|
||||
(regexp-opt kws 'words))
|
||||
"Regular expression matching all Go keywords that *do not*
|
||||
implicitly terminate a statement.")
|
||||
|
||||
(defun go-mode-semicolon-p ()
|
||||
"True iff point immediately follows either an explicit or
|
||||
implicit semicolon. Point should immediately follow the last
|
||||
token on the line."
|
||||
|
||||
;; #Semicolons
|
||||
(case (char-before)
|
||||
((?\;) t)
|
||||
;; String literal
|
||||
((?' ?\" ?`) t)
|
||||
;; One of the operators and delimiters ++, --, ), ], or }
|
||||
((?+) (eq (char-before (1- (point))) ?+))
|
||||
((?-) (eq (char-before (1- (point))) ?-))
|
||||
((?\) ?\] ?\}) t)
|
||||
;; An identifier or one of the keywords break, continue,
|
||||
;; fallthrough, or return or a numeric literal
|
||||
(otherwise
|
||||
(save-excursion
|
||||
(when (/= (skip-chars-backward "[:word:]_") 0)
|
||||
(not (looking-at go-mode-non-terminating-keywords-regexp)))))))
|
||||
|
||||
(defun go-mode-indentation ()
|
||||
"Compute the ideal indentation level of the current line.
|
||||
|
||||
To the first order, this is the brace depth of the current line,
|
||||
plus parens that follow certain keywords. case, default, and
|
||||
labels are outdented one level, and continuation lines are
|
||||
indented one level."
|
||||
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(let ((cs (go-mode-cs)))
|
||||
;; Treat comments and strings differently only if the beginning
|
||||
;; of the line is contained within them
|
||||
(when (and cs (= (point) (car cs)))
|
||||
(setq cs nil))
|
||||
;; What type of context am I in?
|
||||
(cond
|
||||
((and cs (save-excursion
|
||||
(goto-char (car cs))
|
||||
(looking-at "\\s\"")))
|
||||
;; Inside a multi-line string. Don't mess with indentation.
|
||||
nil)
|
||||
(cs
|
||||
;; Inside a general comment
|
||||
(goto-char (car cs))
|
||||
(forward-char 1)
|
||||
(current-column))
|
||||
(t
|
||||
;; Not in a multi-line string or comment
|
||||
(let ((indent 0)
|
||||
(inside-indenting-paren nil))
|
||||
;; Count every enclosing brace, plus parens that follow
|
||||
;; import, const, var, or type and indent according to
|
||||
;; depth. This simple rule does quite well, but also has a
|
||||
;; very large extent. It would be better if we could mimic
|
||||
;; some nearby indentation.
|
||||
(save-excursion
|
||||
(skip-chars-forward "})")
|
||||
(let ((first t))
|
||||
(dolist (nest (go-mode-nesting))
|
||||
(case (char-after (car nest))
|
||||
((?\{)
|
||||
(incf indent tab-width))
|
||||
((?\()
|
||||
(goto-char (car nest))
|
||||
(forward-comment (- (buffer-size)))
|
||||
;; Really just want the token before
|
||||
(when (looking-back "\\<import\\|const\\|var\\|type"
|
||||
(max (- (point) 7) (point-min)))
|
||||
(incf indent tab-width)
|
||||
(when first
|
||||
(setq inside-indenting-paren t)))))
|
||||
(setq first nil))))
|
||||
|
||||
;; case, default, and labels are outdented 1 level
|
||||
;; assume that labels are alone on the line
|
||||
(when (looking-at "\\<case\\>\\|\\<default\\>\\|\\w+\\s *:\\s *$")
|
||||
(decf indent tab-width))
|
||||
|
||||
;; Continuation lines are indented 1 level
|
||||
(forward-comment (- (buffer-size)))
|
||||
(when (case (char-before)
|
||||
((nil ?\{ ?:)
|
||||
;; At the beginning of a block or the statement
|
||||
;; following a label.
|
||||
nil)
|
||||
((?\()
|
||||
;; Usually a continuation line in an expression,
|
||||
;; unless this paren is part of a factored
|
||||
;; declaration.
|
||||
(not inside-indenting-paren))
|
||||
((?,)
|
||||
;; Could be inside a literal. We're a little
|
||||
;; conservative here and consider any comma within
|
||||
;; curly braces (as opposed to parens) to be a
|
||||
;; literal separator. This will fail to recognize
|
||||
;; line-breaks in parallel assignments as
|
||||
;; continuation lines.
|
||||
(let ((depth (go-mode-nesting)))
|
||||
(and depth
|
||||
(not (eq (char-after (caar depth)) ?\{)))))
|
||||
(t
|
||||
;; We're in the middle of a block. Did the
|
||||
;; previous line end with an implicit or explicit
|
||||
;; semicolon?
|
||||
(not (go-mode-semicolon-p))))
|
||||
(incf indent tab-width))
|
||||
|
||||
(max indent 0)))))))
|
||||
|
||||
(defun go-mode-indent-line ()
|
||||
"Indent the current line according to `go-mode-indentation'."
|
||||
(interactive)
|
||||
|
||||
(let ((col (go-mode-indentation)))
|
||||
(when col
|
||||
(let ((offset (- (current-column) (current-indentation))))
|
||||
(indent-line-to col)
|
||||
(when (> offset 0)
|
||||
(forward-char offset))))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Go mode
|
||||
;;
|
||||
|
||||
;;;###autoload
|
||||
(define-derived-mode go-mode prog-mode "Go"
|
||||
"Major mode for editing Go source text.
|
||||
|
||||
This provides basic syntax highlighting for keywords, built-ins,
|
||||
functions, and some types. It also provides indentation that is
|
||||
\(almost) identical to gofmt."
|
||||
|
||||
;; Font lock
|
||||
(set (make-local-variable 'font-lock-defaults)
|
||||
'(go-mode-font-lock-keywords nil nil nil nil))
|
||||
|
||||
;; Remove stale text properties
|
||||
(save-restriction
|
||||
(widen)
|
||||
(remove-text-properties 1 (point-max)
|
||||
'(go-mode-cs nil go-mode-nesting nil)))
|
||||
|
||||
;; Reset the syntax mark caches
|
||||
(setq go-mode-mark-cs-end 1
|
||||
go-mode-mark-cs-state nil
|
||||
go-mode-mark-nesting-end 1)
|
||||
(add-hook 'after-change-functions #'go-mode-mark-clear-cache nil t)
|
||||
|
||||
;; Indentation
|
||||
(set (make-local-variable 'indent-line-function)
|
||||
#'go-mode-indent-line)
|
||||
(add-hook 'after-change-functions #'go-mode-delayed-electric-hook nil t)
|
||||
|
||||
;; Comments
|
||||
(set (make-local-variable 'comment-start) "// ")
|
||||
(set (make-local-variable 'comment-end) "")
|
||||
|
||||
;; Go style
|
||||
(setq indent-tabs-mode t))
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist (cons "\\.go$" #'go-mode))
|
||||
|
||||
(defun go-mode-reload ()
|
||||
"Reload go-mode.el and put the current buffer into Go mode.
|
||||
Useful for development work."
|
||||
|
||||
(interactive)
|
||||
(unload-feature 'go-mode)
|
||||
(require 'go-mode)
|
||||
(go-mode))
|
||||
|
||||
;;;###autoload
|
||||
(defun gofmt ()
|
||||
"Pipe the current buffer through the external tool `gofmt`.
|
||||
Replace the current buffer on success; display errors on failure."
|
||||
|
||||
(interactive)
|
||||
(let ((srcbuf (current-buffer)))
|
||||
(with-temp-buffer
|
||||
(let ((outbuf (current-buffer))
|
||||
(errbuf (get-buffer-create "*Gofmt Errors*"))
|
||||
(coding-system-for-read 'utf-8) ;; use utf-8 with subprocesses
|
||||
(coding-system-for-write 'utf-8))
|
||||
(with-current-buffer errbuf (erase-buffer))
|
||||
(with-current-buffer srcbuf
|
||||
(save-restriction
|
||||
(let (deactivate-mark)
|
||||
(widen)
|
||||
(if (= 0 (shell-command-on-region (point-min) (point-max) "gofmt"
|
||||
outbuf nil errbuf))
|
||||
;; gofmt succeeded: replace the current buffer with outbuf,
|
||||
;; restore the mark and point, and discard errbuf.
|
||||
(let ((old-mark (mark t)) (old-point (point)))
|
||||
(erase-buffer)
|
||||
(insert-buffer-substring outbuf)
|
||||
(goto-char (min old-point (point-max)))
|
||||
(if old-mark (push-mark (min old-mark (point-max)) t))
|
||||
(kill-buffer errbuf))
|
||||
|
||||
;; gofmt failed: display the errors
|
||||
(display-buffer errbuf)))))
|
||||
|
||||
;; Collapse any window opened on outbuf if shell-command-on-region
|
||||
;; displayed it.
|
||||
(delete-windows-on outbuf)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun gofmt-before-save ()
|
||||
"Add this to .emacs to run gofmt on the current buffer when saving:
|
||||
(add-hook 'before-save-hook #'gofmt-before-save)"
|
||||
|
||||
(interactive)
|
||||
(when (eq major-mode 'go-mode) (gofmt)))
|
||||
|
||||
(provide 'go-mode)
|
|
@ -1,946 +0,0 @@
|
|||
;;; graphviz-dot-mode.el --- Mode for the dot-language used by graphviz (att).
|
||||
|
||||
;; Copyright (C) 2002 - 2011 Pieter Pareit <pieter.pareit@gmail.com>
|
||||
|
||||
;; This program is free software; you can redistribute it and/or
|
||||
;; modify it under the terms of the GNU General Public License as
|
||||
;; published by the Free Software Foundation; either version 2 of
|
||||
;; the License, or (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be
|
||||
;; useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
;; PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public
|
||||
;; License along with this program; if not, write to the Free
|
||||
;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
;; MA 02111-1307 USA
|
||||
|
||||
;; Authors: Pieter Pareit <pieter.pareit@gmail.com>
|
||||
;; Rubens Ramos <rubensr AT users.sourceforge.net>
|
||||
;; Eric Anderson http://www.ece.cmu.edu/~andersoe/
|
||||
;; Maintainer: Pieter Pareit <pieter.pareit@gmail.com>
|
||||
;; Homepage: http://users.skynet.be/ppareit/projects/graphviz-dot-mode/graphviz-dot-mode.html
|
||||
;; Created: 28 Oct 2002
|
||||
;; Last modified: 09 march 2011
|
||||
;; Version: 0.3.7
|
||||
;; Keywords: mode dot dot-language dotlanguage graphviz graphs att
|
||||
|
||||
;;; Commentary:
|
||||
;; Use this mode for editing files in the dot-language (www.graphviz.org and
|
||||
;; http://www.research.att.com/sw/tools/graphviz/).
|
||||
;;
|
||||
;; To use graphviz-dot-mode, add
|
||||
;; (load-file "PATH_TO_FILE/graphviz-dot-mode.el")
|
||||
;; to your ~/.emacs(.el) or ~/.xemacs/init.el
|
||||
;;
|
||||
;; The graphviz-dot-mode will do font locking, indentation, preview of graphs
|
||||
;; and eases compilation/error location. There is support for both GNU Emacs
|
||||
;; and XEmacs.
|
||||
;;
|
||||
;; Font locking is automatic, indentation uses the same commands as
|
||||
;; other modes, tab, M-j and C-M-q. Insertion of comments uses the
|
||||
;; same commands as other modes, M-; . You can compile a file using
|
||||
;; M-x compile or C-c c, after that M-x next-error will also work.
|
||||
;; There is support for viewing an generated image with C-c p.
|
||||
|
||||
;;; Todo:
|
||||
;; * cleanup the mess of graphviz-dot-compilation-parse-errors.
|
||||
;; * electric indentation is fundamentally broken, because
|
||||
;; {...} are also used for record nodes. You could argue, I suppose, that
|
||||
;; many diagrams don't need those, but it would be worth having a note (and
|
||||
;; it makes sense that the default is now for electric indentation to be
|
||||
;; off).
|
||||
;; * lines that start with # are comments, lines that start with one or more
|
||||
;; whitespaces and then a # should give an error.
|
||||
|
||||
;;; History:
|
||||
|
||||
;; Version 0.3.7 Tim Allen
|
||||
;; 09/03/2011: * fix spaces in file names when compiling
|
||||
;; Version 0.3.6 maintenance
|
||||
;; 19/02/2011: * .gv is the new extension (Pander)
|
||||
;; * comments can start with # (Pander)
|
||||
;; * highlight of new keywords (Pander)
|
||||
;; Version 0.3.5 bug (or at least feature I dislike) fix
|
||||
;; 11/11/2010: Eric Anderson http://www.ece.cmu.edu/~andersoe/
|
||||
;; * Preserve indentation across blank (whitespace-only) lines
|
||||
;; Version 0.3.4 bug fixes
|
||||
;; 24/02/2005: * fixed a bug in graphviz-dot-preview
|
||||
;; Version 0.3.3 bug fixes
|
||||
;; 13/02/2005: Reuben Thomas <rrt AT sc3d.org>
|
||||
;; * add graphviz-dot-indent-width
|
||||
;; Version 0.3.2 bug fixes
|
||||
;; 25/03/2004: Rubens Ramos <rubensr AT users.sourceforge.net>
|
||||
;; * semi-colons and brackets are added when electric
|
||||
;; behaviour is disabled.
|
||||
;; * electric characters do not behave electrically inside
|
||||
;; comments or strings.
|
||||
;; * default for electric-braces is disabled now (makes more
|
||||
;; sense I guess).
|
||||
;; * using read-from-minibuffer instead of read-shell-command
|
||||
;; for emacs.
|
||||
;; * Fixed test for easymenu, so that it works on older
|
||||
;; versions of XEmacs.
|
||||
;; * Fixed indentation error when trying to indent last brace
|
||||
;; of an empty graph.
|
||||
;; * region-active-p does not exist in emacs (21.2 at least),
|
||||
;; so removed from code
|
||||
;; * Added uncomment menu option
|
||||
;; Version 0.3.1 bug fixes
|
||||
;; 03/03/2004: * backward-word needs argument for older emacs
|
||||
;; Version 0.3 added features and fixed bugs
|
||||
;; 10/01/2004: fixed a bug in graphviz-dot-indent-graph
|
||||
;; 08/01/2004: Rubens Ramos <rubensr AT users.sourceforge.net>
|
||||
;; * added customization support
|
||||
;; * Now it works on XEmacs and Emacs
|
||||
;; * Added support to use an external Viewer
|
||||
;; * Now things do not break when dot mode is entered
|
||||
;; when there is no buffer name, but the side effect is
|
||||
;; that in this case, the compilation command is not
|
||||
;; correct.
|
||||
;; * Preview works on XEmacs and emacs.
|
||||
;; * Electric indentation on newline
|
||||
;; * Minor changes to indentation
|
||||
;; * Added keyword completion (but could be A LOT better)
|
||||
;; * There are still a couple of ugly hacks. Look for 'RR'.
|
||||
;; Version 0.2 added features
|
||||
;; 11/11/2002: added preview support.
|
||||
;; 10/11/2002: indent a graph or subgraph at once with C-M-q.
|
||||
;; 08/11/2002: relaxed rules for indentation, the may now be extra chars
|
||||
;; after beginning of graph (comment's for example).
|
||||
;; Version 0.1.2 bug fixes and naming issues
|
||||
;; 06/11/2002: renamed dot-font-lock-defaults to dot-font-lock-keywords.
|
||||
;; added some documentation to dot-colors.
|
||||
;; provided a much better way to handle my max-specpdl-size
|
||||
;; problem.
|
||||
;; added an extra autoload cookie (hope this helps, as I don't
|
||||
;; yet use autoload myself)
|
||||
;; Version 0.1.1 bug fixes
|
||||
;; 06/11/2002: added an missing attribute, for font-locking to work.
|
||||
;; fixed the regex generating, so that it only recognizes
|
||||
;; whole words
|
||||
;; 05/11/2002: there can now be extra white space chars after an '{'.
|
||||
;; 04/11/2002: Why I use max-specpdl-size is now documented, and old value
|
||||
;; gets restored.
|
||||
;; Version 0.1 initial release
|
||||
;; 02/11/2002: implemented parser for *compilation* of a .dot file.
|
||||
;; 01/11/2002: implemented compilation of an .dot file.
|
||||
;; 31/10/2002: added syntax-table to the mode.
|
||||
;; 30/10/2002: implemented indentation code.
|
||||
;; 29/10/2002: implemented all of font-lock.
|
||||
;; 28/10/2002: derived graphviz-dot-mode from fundamental-mode, started
|
||||
;; implementing font-lock.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defconst graphviz-dot-mode-version "0.3.6"
|
||||
"Version of `graphviz-dot-mode.el'.")
|
||||
|
||||
(defgroup graphviz nil
|
||||
"Major mode for editing Graphviz Dot files"
|
||||
:group 'tools)
|
||||
|
||||
(defun graphviz-dot-customize ()
|
||||
"Run \\[customize-group] for the `graphviz' group."
|
||||
(interactive)
|
||||
(customize-group 'graphviz))
|
||||
|
||||
(defvar graphviz-dot-mode-abbrev-table nil
|
||||
"Abbrev table in use in Graphviz Dot mode buffers.")
|
||||
(define-abbrev-table 'graphviz-dot-mode-abbrev-table ())
|
||||
|
||||
(defcustom graphviz-dot-dot-program "dot"
|
||||
"*Location of the dot program. This is used by `compile'."
|
||||
:type 'string
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-view-command "doted %s"
|
||||
"*External program to run on the buffer. You can use `%s' in this string,
|
||||
and it will be substituted by the buffer name."
|
||||
:type 'string
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-view-edit-command nil
|
||||
"*Whether to allow the user to edit the command to run an external
|
||||
viewer."
|
||||
:type 'boolean
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-save-before-view t
|
||||
"*If not nil, M-x graphviz-dot-view saves the current buffer before running
|
||||
the command."
|
||||
:type 'boolean
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-auto-indent-on-newline t
|
||||
"*If not nil, `electric-graphviz-dot-terminate-line' is executed in a line is terminated."
|
||||
:type 'boolean
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-indent-width default-tab-width
|
||||
"*Indentation width in Graphviz Dot mode buffers."
|
||||
:type 'integer
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-auto-indent-on-braces nil
|
||||
"*If not nil, `electric-graphviz-dot-open-brace' and `electric-graphviz-dot-close-brace' are executed when { or } are typed"
|
||||
:type 'boolean
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-auto-indent-on-semi t
|
||||
"*If not nil, `electric-graphviz-dot-semi' is executed when semicolon is typed"
|
||||
:type 'boolean
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-preview-extension "png"
|
||||
"*The extension to use for the compilation and preview commands. The format
|
||||
for the compilation command is
|
||||
`dot -T<extension> file.dot > file.<extension>'."
|
||||
:type 'string
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-toggle-completions nil
|
||||
"*Non-nil means that repeated use of \
|
||||
\\<graphviz-dot-mode-map>\\[graphviz-dot-complete-word] will toggle the possible
|
||||
completions in the minibuffer. Normally, when there is more than one possible
|
||||
completion, a buffer will display all completions."
|
||||
:type 'boolean
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-delete-completions nil
|
||||
"*Non-nil means that the completion buffer is automatically deleted when a
|
||||
key is pressed."
|
||||
:type 'boolean
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-attr-keywords
|
||||
'("graph" "digraph" "subgraph" "node" "edge" "strict" "rankdir"
|
||||
"size" "page" "Damping" "Epsilon" "URL" "arrowhead" "arrowsize"
|
||||
"arrowtail" "bb" "bgcolor" "bottomlabel" "center" "clusterrank"
|
||||
"color" "comment" "compound" "concentrate" "constraint" "decorate"
|
||||
"dim" "dir" "distortion" "fillcolor" "fixedsize" "fontcolor"
|
||||
"fontname" "fontpath" "fontsize" "group" "headURL" "headlabel"
|
||||
"headport" "height" "label" "labelangle" "labeldistance" "labelfloat"
|
||||
"labelfontcolor" "labelfontname" "labelfontsize" "labeljust"
|
||||
"labelloc" "layer" "layers" "len" "lhead" "lp" "ltail" "margin"
|
||||
"maxiter" "mclimit" "minlen" "model" "nodesep" "normalize" "nslimit"
|
||||
"nslimit1" "ordering" "orientation" "overlap" "pack" "pagedir"
|
||||
"pencolor" "peripheries" "pin" "pos" "quantum" "rank" "ranksep"
|
||||
"ratio" "rects" "regular" "remincross" "rotate" "samehead" "sametail"
|
||||
"samplepoint" "searchsize" "sep" "shape" "shapefile" "showboxes"
|
||||
"sides" "skew" "splines" "start" "style" "stylesheet" "tailURL"
|
||||
"taillabel" "tailport" "toplabel" "vertices" "voro_margin" "weight"
|
||||
"z" "width" "penwidth" "mindist" "scale" "patch" "root")
|
||||
"*Keywords for attribute names in a graph. This is used by the auto
|
||||
completion code. The actual completion tables are built when the mode
|
||||
is loaded, so changes to this are not immediately visible.
|
||||
Check http://www.graphviz.org/doc/schema/attributes.xml on new releases."
|
||||
:type '(repeat (string :tag "Keyword"))
|
||||
:group 'graphviz)
|
||||
|
||||
(defcustom graphviz-dot-value-keywords
|
||||
'("true" "false" "normal" "inv" "dot" "invdot" "odot" "invodot"
|
||||
"none" "tee" "empty" "invempty" "diamond" "odiamond" "box" "obox"
|
||||
"open" "crow" "halfopen" "local" "global" "none" "forward" "back"
|
||||
"both" "none" "BL" "BR" "TL" "TR" "RB" "RT" "LB" "LT" ":n" ":ne" ":e"
|
||||
":se" ":s" ":sw" ":w" ":nw" "same" "min" "source" "max" "sink" "LR"
|
||||
"box" "polygon" "ellipse" "circle" "point" "egg" "triangle"
|
||||
"plaintext" "diamond" "trapezium" "parallelogram" "house" "hexagon"
|
||||
"octagon" "doublecircle" "doubleoctagon" "tripleoctagon" "invtriangle"
|
||||
"invtrapezium" "invhouse" "Mdiamond" "Msquare" "Mcircle" "record"
|
||||
"Mrecord" "dashed" "dotted" "solid" "invis" "bold" "filled"
|
||||
"diagonals" "rounded" )
|
||||
"*Keywords for attribute values. This is used by the auto completion
|
||||
code. The actual completion tables are built when the mode is loaded,
|
||||
so changes to this are not immediately visible."
|
||||
:type '(repeat (string :tag "Keyword"))
|
||||
:group 'graphviz)
|
||||
|
||||
;;; Font-locking:
|
||||
(defvar graphviz-dot-colors-list
|
||||
'(aliceblue antiquewhite antiquewhite1 antiquewhite2
|
||||
antiquewhite3 antiquewhite4 aquamarine aquamarine1
|
||||
aquamarine2 aquamarine3 aquamarine4 azure azure1
|
||||
azure2 azure3 azure4 beige bisque bisque1 bisque2
|
||||
bisque3 bisque4 black blanchedalmond blue blue1
|
||||
blue2 blue3 blue4 blueviolet brown brown1 brown2
|
||||
brown3 brown4 burlywood burlywood1 burlywood2
|
||||
burlywood3 burlywood4 cadetblue cadetblue1
|
||||
cadetblue2 cadetblue3 cadetblue4 chartreuse
|
||||
chartreuse1 chartreuse2 chartreuse3 chartreuse4
|
||||
chocolate chocolate1 chocolate2 chocolate3 chocolate4
|
||||
coral coral1 coral2 coral3 coral4 cornflowerblue
|
||||
cornsilk cornsilk1 cornsilk2 cornsilk3 cornsilk4
|
||||
crimson cyan cyan1 cyan2 cyan3 cyan4 darkgoldenrod
|
||||
darkgoldenrod1 darkgoldenrod2 darkgoldenrod3
|
||||
darkgoldenrod4 darkgreen darkkhaki darkolivegreen
|
||||
darkolivegreen1 darkolivegreen2 darkolivegreen3
|
||||
darkolivegreen4 darkorange darkorange1 darkorange2
|
||||
darkorange3 darkorange4 darkorchid darkorchid1
|
||||
darkorchid2 darkorchid3 darkorchid4 darksalmon
|
||||
darkseagreen darkseagreen1 darkseagreen2
|
||||
darkseagreen3 darkseagreen4 darkslateblue
|
||||
darkslategray darkslategray1 darkslategray2
|
||||
darkslategray3 darkslategray4 darkslategrey
|
||||
darkturquoise darkviolet deeppink deeppink1
|
||||
deeppink2 deeppink3 deeppink4 deepskyblue
|
||||
deepskyblue1 deepskyblue2 deepskyblue3 deepskyblue4
|
||||
dimgray dimgrey dodgerblue dodgerblue1 dodgerblue2
|
||||
dodgerblue3 dodgerblue4 firebrick firebrick1
|
||||
firebrick2 firebrick3 firebrick4 floralwhite
|
||||
forestgreen gainsboro ghostwhite gold gold1 gold2
|
||||
gold3 gold4 goldenrod goldenrod1 goldenrod2
|
||||
goldenrod3 goldenrod4 gray gray0 gray1 gray10 gray100
|
||||
gray11 gray12 gray13 gray14 gray15 gray16 gray17
|
||||
gray18 gray19 gray2 gray20 gray21 gray22 gray23
|
||||
gray24 gray25 gray26 gray27 gray28 gray29 gray3
|
||||
gray30 gray31 gray32 gray33 gray34 gray35 gray36
|
||||
gray37 gray38 gray39 gray4 gray40 gray41 gray42
|
||||
gray43 gray44 gray45 gray46 gray47 gray48 gray49
|
||||
gray5 gray50 gray51 gray52 gray53 gray54 gray55
|
||||
gray56 gray57 gray58 gray59 gray6 gray60 gray61
|
||||
gray62 gray63 gray64 gray65 gray66 gray67 gray68
|
||||
gray69 gray7 gray70 gray71 gray72 gray73 gray74
|
||||
gray75 gray76 gray77 gray78 gray79 gray8 gray80
|
||||
gray81 gray82 gray83 gray84 gray85 gray86 gray87
|
||||
gray88 gray89 gray9 gray90 gray91 gray92 gray93
|
||||
gray94 gray95 gray96 gray97 gray98 gray99 green
|
||||
green1 green2 green3 green4 greenyellow grey grey0
|
||||
grey1 grey10 grey100 grey11 grey12 grey13 grey14
|
||||
grey15 grey16 grey17 grey18 grey19 grey2 grey20
|
||||
grey21 grey22 grey23 grey24 grey25 grey26 grey27
|
||||
grey28 grey29 grey3 grey30 grey31 grey32 grey33
|
||||
grey34 grey35 grey36 grey37 grey38 grey39 grey4
|
||||
grey40 grey41 grey42 grey43 grey44 grey45 grey46
|
||||
grey47 grey48 grey49 grey5 grey50 grey51 grey52
|
||||
grey53 grey54 grey55 grey56 grey57 grey58 grey59
|
||||
grey6 grey60 grey61 grey62 grey63 grey64 grey65
|
||||
grey66 grey67 grey68 grey69 grey7 grey70 grey71
|
||||
grey72 grey73 grey74 grey75 grey76 grey77 grey78
|
||||
grey79 grey8 grey80 grey81 grey82 grey83 grey84
|
||||
grey85 grey86 grey87 grey88 grey89 grey9 grey90
|
||||
grey91 grey92 grey93 grey94 grey95 grey96 grey97
|
||||
grey98 grey99 honeydew honeydew1 honeydew2 honeydew3
|
||||
honeydew4 hotpink hotpink1 hotpink2 hotpink3 hotpink4
|
||||
indianred indianred1 indianred2 indianred3 indianred4
|
||||
indigo ivory ivory1 ivory2 ivory3 ivory4 khaki khaki1
|
||||
khaki2 khaki3 khaki4 lavender lavenderblush
|
||||
lavenderblush1 lavenderblush2 lavenderblush3
|
||||
lavenderblush4 lawngreen lemonchiffon lemonchiffon1
|
||||
lemonchiffon2 lemonchiffon3 lemonchiffon4 lightblue
|
||||
lightblue1 lightblue2 lightblue3 lightblue4
|
||||
lightcoral lightcyan lightcyan1 lightcyan2 lightcyan3
|
||||
lightcyan4 lightgoldenrod lightgoldenrod1
|
||||
lightgoldenrod2 lightgoldenrod3 lightgoldenrod4
|
||||
lightgoldenrodyellow lightgray lightgrey lightpink
|
||||
lightpink1 lightpink2 lightpink3 lightpink4
|
||||
lightsalmon lightsalmon1 lightsalmon2 lightsalmon3
|
||||
lightsalmon4 lightseagreen lightskyblue lightskyblue1
|
||||
lightskyblue2 lightskyblue3 lightskyblue4
|
||||
lightslateblue lightslategray lightslategrey
|
||||
lightsteelblue lightsteelblue1 lightsteelblue2
|
||||
lightsteelblue3 lightsteelblue4 lightyellow
|
||||
lightyellow1 lightyellow2 lightyellow3 lightyellow4
|
||||
limegreen linen magenta magenta1 magenta2 magenta3
|
||||
magenta4 maroon maroon1 maroon2 maroon3 maroon4
|
||||
mediumaquamarine mediumblue mediumorchid
|
||||
mediumorchid1 mediumorchid2 mediumorchid3
|
||||
mediumorchid4 mediumpurple mediumpurple1
|
||||
mediumpurple2 mediumpurple3 mediumpurple4
|
||||
mediumseagreen mediumslateblue mediumspringgreen
|
||||
mediumturquoise mediumvioletred midnightblue
|
||||
mintcream mistyrose mistyrose1 mistyrose2 mistyrose3
|
||||
mistyrose4 moccasin navajowhite navajowhite1
|
||||
navajowhite2 navajowhite3 navajowhite4 navy navyblue
|
||||
oldlace olivedrab olivedrap olivedrab1 olivedrab2
|
||||
olivedrap3 oragne palegoldenrod palegreen palegreen1
|
||||
palegreen2 palegreen3 palegreen4 paleturquoise
|
||||
paleturquoise1 paleturquoise2 paleturquoise3
|
||||
paleturquoise4 palevioletred palevioletred1
|
||||
palevioletred2 palevioletred3 palevioletred4
|
||||
papayawhip peachpuff peachpuff1 peachpuff2
|
||||
peachpuff3 peachpuff4 peru pink pink1 pink2 pink3
|
||||
pink4 plum plum1 plum2 plum3 plum4 powderblue
|
||||
purple purple1 purple2 purple3 purple4 red red1 red2
|
||||
red3 red4 rosybrown rosybrown1 rosybrown2 rosybrown3
|
||||
rosybrown4 royalblue royalblue1 royalblue2 royalblue3
|
||||
royalblue4 saddlebrown salmon salmon1 salmon2 salmon3
|
||||
salmon4 sandybrown seagreen seagreen1 seagreen2
|
||||
seagreen3 seagreen4 seashell seashell1 seashell2
|
||||
seashell3 seashell4 sienna sienna1 sienna2 sienna3
|
||||
sienna4 skyblue skyblue1 skyblue2 skyblue3 skyblue4
|
||||
slateblue slateblue1 slateblue2 slateblue3 slateblue4
|
||||
slategray slategray1 slategray2 slategray3 slategray4
|
||||
slategrey snow snow1 snow2 snow3 snow4 springgreen
|
||||
springgreen1 springgreen2 springgreen3 springgreen4
|
||||
steelblue steelblue1 steelblue2 steelblue3 steelblue4
|
||||
tan tan1 tan2 tan3 tan4 thistle thistle1 thistle2
|
||||
thistle3 thistle4 tomato tomato1 tomato2 tomato3
|
||||
tomato4 transparent turquoise turquoise1 turquoise2
|
||||
turquoise3 turquoise4 violet violetred violetred1
|
||||
violetred2 violetred3 violetred4 wheat wheat1 wheat2
|
||||
wheat3 wheat4 white whitesmoke yellow yellow1 yellow2
|
||||
yellow3 yellow4 yellowgreen)
|
||||
"Possible color constants in the dot language.
|
||||
The list of constant is available at http://www.research.att.com/~erg/graphviz\
|
||||
/info/colors.html")
|
||||
|
||||
|
||||
(defvar graphviz-dot-color-keywords
|
||||
(mapcar 'symbol-name graphviz-dot-colors-list))
|
||||
|
||||
(defvar graphviz-attr-keywords
|
||||
(mapcar '(lambda (elm) (cons elm 0)) graphviz-dot-attr-keywords))
|
||||
|
||||
(defvar graphviz-value-keywords
|
||||
(mapcar '(lambda (elm) (cons elm 0)) graphviz-dot-value-keywords))
|
||||
|
||||
(defvar graphviz-color-keywords
|
||||
(mapcar '(lambda (elm) (cons elm 0)) graphviz-dot-color-keywords))
|
||||
|
||||
;;; Key map
|
||||
(defvar graphviz-dot-mode-map ()
|
||||
"Keymap used in Graphviz Dot mode.")
|
||||
|
||||
(if graphviz-dot-mode-map
|
||||
()
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map "\r" 'electric-graphviz-dot-terminate-line)
|
||||
(define-key map "{" 'electric-graphviz-dot-open-brace)
|
||||
(define-key map "}" 'electric-graphviz-dot-close-brace)
|
||||
(define-key map ";" 'electric-graphviz-dot-semi)
|
||||
(define-key map "\M-\t" 'graphviz-dot-complete-word)
|
||||
(define-key map "\C-\M-q" 'graphviz-dot-indent-graph)
|
||||
(define-key map "\C-cp" 'graphviz-dot-preview)
|
||||
(define-key map "\C-cc" 'compile)
|
||||
(define-key map "\C-cv" 'graphviz-dot-view)
|
||||
(define-key map "\C-c\C-c" 'comment-region)
|
||||
(define-key map "\C-c\C-u" 'graphviz-dot-uncomment-region)
|
||||
(setq graphviz-dot-mode-map map)
|
||||
))
|
||||
|
||||
;;; Syntax table
|
||||
(defvar graphviz-dot-mode-syntax-table nil
|
||||
"Syntax table for `graphviz-dot-mode'.")
|
||||
|
||||
(if graphviz-dot-mode-syntax-table
|
||||
()
|
||||
(let ((st (make-syntax-table)))
|
||||
(modify-syntax-entry ?/ ". 124b" st)
|
||||
(modify-syntax-entry ?* ". 23" st)
|
||||
(modify-syntax-entry ?\n "> b" st)
|
||||
(modify-syntax-entry ?= "." st)
|
||||
(modify-syntax-entry ?_ "_" st)
|
||||
(modify-syntax-entry ?- "_" st)
|
||||
(modify-syntax-entry ?> "." st)
|
||||
(modify-syntax-entry ?[ "(" st)
|
||||
(modify-syntax-entry ?] ")" st)
|
||||
(modify-syntax-entry ?\" "\"" st)
|
||||
(setq graphviz-dot-mode-syntax-table st)
|
||||
))
|
||||
|
||||
(defvar graphviz-dot-font-lock-keywords
|
||||
`(("\\(:?di\\|sub\\)?graph \\(\\sw+\\)"
|
||||
(2 font-lock-function-name-face))
|
||||
(,(regexp-opt graphviz-dot-value-keywords 'words)
|
||||
. font-lock-reference-face)
|
||||
;; to build the font-locking for the colors,
|
||||
;; we need more room for max-specpdl-size,
|
||||
;; after that we take the list of symbols,
|
||||
;; convert them to a list of strings, and make
|
||||
;; an optimized regexp from them
|
||||
(,(let ((max-specpdl-size (max max-specpdl-size 1200)))
|
||||
(regexp-opt graphviz-dot-color-keywords))
|
||||
. font-lock-string-face)
|
||||
(,(concat
|
||||
(regexp-opt graphviz-dot-attr-keywords 'words)
|
||||
"[ \\t\\n]*=")
|
||||
;; RR - ugly, really, but I dont know why xemacs does not work
|
||||
;; if I change the next car to "1"...
|
||||
(0 font-lock-variable-name-face)))
|
||||
"Keyword highlighting specification for `graphviz-dot-mode'.")
|
||||
|
||||
;;;###autoload
|
||||
(defun graphviz-dot-mode ()
|
||||
"Major mode for the dot language. \\<graphviz-dot-mode-map>
|
||||
TAB indents for graph lines.
|
||||
|
||||
\\[graphviz-dot-indent-graph]\t- Indentaion function.
|
||||
\\[graphviz-dot-preview]\t- Previews graph in a buffer.
|
||||
\\[graphviz-dot-view]\t- Views graph in an external viewer.
|
||||
\\[graphviz-dot-indent-line]\t- Indents current line of code.
|
||||
\\[graphviz-dot-complete-word]\t- Completes the current word.
|
||||
\\[electric-graphviz-dot-terminate-line]\t- Electric newline.
|
||||
\\[electric-graphviz-dot-open-brace]\t- Electric open braces.
|
||||
\\[electric-graphviz-dot-close-brace]\t- Electric close braces.
|
||||
\\[electric-graphviz-dot-semi]\t- Electric semi colons.
|
||||
|
||||
Variables specific to this mode:
|
||||
|
||||
graphviz-dot-dot-program (default `dot')
|
||||
Location of the dot program.
|
||||
graphviz-dot-view-command (default `doted %s')
|
||||
Command to run when `graphviz-dot-view' is executed.
|
||||
graphviz-dot-view-edit-command (default nil)
|
||||
If the user should be asked to edit the view command.
|
||||
graphviz-dot-save-before-view (default t)
|
||||
Automatically save current buffer berore `graphviz-dot-view'.
|
||||
graphviz-dot-preview-extension (default `png')
|
||||
File type to use for `graphviz-dot-preview'.
|
||||
graphviz-dot-auto-indent-on-newline (default t)
|
||||
Whether to run `electric-graphviz-dot-terminate-line' when
|
||||
newline is entered.
|
||||
graphviz-dot-auto-indent-on-braces (default t)
|
||||
Whether to run `electric-graphviz-dot-open-brace' and
|
||||
`electric-graphviz-dot-close-brace' when braces are
|
||||
entered.
|
||||
graphviz-dot-auto-indent-on-semi (default t)
|
||||
Whether to run `electric-graphviz-dot-semi' when semi colon
|
||||
is typed.
|
||||
graphviz-dot-toggle-completions (default nil)
|
||||
If completions should be displayed in the buffer instead of a
|
||||
completion buffer when \\[graphviz-dot-complete-word] is
|
||||
pressed repeatedly.
|
||||
|
||||
This mode can be customized by running \\[graphviz-dot-customize].
|
||||
|
||||
Turning on Graphviz Dot mode calls the value of the variable
|
||||
`graphviz-dot-mode-hook' with no args, if that value is non-nil."
|
||||
(interactive)
|
||||
(kill-all-local-variables)
|
||||
(use-local-map graphviz-dot-mode-map)
|
||||
(setq major-mode 'graphviz-dot-mode)
|
||||
(setq mode-name "dot")
|
||||
(setq local-abbrev-table graphviz-dot-mode-abbrev-table)
|
||||
(set-syntax-table graphviz-dot-mode-syntax-table)
|
||||
(set (make-local-variable 'indent-line-function) 'graphviz-dot-indent-line)
|
||||
(set (make-local-variable 'comment-start) "//")
|
||||
(set (make-local-variable 'comment-start-skip) "/\\*+ *\\|//+ *")
|
||||
(modify-syntax-entry ?# "< b" graphviz-dot-mode-syntax-table)
|
||||
(modify-syntax-entry ?\n "> b" graphviz-dot-mode-syntax-table)
|
||||
(set (make-local-variable 'font-lock-defaults)
|
||||
'(graphviz-dot-font-lock-keywords))
|
||||
;; RR - If user is running this in the scratch buffer, there is no
|
||||
;; buffer file name...
|
||||
(if (buffer-file-name)
|
||||
(set (make-local-variable 'compile-command)
|
||||
(concat graphviz-dot-dot-program
|
||||
" -T" graphviz-dot-preview-extension " "
|
||||
"\"" buffer-file-name "\""
|
||||
" > \""
|
||||
(file-name-sans-extension
|
||||
buffer-file-name)
|
||||
"." graphviz-dot-preview-extension "\"")))
|
||||
(set (make-local-variable 'compilation-parse-errors-function)
|
||||
'graphviz-dot-compilation-parse-errors)
|
||||
(if dot-menu
|
||||
(easy-menu-add dot-menu))
|
||||
(run-hooks 'graphviz-dot-mode-hook)
|
||||
)
|
||||
|
||||
;;;; Menu definitions
|
||||
|
||||
(defvar dot-menu nil
|
||||
"Menu for Graphviz Dot Mode.
|
||||
This menu will get created automatically if you have the `easymenu'
|
||||
package. Note that the latest X/Emacs releases contain this package.")
|
||||
|
||||
(and (condition-case nil
|
||||
(require 'easymenu)
|
||||
(error nil))
|
||||
(easy-menu-define
|
||||
dot-menu graphviz-dot-mode-map "Graphviz Mode menu"
|
||||
'("Graphviz"
|
||||
["Indent Graph" graphviz-dot-indent-graph t]
|
||||
["Comment Out Region" comment-region (mark)]
|
||||
["Uncomment Region" graphviz-dot-uncomment-region (mark)]
|
||||
"-"
|
||||
["Compile" compile t]
|
||||
["Preview" graphviz-dot-preview
|
||||
(and (buffer-file-name)
|
||||
(not (buffer-modified-p)))]
|
||||
["External Viewer" graphviz-dot-view (buffer-file-name)]
|
||||
"-"
|
||||
["Customize..." graphviz-dot-customize t]
|
||||
)))
|
||||
|
||||
;;;; Compilation
|
||||
|
||||
;; note on graphviz-dot-compilation-parse-errors:
|
||||
;; It would nicer if we could just use compilation-error-regexp-alist
|
||||
;; to do that, 3 options:
|
||||
;; - still write dot-compilation-parse-errors, don't build
|
||||
;; a return list, but modify the *compilation* buffer
|
||||
;; in a way compilation-error-regexp-alist recognizes the
|
||||
;; format.
|
||||
;; to do that, I should globally change compilation-parse-function
|
||||
;; to this function, and call the old value of comp..-parse-fun..
|
||||
;; to provide the return value.
|
||||
;; two drawbacks are that, every compilation would be run through
|
||||
;; this function (performance) and that in autoload there would
|
||||
;; be a chance that this function would not yet be known.
|
||||
;; - let the compilation run through a filter that would
|
||||
;; modify the output of dot or neato:
|
||||
;; dot -Tpng input.dot | filter
|
||||
;; drawback: ugly, extra work for user, extra decency ...
|
||||
;; no-option
|
||||
;; - modify dot and neato !!! (PP:15/02/2005 seems to have happend,
|
||||
;; so version 0.4.0 should clean this mess up!)
|
||||
(defun graphviz-dot-compilation-parse-errors (limit-search find-at-least)
|
||||
"Parse the current buffer for dot errors.
|
||||
See variable `compilation-parse-errors-functions' for interface."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(set-buffer "*compilation*")
|
||||
(goto-char (point-min))
|
||||
(setq compilation-error-list nil)
|
||||
(let (buffer-of-error)
|
||||
(while (not (eobp))
|
||||
(cond
|
||||
((looking-at "^dot\\( -[^ ]+\\)* \\(.*\\)")
|
||||
(setq buffer-of-error (find-file-noselect
|
||||
(buffer-substring-no-properties
|
||||
(nth 4 (match-data t))
|
||||
(nth 5 (match-data t))))))
|
||||
((looking-at ".*:.*line \\([0-9]+\\)")
|
||||
(let ((line-of-error
|
||||
(string-to-number (buffer-substring-no-properties
|
||||
(nth 2 (match-data t))
|
||||
(nth 3 (match-data t))))))
|
||||
(setq compilation-error-list
|
||||
(cons
|
||||
(cons
|
||||
(point-marker)
|
||||
(save-excursion
|
||||
(set-buffer buffer-of-error)
|
||||
(goto-line line-of-error)
|
||||
(beginning-of-line)
|
||||
(point-marker)))
|
||||
compilation-error-list))))
|
||||
(t t))
|
||||
(forward-line 1)) )))
|
||||
|
||||
;;;;
|
||||
;;;; Indentation
|
||||
;;;;
|
||||
(defun graphviz-dot-uncomment-region (begin end)
|
||||
"Uncomments a region of code."
|
||||
(interactive "r")
|
||||
(comment-region begin end '(4)))
|
||||
|
||||
(defun graphviz-dot-indent-line ()
|
||||
"Indent current line of dot code."
|
||||
(interactive)
|
||||
(if (bolp)
|
||||
(graphviz-dot-real-indent-line)
|
||||
(save-excursion
|
||||
(graphviz-dot-real-indent-line))))
|
||||
|
||||
(defun graphviz-dot-get-indendation()
|
||||
"Return current line's indentation"
|
||||
(interactive)
|
||||
(message "Current indentation is %d."
|
||||
(current-indentation))
|
||||
(current-indentation))
|
||||
|
||||
(defun graphviz-dot-real-indent-line ()
|
||||
"Indent current line of dot code."
|
||||
(beginning-of-line)
|
||||
(cond
|
||||
((bobp)
|
||||
;; simple case, indent to 0
|
||||
(indent-line-to 0))
|
||||
((looking-at "^[ \t]*}[ \t]*$")
|
||||
;; block closing, deindent relative to previous line
|
||||
(indent-line-to (save-excursion
|
||||
(forward-line -1)
|
||||
(max 0 (- (current-indentation) graphviz-dot-indent-width)))))
|
||||
;; other cases need to look at previous lines
|
||||
(t
|
||||
(indent-line-to (save-excursion
|
||||
(forward-line -1)
|
||||
(cond
|
||||
((looking-at "\\(^.*{[^}]*$\\)")
|
||||
;; previous line opened a block
|
||||
;; indent to that line
|
||||
(+ (current-indentation) graphviz-dot-indent-width))
|
||||
((and (not (looking-at ".*\\[.*\\].*"))
|
||||
(looking-at ".*\\[.*")) ; TODO:PP : can be 1 regex
|
||||
;; previous line started filling
|
||||
;; attributes, intend to that start
|
||||
(search-forward "[")
|
||||
(current-column))
|
||||
((and (not (looking-at ".*\\[.*\\].*"))
|
||||
(looking-at ".*\\].*")) ; TODO:PP : "
|
||||
;; previous line stopped filling
|
||||
;; attributes, find the line that started
|
||||
;; filling them and indent to that line
|
||||
(while (or (looking-at ".*\\[.*\\].*")
|
||||
(not (looking-at ".*\\[.*"))) ; TODO:PP : "
|
||||
(forward-line -1))
|
||||
(current-indentation))
|
||||
(t
|
||||
;; default case, indent the
|
||||
;; same as previous NON-BLANK line
|
||||
;; (or the first line, if there are no previous non-blank lines)
|
||||
(while (and (< (point-min) (point))
|
||||
(looking-at "^\[ \t\]*$"))
|
||||
(forward-line -1))
|
||||
(current-indentation)) ))) )))
|
||||
|
||||
(defun graphviz-dot-indent-graph ()
|
||||
"Indent the graph/digraph/subgraph where point is at.
|
||||
This will first teach the beginning of the graph were point is at, and
|
||||
then indent this and each subgraph in it."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
;; position point at start of graph
|
||||
(while (not (or (looking-at "\\(^.*{[^}]*$\\)") (bobp)))
|
||||
(forward-line -1))
|
||||
;; bracket { one +; bracket } one -
|
||||
(let ((bracket-count 0))
|
||||
(while
|
||||
(progn
|
||||
(cond
|
||||
;; update bracket-count
|
||||
((looking-at "\\(^.*{[^}]*$\\)")
|
||||
(setq bracket-count (+ bracket-count 1)))
|
||||
;; update bracket-count
|
||||
((looking-at "^[ \t]*}[ \t]*$")
|
||||
(setq bracket-count (- bracket-count 1))))
|
||||
;; indent this line and move on
|
||||
(graphviz-dot-indent-line)
|
||||
(forward-line 1)
|
||||
;; as long as we are not completed or at end of buffer
|
||||
(and (> bracket-count 0) (not (eobp))))))))
|
||||
|
||||
;;;;
|
||||
;;;; Electric indentation
|
||||
;;;;
|
||||
(defun graphviz-dot-comment-or-string-p ()
|
||||
(let ((state (parse-partial-sexp (point-min) (point))))
|
||||
(or (nth 4 state) (nth 3 state))))
|
||||
|
||||
(defun graphviz-dot-newline-and-indent ()
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(skip-chars-forward " \t")
|
||||
(graphviz-dot-indent-line))
|
||||
(delete-horizontal-space)
|
||||
(newline)
|
||||
(graphviz-dot-indent-line))
|
||||
|
||||
(defun electric-graphviz-dot-terminate-line ()
|
||||
"Terminate line and indent next line."
|
||||
(interactive)
|
||||
(if graphviz-dot-auto-indent-on-newline
|
||||
(graphviz-dot-newline-and-indent)
|
||||
(newline)))
|
||||
|
||||
(defun electric-graphviz-dot-open-brace ()
|
||||
"Terminate line and indent next line."
|
||||
(interactive)
|
||||
(insert "{")
|
||||
(if (and graphviz-dot-auto-indent-on-braces
|
||||
(not (graphviz-dot-comment-or-string-p)))
|
||||
(graphviz-dot-newline-and-indent)))
|
||||
|
||||
(defun electric-graphviz-dot-close-brace ()
|
||||
"Terminate line and indent next line."
|
||||
(interactive)
|
||||
(insert "}")
|
||||
(if (and graphviz-dot-auto-indent-on-braces
|
||||
(not (graphviz-dot-comment-or-string-p)))
|
||||
(progn
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(skip-chars-forward " \t")
|
||||
(graphviz-dot-indent-line))
|
||||
(newline)
|
||||
(graphviz-dot-indent-line))))
|
||||
|
||||
(defun electric-graphviz-dot-semi ()
|
||||
"Terminate line and indent next line."
|
||||
(interactive)
|
||||
(insert ";")
|
||||
(if (and graphviz-dot-auto-indent-on-semi
|
||||
(not (graphviz-dot-comment-or-string-p)))
|
||||
(graphviz-dot-newline-and-indent)))
|
||||
|
||||
;;;;
|
||||
;;;; Preview
|
||||
;;;;
|
||||
(defun graphviz-dot-preview ()
|
||||
"Shows an example of the current dot file in an emacs buffer.
|
||||
This assumes that we are running GNU Emacs or XEmacs under a windowing system.
|
||||
See `image-file-name-extensions' for customizing the files that can be
|
||||
loaded in GNU Emacs, and `image-formats-alist' for XEmacs."
|
||||
(interactive)
|
||||
;; unsafe to compile ourself, ask it to the user
|
||||
(if (buffer-modified-p)
|
||||
(message "Buffer needs to be compiled.")
|
||||
(if (string-match "XEmacs" emacs-version)
|
||||
;; things are easier in XEmacs...
|
||||
(find-file-other-window (concat (file-name-sans-extension
|
||||
buffer-file-name)
|
||||
"." graphviz-dot-preview-extension))
|
||||
;; run through all the extensions for images
|
||||
(let ((l image-file-name-extensions))
|
||||
(while
|
||||
(let ((f (concat (file-name-sans-extension (buffer-file-name))
|
||||
"."
|
||||
(car l))))
|
||||
;; see if a file matches, might be best also to check
|
||||
;; if file is up to date TODO:PP
|
||||
(if (file-exists-p f)
|
||||
(progn (auto-image-file-mode 1)
|
||||
;; OK, this is ugly, I would need to
|
||||
;; know how I can reload a file in an existing buffer
|
||||
(if (get-buffer "*preview*")
|
||||
(kill-buffer "*preview*"))
|
||||
(set-buffer (find-file-noselect f))
|
||||
(rename-buffer "*preview*")
|
||||
(display-buffer (get-buffer "*preview*"))
|
||||
;; stop iterating
|
||||
'())
|
||||
;; will stop iterating when l is nil
|
||||
(setq l (cdr l)))))
|
||||
;; each extension tested and nothing found, let user know
|
||||
(when (eq l '())
|
||||
(message "No image found."))))))
|
||||
|
||||
;;;;
|
||||
;;;; View
|
||||
;;;;
|
||||
(defun graphviz-dot-view ()
|
||||
"Runs an external viewer. This creates an external process every time it
|
||||
is executed. If `graphviz-dot-save-before-view' is set, the current
|
||||
buffer is saved before the command is executed."
|
||||
(interactive)
|
||||
(let ((cmd (if graphviz-dot-view-edit-command
|
||||
(if (string-match "XEmacs" emacs-version)
|
||||
(read-shell-command "View command: "
|
||||
(format graphviz-dot-view-command
|
||||
(buffer-file-name)))
|
||||
(read-from-minibuffer "View command: "
|
||||
(format graphviz-dot-view-command
|
||||
(buffer-file-name))))
|
||||
(format graphviz-dot-view-command (buffer-file-name)))))
|
||||
(if graphviz-dot-save-before-view
|
||||
(save-buffer))
|
||||
(setq novaproc (start-process-shell-command
|
||||
(downcase mode-name) nil cmd))
|
||||
(message (format "Executing `%s'..." cmd))))
|
||||
|
||||
;;;;
|
||||
;;;; Completion
|
||||
;;;;
|
||||
(defvar graphviz-dot-str nil)
|
||||
(defvar graphviz-dot-all nil)
|
||||
(defvar graphviz-dot-pred nil)
|
||||
(defvar graphviz-dot-buffer-to-use nil)
|
||||
(defvar graphviz-dot-flag nil)
|
||||
|
||||
(defun graphviz-dot-get-state ()
|
||||
"Returns the syntax state of the current point."
|
||||
(let ((state (parse-partial-sexp (point-min) (point))))
|
||||
(cond
|
||||
((nth 4 state) 'comment)
|
||||
((nth 3 state) 'string)
|
||||
((not (nth 1 state)) 'out)
|
||||
(t (save-excursion
|
||||
(skip-chars-backward "^[,=\\[]{};")
|
||||
(backward-char)
|
||||
(cond
|
||||
((looking-at "[\\[,]{};") 'attribute)
|
||||
((looking-at "=") (progn
|
||||
(backward-word 1)
|
||||
(if (looking-at "[a-zA-Z]*color")
|
||||
'color
|
||||
'value)))
|
||||
(t 'other)))))))
|
||||
|
||||
(defun graphviz-dot-get-keywords ()
|
||||
"Return possible completions for a word"
|
||||
(let ((state (graphviz-dot-get-state)))
|
||||
(cond
|
||||
((equal state 'comment) ())
|
||||
((equal state 'string) ())
|
||||
((equal state 'out) graphviz-attr-keywords)
|
||||
((equal state 'value) graphviz-value-keywords)
|
||||
((equal state 'color) graphviz-color-keywords)
|
||||
((equal state 'attribute) graphviz-attr-keywords)
|
||||
(t graphviz-attr-keywords))))
|
||||
|
||||
(defvar graphviz-dot-last-word-numb 0)
|
||||
(defvar graphviz-dot-last-word-shown nil)
|
||||
(defvar graphviz-dot-last-completions nil)
|
||||
|
||||
(defun graphviz-dot-complete-word ()
|
||||
"Complete word at current point."
|
||||
(interactive)
|
||||
(let* ((b (save-excursion (skip-chars-backward "a-zA-Z0-9_") (point)))
|
||||
(e (save-excursion (skip-chars-forward "a-zA-Z0-9_") (point)))
|
||||
(graphviz-dot-str (buffer-substring b e))
|
||||
(allcomp (if (and graphviz-dot-toggle-completions
|
||||
(string= graphviz-dot-last-word-shown
|
||||
graphviz-dot-str))
|
||||
graphviz-dot-last-completions
|
||||
(all-completions graphviz-dot-str
|
||||
(graphviz-dot-get-keywords))))
|
||||
(match (if graphviz-dot-toggle-completions
|
||||
"" (try-completion
|
||||
graphviz-dot-str (mapcar '(lambda (elm)
|
||||
(cons elm 0)) allcomp)))))
|
||||
;; Delete old string
|
||||
(delete-region b e)
|
||||
|
||||
;; Toggle-completions inserts whole labels
|
||||
(if graphviz-dot-toggle-completions
|
||||
(progn
|
||||
;; Update entry number in list
|
||||
(setq graphviz-dot-last-completions allcomp
|
||||
graphviz-dot-last-word-numb
|
||||
(if (>= graphviz-dot-last-word-numb (1- (length allcomp)))
|
||||
0
|
||||
(1+ graphviz-dot-last-word-numb)))
|
||||
(setq graphviz-dot-last-word-shown
|
||||
(elt allcomp graphviz-dot-last-word-numb))
|
||||
;; Display next match or same string if no match was found
|
||||
(if (not (null allcomp))
|
||||
(insert "" graphviz-dot-last-word-shown)
|
||||
(insert "" graphviz-dot-str)
|
||||
(message "(No match)")))
|
||||
;; The other form of completion does not necessarily do that.
|
||||
|
||||
;; Insert match if found, or the original string if no match
|
||||
(if (or (null match) (equal match 't))
|
||||
(progn (insert "" graphviz-dot-str)
|
||||
(message "(No match)"))
|
||||
(insert "" match))
|
||||
;; Give message about current status of completion
|
||||
(cond ((equal match 't)
|
||||
(if (not (null (cdr allcomp)))
|
||||
(message "(Complete but not unique)")
|
||||
(message "(Sole completion)")))
|
||||
;; Display buffer if the current completion didn't help
|
||||
;; on completing the label.
|
||||
((and (not (null (cdr allcomp))) (= (length graphviz-dot-str)
|
||||
(length match)))
|
||||
(with-output-to-temp-buffer "*Completions*"
|
||||
(display-completion-list allcomp))
|
||||
;; Wait for a keypress. Then delete *Completion* window
|
||||
(momentary-string-display "" (point))
|
||||
(if graphviz-dot-delete-completions
|
||||
(delete-window
|
||||
(get-buffer-window (get-buffer "*Completions*"))))
|
||||
)))))
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.dot\\'" . graphviz-dot-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.gv\\'" . graphviz-dot-mode))
|
||||
|
||||
;;; graphviz-dot-mode.el ends here
|
||||
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,417 +0,0 @@
|
|||
;;; lcars-theme.el --- A color theme
|
||||
|
||||
;; Copyright (C) 2011 Julien Danjou
|
||||
|
||||
;; Authors: Julien Danjou <julien@danjou.info>
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(deftheme lcars
|
||||
"LCARS theme.")
|
||||
|
||||
|
||||
;; We want the face to be created even if they do not exist.
|
||||
(put 'lcars 'theme-immediate t)
|
||||
|
||||
;; These colors are stolen from Tango.
|
||||
(setq lcars-colors
|
||||
'((((class color) (min-colors 65535))
|
||||
(lcars-1 . "#FF9900")
|
||||
(lcars-2 . "#CC99CC")
|
||||
(lcars-3 . "#9999CC")
|
||||
(lcars-4 . "#CC6666")
|
||||
(lcars-5 . "#FFCC99")
|
||||
(lcars-6 . "#9999FF")
|
||||
(lcars-7 . "#FF9966")
|
||||
(lcars-8 . "#CC6699")
|
||||
(lcars-background . "#000000")
|
||||
(lcars-border . "#666666")
|
||||
(lcars-selected . "#FFFFFF")
|
||||
(lcars-red . "#FF0000")
|
||||
(lcars-column-1 . "#666864")
|
||||
(lcars-column-2 . "#555753")
|
||||
(aluminium-1 . "#eeeeec")
|
||||
(aluminium-2 . "#d3d7cf")
|
||||
(aluminium-3 . "#babdb6")
|
||||
(aluminium-4 . "#888a85")
|
||||
(aluminium-5 . "#555753")
|
||||
(aluminium-6 . "#2e3436")
|
||||
(butter-1 . "#fce94f")
|
||||
(butter-2 . "#edd400")
|
||||
(butter-3 . "#c4a000")
|
||||
(orange-1 . "#fcaf3e")
|
||||
(orange-2 . "#f57900")
|
||||
(orange-3 . "#ce5c00")
|
||||
(chocolate-1 . "#e9b96e")
|
||||
(chocolate-2 . "#c17d11")
|
||||
(chocolate-3 . "#9f5902")
|
||||
(chameleon-1 . "#8ae234")
|
||||
(chameleon-2 . "#73d216")
|
||||
(chameleon-3 . "#4e9a06")
|
||||
(sky-blue-1 . "#729fcf")
|
||||
(sky-blue-2 . "#3465a4")
|
||||
(sky-blue-3 . "#204a87")
|
||||
(plum-1 . "#ad7fa8")
|
||||
(plum-2 . "#75507b")
|
||||
(plum-3 . "#5c3566")
|
||||
(scarlet-red-1 . "#ef2929")
|
||||
(scarlet-red-2 . "#cc0000")
|
||||
(scarlet-red-3 . "#a40000")
|
||||
(background . "#252A2B")
|
||||
(black . "#0c191C")
|
||||
(gradient-1 . "#729fcf") ;; sky-blue-1
|
||||
(gradient-2 . "#8ae234") ;; chameleon-1
|
||||
(gradient-3 . "#fce94f") ;; butter-1
|
||||
(gradient-4 . "#ad7fa8") ;; plum-1
|
||||
(gradient-5 . "#e9b96e") ;; chocolate-1
|
||||
(gradient-6 . "#fcaf3e") ;; orange-1
|
||||
(gradient-7 . "#3465a4") ;; sky-blue-2
|
||||
(gradient-8 . "#73d216") ;; chameleon-2
|
||||
(gradient-9 . "#f57900") ;; orange-2
|
||||
(gradient-10 . "#75507b") ;; plum-2
|
||||
(gradient-11 . "#c17d11") ;; chocolate-2
|
||||
)
|
||||
(t
|
||||
(aluminium-1 . "color-255")
|
||||
(aluminium-2 . "color-253")
|
||||
(aluminium-3 . "color-251")
|
||||
(aluminium-4 . "color-245")
|
||||
(aluminium-5 . "color-240")
|
||||
(aluminium-6 . "color-235")
|
||||
(butter-1 . "color-221")
|
||||
(butter-2 . "color-220")
|
||||
(butter-3 . "color-178")
|
||||
(orange-1 . "color-214")
|
||||
(orange-2 . "color-208")
|
||||
(orange-3 . "color-130")
|
||||
(chocolate-1 . "color-180")
|
||||
(chocolate-2 . "color-172")
|
||||
(chocolate-3 . "color-94")
|
||||
(chameleon-1 . "color-82")
|
||||
(chameleon-2 . "color-76")
|
||||
(chameleon-3 . "color-34")
|
||||
(sky-blue-1 . "color-117")
|
||||
(sky-blue-2 . "color-63")
|
||||
(sky-blue-3 . "color-24")
|
||||
(plum-1 . "color-176")
|
||||
(plum-2 . "color-96")
|
||||
(plum-3 . "color-54")
|
||||
(scarlet-red-1 . "color-196")
|
||||
(scarlet-red-2 . "color-160")
|
||||
(scarlet-red-3 . "color-124")
|
||||
(background . "color-234")
|
||||
(black . "color-16")
|
||||
(gradient-1 . "color-117") ;; sky-blue-1
|
||||
(gradient-2 . "color-82") ;; chameleon-1
|
||||
(gradient-3 . "color-221") ;; butter-1
|
||||
(gradient-4 . "color-176") ;; plum-1
|
||||
(gradient-5 . "color-180") ;; chocolate-1
|
||||
(gradient-6 . "color-214") ;; orange-1
|
||||
(gradient-7 . "color-63") ;; sky-blue-2
|
||||
(gradient-8 . "color-76") ;; chameleon-2
|
||||
(gradient-9 . "color-208") ;; orange-2
|
||||
(gradient-10 . "color-96") ;; plum-2
|
||||
(gradient-11 . "color-172") ;; chocolate-2
|
||||
)))
|
||||
; "The color values for each color name for a given
|
||||
; condition. The format is: ((condition) (key . value) (key
|
||||
; . value) ...)")
|
||||
|
||||
(defun lcars-get-colors (name)
|
||||
(cdr
|
||||
(assoc
|
||||
name
|
||||
(car lcars-colors))))
|
||||
|
||||
(setq ansi-term-color-vector
|
||||
`[unspecified ,(lcars-get-colors 'black)
|
||||
,(lcars-get-colors 'scarlet-red-1)
|
||||
,(lcars-get-colors 'chameleon-1)
|
||||
,(lcars-get-colors 'butter-1)
|
||||
,(lcars-get-colors 'sky-blue-1)
|
||||
,(lcars-get-colors 'plum-1)
|
||||
"cyan3"
|
||||
,(lcars-get-colors 'aluminium-1)])
|
||||
|
||||
(defun lcars-simple-face-to-multiple (face)
|
||||
(let ((spec (car face))
|
||||
(lst (cadr face)))
|
||||
(list spec (mapcar
|
||||
'(lambda (entry)
|
||||
(let ((color-condition (car entry)))
|
||||
(list color-condition
|
||||
(lcars-color-list-expand (cdr entry) lst))))
|
||||
lcars-colors))))
|
||||
|
||||
(defun lcars-color-list-expand (color-alist lst)
|
||||
(let ((result '()))
|
||||
(while (car lst)
|
||||
(let ((key (car lst))
|
||||
(val (cadr lst)))
|
||||
(if (memq key '(:foreground :background :color))
|
||||
(setq val (or (cdr (assq val color-alist)) val)))
|
||||
(if (listp val)
|
||||
(setq val (lcars-color-list-expand entry val)))
|
||||
(setq result (append result `(,key ,val))))
|
||||
(setq lst (cddr lst)))
|
||||
result))
|
||||
|
||||
(defun lcars-theme-set-faces (theme &rest args)
|
||||
(apply 'custom-theme-set-faces
|
||||
(append (list theme)
|
||||
(mapcar 'lcars-simple-face-to-multiple args))))
|
||||
|
||||
(lcars-theme-set-faces
|
||||
'lcars
|
||||
'(default (:background lcars-background :foreground lcars-1))
|
||||
'(shadow (:foreground lcars-border))
|
||||
'(secondary-selection (:background lcars-red))
|
||||
'(cursor (:background lcars-1))
|
||||
'(hl-line (:foreground lcars-selected))
|
||||
'(highlight (:foreground lcars-selected))
|
||||
'(fringe (:background lcars-background))
|
||||
'(mode-line (:foreground lcars-1 :background lcars-background
|
||||
:box (:line-width 1 :color lcars-border)))
|
||||
'(mode-line-inactive (:foreground lcars-1 :background lcars-background
|
||||
:box nil))
|
||||
'(mode-line-buffer-id (:bold t :foreground lcars-2))
|
||||
'(header-line (:foreground lcars-1 :background lcars-background
|
||||
:box (:line-width 1 :color lcars-border)))
|
||||
'(region (:background lcars-border))
|
||||
'(link (:foreground lcars-2))
|
||||
'(link-visited (:inherit 'link :foreground lcars-4))
|
||||
'(match (:bold t :foreground lcars-selected))
|
||||
'(tooltip (:inherit 'variable-pitch :foreground aluminium-1 :background black))
|
||||
'(bold (:bold t))
|
||||
'(italic (:italic t))
|
||||
|
||||
'(font-lock-builtin-face (:foreground lcars-6))
|
||||
'(font-lock-keyword-face (:inherit 'font-lock-builtin-face :bold t))
|
||||
'(font-lock-comment-face (:inherit 'shadow :italic t))
|
||||
'(font-lock-comment-delimiter-face (:inherit 'font-lock-comment-face))
|
||||
'(font-lock-constant-face (:foreground lcars-4))
|
||||
'(font-lock-type-face (:inherit 'font-lock-constant-face :bold t))
|
||||
'(font-lock-doc-face (:inherit 'shadow))
|
||||
'(font-lock-string-face (:foreground lcars-3))
|
||||
'(font-lock-variable-name-face (:foreground lcars-8))
|
||||
'(font-lock-warning-face (:bold t :foreground lcars-red))
|
||||
'(font-lock-function-name-face (:foreground lcars-2 :bold t))
|
||||
|
||||
'(comint-highlight-prompt ())
|
||||
|
||||
'(isearch (:background orange-3 :foreground background))
|
||||
'(isearch-fail (:background scarlet-red-2))
|
||||
'(lazy-highlight (:background chocolate-1 :foreground background))
|
||||
|
||||
'(show-paren-match-face (:background chameleon-3))
|
||||
'(show-paren-mismatch-face (:background plum-3))
|
||||
|
||||
'(minibuffer-prompt (:foreground sky-blue-1 :bold t))
|
||||
|
||||
;; '(widget-mouse-face ((t (:bold t :foreground aluminium-1 :background scarlet-red-2))))
|
||||
;; '(widget-field ((t (:foreground orange-1 :background "gray30"))))
|
||||
;; '(widget-single-line-field ((t (:foreground orange-1 :background "gray30"))))
|
||||
|
||||
'(custom-group-tag (:bold t :foreground orange-2 :height 1.3))
|
||||
'(custom-variable-tag (:bold t :foreground butter-2 :height 1.1))
|
||||
'(custom-face-tag (:bold t :foreground butter-2 :height 1.1))
|
||||
'(custom-state (:foreground sky-blue-1))
|
||||
;; '(custom-button ((t :background "gray50" :foreground black
|
||||
;; :box (:line-width 1 :style released-button))))
|
||||
;; '(custom-variable-button ((t (:inherit 'custom-button))))
|
||||
;; '(custom-button-mouse ((t (:inherit 'custom-button :background "gray60"))))
|
||||
;; '(custom-button-unraised ((t (:background "gray50" :foreground "black"))))
|
||||
;; '(custom-button-mouse-unraised ((t (:inherit 'custom-button-unraised :background "gray60"))))
|
||||
;; '(custom-button-pressed ((t (:inherit 'custom-button :box (:style pressed-button)))))
|
||||
;; '(custom-button-mouse-pressed-unraised ((t (:inherit 'custom-button-unraised :background "gray60"))))
|
||||
'(custom-documentation (:inherit 'font-lock-comment-face))
|
||||
|
||||
'(gnus-cite-1 (:foreground gradient-1))
|
||||
'(gnus-cite-2 (:foreground gradient-2))
|
||||
'(gnus-cite-3 (:foreground gradient-3))
|
||||
'(gnus-cite-4 (:foreground gradient-4))
|
||||
'(gnus-cite-5 (:foreground gradient-5))
|
||||
'(gnus-cite-6 (:foreground gradient-6))
|
||||
'(gnus-cite-7 (:foreground gradient-7))
|
||||
'(gnus-cite-8 (:foreground gradient-8))
|
||||
'(gnus-cite-9 (:foreground gradient-9))
|
||||
'(gnus-cite-10 (:foreground gradient-10))
|
||||
'(gnus-cite-11 (:foreground gradient-11))
|
||||
'(gnus-header-name (:bold t :foreground sky-blue-1))
|
||||
'(gnus-header-from (:bold t))
|
||||
'(gnus-header-to (:bold t :foreground aluminium-2))
|
||||
'(gnus-header-subject ())
|
||||
'(gnus-header-content (:italic t :foreground aluminium-2))
|
||||
'(gnus-header-newsgroups (:inherit 'gnus-header-to))
|
||||
'(gnus-signature (:italic t :foreground aluminium-3))
|
||||
'(gnus-summary-cancelled (:background black :foreground butter-1))
|
||||
'(gnus-summary-normal-ancient (:foreground chameleon-3))
|
||||
'(gnus-summary-normal-read (:foreground chameleon-1))
|
||||
'(gnus-summary-normal-ticked (:foreground scarlet-red-1))
|
||||
'(gnus-summary-normal-unread (:foreground aluminium-1))
|
||||
'(gnus-summary-high-ancient (:inherit 'gnus-summary-normal-ancient))
|
||||
'(gnus-summary-high-read (:inherit 'gnus-summary-normal-read))
|
||||
'(gnus-summary-high-ticked (:inherit 'gnus-summary-normal-ticked))
|
||||
'(gnus-summary-high-unread (:inherit 'gnus-summary-normal-unread))
|
||||
'(gnus-summary-low-ancient (:inherit 'gnus-summary-normal-ancient :italic t))
|
||||
'(gnus-summary-low-read (:inherit 'gnus-summary-normal-read :italic t))
|
||||
'(gnus-summary-low-ticked (:inherit 'gnus-summary-normal-ticked :italic t))
|
||||
'(gnus-summary-low-unread (:inherit 'gnus-summary-normal-unread :italic t))
|
||||
'(gnus-summary-selected (:background sky-blue-3 :foreground aluminium-1))
|
||||
'(gnus-button (:bold t :foreground aluminium-2))
|
||||
'(spam (:background black :foreground orange-2))
|
||||
|
||||
'(message-header-newsgroups (:inherit gnus-header-newsgroups))
|
||||
'(message-header-name (:inherit 'gnus-header-name))
|
||||
'(message-header-to (:inherit gnus-header-to))
|
||||
'(message-header-other (:inherit gnus-header-content))
|
||||
'(message-header-subject (:inherit 'gnus-header-subject))
|
||||
'(message-header-cc (:foreground aluminium-2))
|
||||
'(message-header-xheader (:foreground aluminium-4))
|
||||
'(message-separator (:foreground sky-blue-3))
|
||||
'(message-mml (:foreground chameleon-1))
|
||||
|
||||
;; org-mode
|
||||
'(org-level-1 (:bold t :foreground lcars-1 :height 1.3))
|
||||
'(org-level-2 (:bold t :foreground lcars-2 :height 1.2))
|
||||
'(org-level-3 (:bold t :foreground lcars-3 :height 1.1))
|
||||
'(org-level-4 (:bold t :foreground lcars-4))
|
||||
'(org-level-5 (:bold t :foreground lcars-5))
|
||||
'(org-level-6 (:bold t :foreground lcars-6))
|
||||
'(org-level-7 (:bold t :foreground lcars-7))
|
||||
'(org-level-8 (:bold t :foreground lcars-8))
|
||||
|
||||
'(org-mode-line-clock ())
|
||||
'(org-mode-line-clock-overrun (:foreground scarlet-red-1))
|
||||
'(org-document-title (:bold t :foreground sky-blue-1 :height 1.4))
|
||||
'(org-document-info (:foreground sky-blue-1 :italic t))
|
||||
'(org-todo (:bold t :foreground scarlet-red-2))
|
||||
'(org-done (:bold t :foreground chameleon-3))
|
||||
'(org-hide (:foreground background))
|
||||
'(org-scheduled (:foreground chameleon-2))
|
||||
'(org-scheduled-previously (:foreground orange-2))
|
||||
'(org-scheduled-today (:foreground chameleon-1))
|
||||
'(org-date (:foreground chocolate-1))
|
||||
'(org-special-keyword (:foreground scarlet-red-1 :bold t))
|
||||
'(org-agenda-done ())
|
||||
'(org-time-grid (:inherit 'shadow))
|
||||
'(org-agenda-date (:foreground butter-1 :height 1.2))
|
||||
'(org-agenda-date-today (:inherit 'org-agenda-date :foreground butter-2 :weight bold :height 1.3))
|
||||
'(org-agenda-date-tc (:inherit 'org-agenda-date :foreground butter-3))
|
||||
'(org-agenda-date-weekend (:inherit 'org-agenda-date :foreground scarlet-red-1 :weight bold))
|
||||
|
||||
'(org-habit-clear-future-face (:background sky-blue-3))
|
||||
'(org-habit-clear-face (:background sky-blue-2))
|
||||
'(org-habit-ready-future-face (:background chameleon-3))
|
||||
'(org-habit-ready-face (:background chameleon-2 :foreground black))
|
||||
'(org-habit-alert-ready-future-face (:background orange-3))
|
||||
'(org-habit-overdue-face (:background scarlet-red-3))
|
||||
'(org-habit-overdue-future-face (:background scarlet-red-3))
|
||||
|
||||
;; egocentric-mode
|
||||
'(egocentric-face (:foreground scarlet-red-1 :weight bold))
|
||||
|
||||
;; erc
|
||||
'(erc-direct-msg-face (:inherit 'egocentric-face))
|
||||
'(erc-header-line (:inherit 'header-line))
|
||||
'(erc-input-face (:inherit 'shadow))
|
||||
'(erc-my-nick-face (:inherit 'egocentric-face))
|
||||
'(erc-notice-face (:foreground sky-blue-1))
|
||||
'(erc-prompt-face (:background black :foreground aluminium-1 :weight bold))
|
||||
'(erc-timestamp-face (:foreground aluminium-2 :weight bold))
|
||||
'(erc-pal-face (:foreground chameleon-1 :weight bold))
|
||||
'(erc-keyword-face (:foreground orange-1))
|
||||
'(erc-fool-face (:inherit 'shadow))
|
||||
'(erc-current-nick-face (:inherit 'egocentric-face))
|
||||
|
||||
'(which-func (:foreground sky-blue-1))
|
||||
|
||||
'(dired-directory (:foreground sky-blue-1))
|
||||
'(dired-symlink (:bold t :foreground "cyan"))
|
||||
'(dired-marked (:bold t :foreground butter-1))
|
||||
|
||||
'(mm-uu-extract (:background aluminium-6))
|
||||
|
||||
;; diff-mode
|
||||
'(diff-added (:foreground chameleon-2))
|
||||
'(diff-changed (:foreground orange-1))
|
||||
'(diff-removed (:foreground scarlet-red-1))
|
||||
'(diff-hunk-header (:bold t))
|
||||
'(diff-function (:foreground orange-1))
|
||||
'(diff-header (:background aluminium-6))
|
||||
'(diff-file-header (:foreground aluminium-1))
|
||||
|
||||
;; magit
|
||||
'(magit-diff-add (:inherit diff-added))
|
||||
'(magit-diff-del (:inherit diff-removed))
|
||||
'(magit-diff-none (:inherit diff-context))
|
||||
'(magit-diff-hunk-header (:inherit (magit-header diff-hunk-header)))
|
||||
'(magit-diff-file-header (:inherit (magit-header diff-file-header)))
|
||||
'(magit-log-sha1 (:foreground scarlet-red-1))
|
||||
'(magit-log-graph (:foreground aluminium-2))
|
||||
'(magit-item-highlight (:background aluminium-6))
|
||||
'(magit-item-mark (:foreground orange-1))
|
||||
'(magit-log-tag-label (:background chameleon-3 :box t :foreground aluminium-6))
|
||||
'(magit-log-head-label-bisect-good (:background chameleon-2 :box t))
|
||||
'(magit-log-head-label-bisect-bad (:background scarlet-red-3 :box t))
|
||||
'(magit-log-head-label-remote (:foreground aluminium-6 :background butter-2 :box (:color butter-3)))
|
||||
'(magit-log-head-label-tags (:inherit (magit-log-tag-label)))
|
||||
'(magit-log-head-label-local (:foreground aluminium-1 :background sky-blue-2
|
||||
:box (:color sky-blue-3)))
|
||||
|
||||
|
||||
;; git-commit-mode
|
||||
'(git-commit-summary-face (:bold t))
|
||||
'(git-commit-branch-face (:foreground orange-2 :bold t))
|
||||
'(git-commit-nonempty-second-line-face ((:foreground scarlet-red-2)))
|
||||
'(git-commit-comment-face (:inherit font-lock-comment-face))
|
||||
'(git-commit-known-pseudo-header-face (:inherit gnus-header-name-face))
|
||||
'(git-commit-pseudo-header-face (:inherit gnus-header-content))
|
||||
|
||||
;; makefile-mode
|
||||
'(makefile-space (:background plum-3))
|
||||
|
||||
;; rainbow-delimiters
|
||||
'(rainbow-delimiters-depth-1-face (:foreground lcars-8))
|
||||
'(rainbow-delimiters-depth-2-face (:foreground lcars-7))
|
||||
'(rainbow-delimiters-depth-3-face (:foreground lcars-6))
|
||||
'(rainbow-delimiters-depth-4-face (:foreground lcars-5))
|
||||
'(rainbow-delimiters-depth-5-face (:foreground lcars-4))
|
||||
'(rainbow-delimiters-depth-6-face (:foreground lcars-3))
|
||||
'(rainbow-delimiters-depth-7-face (:foreground lcars-2))
|
||||
'(rainbow-delimiters-depth-8-face (:foreground lcars-1))
|
||||
|
||||
;; rst-mode
|
||||
'(rst-level-1-face (:foreground gradient-1 :height 1.3))
|
||||
'(rst-level-2-face (:foreground gradient-2 :height 1.2))
|
||||
'(rst-level-3-face (:foreground gradient-3 :height 1.1))
|
||||
'(rst-level-4-face (:foreground gradient-4))
|
||||
'(rst-level-5-face (:foreground gradient-5))
|
||||
'(rst-level-6-face (:foreground gradient-6))
|
||||
|
||||
;; column-marker
|
||||
'(column-marker-1 (:background lcars-column-1))
|
||||
'(column-marker-2 (:background lcars-column-2)))
|
||||
|
||||
(provide-theme 'lcars)
|
||||
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; End:
|
||||
|
||||
;;; lcars-theme.el ends here
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 3e2f122e4efd06a17987e75e0e82cde1406040fa
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 1586fbbb0886c55d1461acd1ee96854b8f20b805
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 0fd92f979a6f987e1080faa65681b8e54735a906
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 779b40f39dd3a0914bafa363ed4d6c14c7596718
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,9 +0,0 @@
|
|||
(define-generic-mode 'xmodmap-mode
|
||||
'(?!)
|
||||
'("add" "clear" "keycode" "keysym" "pointer" "remove")
|
||||
nil
|
||||
'("[xX]modmap\\(rc\\)?\\'")
|
||||
nil
|
||||
"Simple mode for xmodmap files.")
|
||||
|
||||
(provide 'xmodmap-mode)
|
|
@ -1,60 +0,0 @@
|
|||
(setq gnus-select-method '(nntp "news.eternal-september.org"))
|
||||
(setq gnus-secondary-select-methods
|
||||
'((nnmaildir "gmail"
|
||||
(directory "~/documents/mail/gmail/"))
|
||||
(nnmaildir "arch"
|
||||
(directory "~/documents/mail/arch/"))
|
||||
(nnmaildir "aethon"
|
||||
(directory "~/documents/mail/aethon/"))
|
||||
(nntp "news.gmane.org")
|
||||
(nnrss "")))
|
||||
|
||||
(setq gnus-auto-subscribed-groups nil)
|
||||
(setq gnus-save-newsrc-file nil)
|
||||
(setq gnus-read-newsrc-file nil)
|
||||
(setq gnus-novice-user t)
|
||||
(setq gnus-article-truncate-lines nil)
|
||||
|
||||
(setq gnus-parameters
|
||||
'(("gmail"
|
||||
(display . all))
|
||||
("aethon"
|
||||
(display . all)
|
||||
("arch"
|
||||
(display . all)))))
|
||||
|
||||
(setq gnus-permanently-visible-groups
|
||||
"\\(gmail\\|aethon\\|arch\\):INBOX")
|
||||
|
||||
(setq nntp-marks-is-evil t)
|
||||
|
||||
(setq gnus-check-new-newsgroups nil)
|
||||
|
||||
(setq gnus-posting-styles
|
||||
'((".*" (address "ryuslash@gmail.com"))
|
||||
("arch:" (address "tom.willemsen@archlinux.us"))
|
||||
("aethon:"
|
||||
(address "thomas@aethon.nl")
|
||||
(signature-file "~/documents/work/aethon/signature.txt"))))
|
||||
|
||||
(setq user-mail-address "ryuslash@gmail.com")
|
||||
(setq user-full-name "Tom Willemsen")
|
||||
|
||||
(load "tls")
|
||||
|
||||
(setq send-mail-function 'smtpmail-send-it
|
||||
message-send-mail-function 'message-smtpmail-send-it
|
||||
starttls-use-gnutls t
|
||||
smtpmail-gnutls-credentials '(("smtp.gmail.com" 587 "ryuslash@gmail.com" nil))
|
||||
smtpmail-starttls-credentials '(("smtp.gmail.com" 587 "ryuslash@gmail.com" nil))
|
||||
smtpmail-smtp-server "smtp.gmail.com"
|
||||
smtpmail-smtp-service 587
|
||||
smtpmail-debug-info t
|
||||
smtpmail-default-smtp-server "smtp.gmail.com")
|
||||
|
||||
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
|
||||
|
||||
;;; BBDB
|
||||
(require 'bbdb)
|
||||
(bbdb-initialize 'gnus 'message)
|
||||
(bbdb-insinuate-gnus)
|
503
.emacs.d/init.el
503
.emacs.d/init.el
|
@ -1,503 +0,0 @@
|
|||
;; -*- mode: Emacs-Lisp; -*-
|
||||
(let ((default-directory "~/.emacs.d/"))
|
||||
(normal-top-level-add-subdirs-to-load-path))
|
||||
|
||||
;;-----[ Defun ]---------------------------------------------------------
|
||||
(defun ext/what-face (pos)
|
||||
"Find out which face the current position uses"
|
||||
(interactive "d")
|
||||
(let ((face (or (get-char-property (point) 'read-face-name)
|
||||
(get-char-property (point) 'face))))
|
||||
(if face
|
||||
(message "Face: %s" face)
|
||||
(message "No face at %d" pos))))
|
||||
|
||||
(defun ext/what-major-mode (buffer-or-string)
|
||||
"Find out which major-mode is currently used"
|
||||
(with-current-buffer buffer-or-string major-mode))
|
||||
|
||||
(defun ext/my-comp-finish-function (buf str)
|
||||
"Don't show compilation window if everything went ok"
|
||||
(if (string-match "exited abnormally" str)
|
||||
;; there were errors
|
||||
(message "compilation errors, press C-x ` to visit")
|
||||
;; no errors, make the compilation window go away in 0.5 seconds
|
||||
(run-at-time 0.5 nil 'delete-windows-on buf)
|
||||
(message "NO COMPILATION ERRORS!")))
|
||||
|
||||
(defun ext/pretty-lambdas ()
|
||||
(font-lock-add-keywords
|
||||
nil `(("(\\(lambda\\>\\)"
|
||||
(0 (progn
|
||||
(compose-region (match-beginning 1)
|
||||
(match-end 1)
|
||||
?λ)))))))
|
||||
|
||||
(defun ext/x-urgency-hint (frame arg &optional source)
|
||||
(let* ((wm-hints (append (x-window-property
|
||||
"WM_HINTS" frame "WM_HINTS"
|
||||
(if source
|
||||
source
|
||||
(string-to-number
|
||||
(frame-parameter frame 'outer-window-id)))
|
||||
nil t) nil))
|
||||
(flags (car wm-hints)))
|
||||
(setcar wm-hints
|
||||
(if arg
|
||||
(logior flags #x00000100)
|
||||
(logand flags #xFFFFFEFF)))
|
||||
(x-change-window-property "WM_HINTS" wm-hints frame "WM_HINTS" 32 t)))
|
||||
|
||||
(defun oni/c-toggle-header-source ()
|
||||
"Toggle between a C source and header file"
|
||||
(interactive)
|
||||
(let ((ext (file-name-extension (buffer-file-name)))
|
||||
(noext (file-name-sans-extension (buffer-file-name))))
|
||||
(if (string= (substring ext 0 1) "c")
|
||||
(find-file (concat noext ".h"))
|
||||
(find-file (concat noext ".c")))))
|
||||
|
||||
(defun oni/init-show-outline ()
|
||||
(interactive)
|
||||
(occur ";;-----\\[ .* \\]-+")
|
||||
(other-window 1))
|
||||
|
||||
(defun oni/replace-occurrences (from to)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(while (search-forward from nil t)
|
||||
(replace-match to))))
|
||||
|
||||
(defun oni/replace-html-special-chars ()
|
||||
(oni/replace-occurrences "é" "é"))
|
||||
|
||||
(defun oni/before-save-hook ()
|
||||
(if (eq (ext/what-major-mode (current-buffer)) 'html-mode)
|
||||
(oni/replace-html-special-chars))
|
||||
(if (not (eq (ext/what-major-mode (current-buffer)) 'markdown-mode))
|
||||
(delete-trailing-whitespace)))
|
||||
|
||||
(defun oni/after-save-hook ()
|
||||
(let* ((fname (buffer-file-name))
|
||||
(suffix (file-name-extension fname)))
|
||||
(if (string-equal suffix "el")
|
||||
(byte-compile-file fname))))
|
||||
|
||||
;;-----[ Theme ]---------------------------------------------------------
|
||||
(require 'naquadah-theme)
|
||||
(eval-after-load 'naquadah-theme
|
||||
(naquadah-theme-set-faces
|
||||
'naquadah
|
||||
|
||||
;; markdown-mode
|
||||
'(markdown-link-face (:inherit 'link))
|
||||
'(markdown-header-face-1 (:inherit 'org-level-1))
|
||||
'(markdown-header-face-2 (:inherit 'org-level-2))
|
||||
'(markdown-header-face-3 (:inherit 'org-level-3))
|
||||
'(markdown-header-face-4 (:inherit 'org-level-4))
|
||||
'(markdown-header-face-5 (:inherit 'org-level-5))
|
||||
'(markdown-header-face-6 (:inherit 'org-level-6))
|
||||
|
||||
'(ac-candidate-face (:inherit 'header-line :box nil))
|
||||
'(ac-selection-face (:inherit 'hl-line :box nil))))
|
||||
|
||||
;;-----[ Autopair ]------------------------------------------------------
|
||||
(require 'autopair)
|
||||
(autopair-global-mode t) ; automatically add the other delimiter
|
||||
(setq autopair-skip-criteria 'always
|
||||
autopair-autowrap t
|
||||
autopair-blink nil)
|
||||
(setq-default autopair-dont-pair '(:string (?\' ?\") :comment (?\')))
|
||||
|
||||
;;-----[ Column marker ]-------------------------------------------------
|
||||
(require 'column-marker)
|
||||
|
||||
(defun set-column-markers (cm1 cm2)
|
||||
(column-marker-1 cm1)
|
||||
(column-marker-2 cm2))
|
||||
|
||||
;;-----[ Prog mode ]-----------------------------------------------------
|
||||
(defconst integer-regex-1
|
||||
(eval-when-compile
|
||||
(concat "\\b\\(0[xX][0-9a-fA-F]+[lL]?\\|[0-9]+\\.?[0-9]*\\([eE][-+]?"
|
||||
"[0-9]+\\)?\\([lL]\\|[fF]\\|[dD]\\)?\\)\\b")))
|
||||
|
||||
(defconst integer-regex-2
|
||||
(eval-when-compile
|
||||
(concat "\\b\\(\\.[0-9]+\\([eE][-+]?[0-9]+\\)?\\([lL]\\|[fF]\\|[dD]"
|
||||
"\\)?\\)\\b")))
|
||||
|
||||
(defun oni/prog-mode-hook ()
|
||||
(font-lock-add-keywords
|
||||
nil
|
||||
`((,integer-regex-1 0 font-lock-constant-face)
|
||||
(,integer-regex-2 0 font-lock-constant-face)))
|
||||
(ext/pretty-lambdas)
|
||||
(set-column-markers 73 81))
|
||||
|
||||
(if (>= emacs-major-version 24)
|
||||
(add-hook 'prog-mode-hook 'oni/prog-mode-hook)
|
||||
(add-hook 'c-mode-common-hook 'oni/prog-mode-hook)
|
||||
(add-hook 'go-mode-hook 'oni/prog-mode-hook)
|
||||
(add-hook 'emacs-lisp-mode-hook 'oni/prog-mode-hook))
|
||||
|
||||
;;-----[ HTML mode ]-----------------------------------------------------
|
||||
(defun oni/html-mode-hook ()
|
||||
(set-column-markers 73 81)
|
||||
(setq fill-column 73))
|
||||
|
||||
(eval-after-load "sgml-mode"
|
||||
(progn
|
||||
(font-lock-add-keywords
|
||||
'html-mode
|
||||
'(("{\\(\\*.*\\*\\)}" 1 font-comment-face)
|
||||
("{\\/?\\(extends\\|block\\|foreach\\(else\\)?\\|if\\|else\\)"
|
||||
1 font-lock-builtin-face)
|
||||
("\\$\\(\\(?:\\sw\\|\\s_\\)+\\)\\(?:|\\(\\(?:\\sw\\|\\s_\\)+\\):\\)"
|
||||
(1 font-lock-variable-name-face)
|
||||
(2 font-lock-function-name-face))
|
||||
("\\$\\(\\(?:\\sw\\|\\s_\\)+\\)"
|
||||
1 font-lock-variable-name-face)
|
||||
("{\\(\\(?:\\sw\\|\\s_\\)+\\).*}"
|
||||
1 font-lock-function-name-face)))))
|
||||
|
||||
(add-hook 'html-mode-hook 'oni/html-mode-hook)
|
||||
(add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode))
|
||||
|
||||
;;-----[ Org mode ]------------------------------------------------------
|
||||
(require 'org-crypt)
|
||||
(require 'org-publish)
|
||||
|
||||
(defun oni/org-mode-hook ()
|
||||
(turn-on-flyspell)
|
||||
(turn-on-auto-fill))
|
||||
|
||||
(setq
|
||||
org-tags-exclude-from-inheritance '("crypt")
|
||||
org-crypt-key "33E8CC1CC4"
|
||||
org-use-fast-todo-selection t
|
||||
org-default-notes-file (concat org-directory
|
||||
"/notes.org")
|
||||
org-outline-path-complete-in-steps t
|
||||
org-return-follows-link t
|
||||
org-log-into-drawer t
|
||||
org-todo-keywords '((sequence "TODO(t)"
|
||||
"IN PROGRESS(p)"
|
||||
"WAITING(w@/!)"
|
||||
"|"
|
||||
"DONE(d!/!)"
|
||||
"CANCELLED(c@/!)"))
|
||||
org-refile-targets '((org-agenda-files :maxlevel . 5)
|
||||
(nil :maxlevel . 5))
|
||||
org-todo-keyword-faces
|
||||
'(("TODO" :foreground "red" :weight bold)
|
||||
("IN PROGRESS" :foreground "yellow" :weight bold)
|
||||
("DONE" :foreground "forest green" :weight bold)
|
||||
("WAITING" :foreground "orange" :weight bold)
|
||||
("CANCELLED" :foreground "orangered" :weight bold)))
|
||||
(add-to-list 'auto-mode-alist '("\\.commitmsg$" . org-mode))
|
||||
(global-set-key "\C-cl" 'org-store-link)
|
||||
(global-set-key "\C-cc" 'org-capture)
|
||||
(global-set-key "\C-ca" 'org-agenda)
|
||||
(add-hook 'org-mode-hook 'oni/org-mode-hook)
|
||||
(org-crypt-use-before-save-magic)
|
||||
|
||||
;;-----[ Rainbow delimiters ]--------------------------------------------
|
||||
(require 'rainbow-delimiters)
|
||||
(setq rainbow-delimiters-max-face-count 8)
|
||||
(global-rainbow-delimiters-mode)
|
||||
|
||||
;;-----[ Uniquify ]------------------------------------------------------
|
||||
(require 'uniquify)
|
||||
(setq uniquify-buffer-name-style 'post-forward)
|
||||
|
||||
;;-----[ Go mode ]-------------------------------------------------------
|
||||
(defun oni/go-mode-hook ()
|
||||
(turn-off-auto-fill))
|
||||
|
||||
(autoload 'go-mode "go-mode" "Major mode for google go" t)
|
||||
(autoload 'gofmt "go-mode" "" t)
|
||||
(autoload 'go-fmt-before-save "go-mode" "" t)
|
||||
(add-to-list 'auto-mode-alist '("\\.go$" . go-mode))
|
||||
(add-hook 'go-mode-hook 'oni/go-mode-hook)
|
||||
|
||||
;;-----[ Htmlize ]-------------------------------------------------------
|
||||
(require 'htmlize)
|
||||
(setq htmlize-output-type 'inline-css)
|
||||
|
||||
;;-----[ Git ]-----------------------------------------------------------
|
||||
(require 'git)
|
||||
|
||||
;;-----[ Markdown mode ]-------------------------------------------------
|
||||
(defun oni/markdown-mode-hook ()
|
||||
(whitespace-mode 1)
|
||||
(turn-on-auto-fill))
|
||||
|
||||
(autoload 'markdown-mode "markdown-mode" "Major mode for Markdown" t)
|
||||
(setq whitespace-style '(face trailing)) ; For use with markdown mode
|
||||
(add-to-list 'auto-mode-alist '("\\.m\\(ark\\)?do?wn$". markdown-mode))
|
||||
(add-hook 'markdown-mode-hook 'oni/markdown-mode-hook)
|
||||
|
||||
;;-----[ Xmodmap mode ]--------------------------------------------------
|
||||
(autoload 'xmodmap-mode "xmodmap-mode" "Major mode for xmodmap" t)
|
||||
(add-to-list 'auto-mode-alist
|
||||
'("\\.[xX]modmap\\(rc\\)?$" . xmodmap-mode))
|
||||
|
||||
;;-----[ Gtags ]---------------------------------------------------------
|
||||
;; http://emacs-fu.blogspot.com/2009/01/navigating-through-source-code-using.html
|
||||
(defun oni/gtags-create-or-update ()
|
||||
"create or update the gnu global tag file"
|
||||
(interactive)
|
||||
(if (not (= 0 (call-process "global" nil nil nil " -p"))) ; tagfile
|
||||
(let ((olddir default-directory) ; doesn't exist?
|
||||
(topdir (read-directory-name
|
||||
"gtags: top of source tree:" default-directory)))
|
||||
(cd topdir)
|
||||
(shell-command "gtags && echo 'created tagfile'")
|
||||
(cd olddir)) ; restore
|
||||
;; tagfile already exists; update it
|
||||
(shell-command "global -u && echo 'updated tagfile'")))
|
||||
|
||||
(defun oni/gtags-mode-hook ()
|
||||
(local-set-key "\M-," 'gtags-find-tag)
|
||||
(local-set-key "\M-." 'gtags-find-rtag))
|
||||
|
||||
(autoload 'gtags-mode "gtags" "Minor mode for using gtags" t)
|
||||
(add-hook 'gtags-mode-hook 'oni/gtags-mode-hook)
|
||||
|
||||
;;-----[ C mode ]--------------------------------------------------------
|
||||
(defun oni/c-mode-common-hook ()
|
||||
(gtags-mode t)
|
||||
(oni/gtags-create-or-update))
|
||||
|
||||
(defun oni/c-mode-hook ()
|
||||
(local-set-key [f8] 'oni/c-toggle-header-source)
|
||||
(local-set-key [f9] 'compile)
|
||||
(local-set-key [C-m] 'newline-and-indent)
|
||||
(local-set-key [C-return] 'newline))
|
||||
|
||||
(add-hook 'c-mode-common-hook 'oni/c-mode-common-hook)
|
||||
(add-hook 'c-mode-hook 'oni/c-mode-hook)
|
||||
|
||||
;;-----[ PHP mode ]------------------------------------------------------
|
||||
(defconst php-outline-regex
|
||||
(eval-when-compile
|
||||
(concat "\\(function .*(\\|\\(public\\|private\\|protected\\)\\( "
|
||||
"static\\)? \\$\\|class \\sw\\)")))
|
||||
|
||||
(defun oni/php-show-outline ()
|
||||
(interactive)
|
||||
(occur php-outline-regex))
|
||||
|
||||
(defun oni/php-mode-hook ()
|
||||
(c-set-offset 'arglist-intro '+)
|
||||
(c-set-offset 'arglist-close '0)
|
||||
(local-set-key [f6] 'comment-line)
|
||||
(local-set-key [f7] 'oni/php-show-outline)
|
||||
(local-set-key [M-S-up] 'flymake-goto-prev-error)
|
||||
(local-set-key [M-S-down] 'flymake-goto-next-error)
|
||||
(set-column-markers 76 81)
|
||||
(flymake-mode 1))
|
||||
|
||||
(eval-after-load "php-mode"
|
||||
(progn
|
||||
;; Add ! at the beginning of font lock
|
||||
(font-lock-add-keywords
|
||||
'php-mode
|
||||
'(("\\([!]\\|\\=>\\)" 1 font-lock-operator-face)))
|
||||
;; Add the rest at the end of font lock
|
||||
(font-lock-add-keywords
|
||||
'php-mode
|
||||
'(("\\(->\\|[|.+=&/%*,:?<>-]\\)" 1 font-lock-operator-face)
|
||||
("\\(;\\)" 1 font-lock-end-statement)) 1)))
|
||||
|
||||
(autoload 'php-mode "php-mode" "Major mode for PHP" t)
|
||||
(setq-default php-mode-warn-if-mumamo-off nil) ; don't warn me about this
|
||||
(setq php-mode-force-pear t)
|
||||
(add-to-list 'auto-mode-alist '("\\.php[345]?$" . php-mode))
|
||||
(add-hook 'php-mode-hook 'oni/php-mode-hook)
|
||||
|
||||
;;-----[ bidi ]----------------------------------------------------------
|
||||
(setq-default bidi-display-reordering nil)
|
||||
|
||||
;;-----[ Message ]-------------------------------------------------------
|
||||
(defun oni/message-mode-hook ()
|
||||
(turn-on-auto-fill)
|
||||
(turn-on-flyspell)
|
||||
(ispell-change-dictionary (read-string "New dictionary: ")))
|
||||
|
||||
(add-hook 'message-mode-hook 'oni/message-mode-hook)
|
||||
|
||||
;;-----[ Gnus ]----------------------------------------------------------
|
||||
(setq gnus-init-file "~/.emacs.d/gnus")
|
||||
|
||||
;;-----[ Autosmiley ]----------------------------------------------------
|
||||
(require 'autosmiley)
|
||||
|
||||
;;-----[ Jabber ]--------------------------------------------------------
|
||||
(defvar ext/jabber-activity-jids-count 0)
|
||||
|
||||
(defun ext/jabber-urgency-hint ()
|
||||
(let ((count (length jabber-activity-jids)))
|
||||
(unless (= ext/jabber-activity-jids-count count)
|
||||
(if (zerop count)
|
||||
(ext/x-urgency-hint (selected-frame) nil)
|
||||
(ext/x-urgency-hint (selected-frame) t))
|
||||
(setq ext/jabber-activity-jids-count count))))
|
||||
|
||||
(defun oni/jabber-chat-mode-hook ()
|
||||
(autosmiley-mode)
|
||||
(local-set-key [S-return] 'newline)
|
||||
(local-set-key [C-return] 'newline))
|
||||
|
||||
(when (require 'jabber-autoloads nil 'noerror)
|
||||
(setq jabber-account-list
|
||||
'(("ryuslash@gmail.com"
|
||||
(:network-server . "talk.google.com")
|
||||
(:connection-type . ssl))))
|
||||
(setq jabber-history-enabled t)
|
||||
(setq jabber-use-global-history nil)
|
||||
(add-hook 'jabber-chat-mode-hook 'oni/jabber-chat-mode-hook)
|
||||
(add-hook 'jabber-activity-update-hook 'ext/jabber-urgency-hint))
|
||||
|
||||
;;-----[ X11 ]-----------------------------------------------------------
|
||||
(when window-system
|
||||
(setq linum-format " %d")
|
||||
(global-unset-key "\C-z"))
|
||||
|
||||
;;-----[ CLI ]-----------------------------------------------------------
|
||||
(when (not window-system)
|
||||
(setq linum-format "%d "))
|
||||
|
||||
;;-----[ Texinfo ]-------------------------------------------------------
|
||||
(add-hook 'texinfo-mode-hook 'turn-on-auto-fill)
|
||||
|
||||
;;-----[ Dot ]-----------------------------------------------------------
|
||||
(autoload 'graphviz-dot-mode "graphviz-dot-mode" "Major mode for dot" t)
|
||||
(add-to-list 'auto-mode-alist '("\\.dot$" . graphviz-dot-mode))
|
||||
|
||||
;;-----[ Cmake ]---------------------------------------------------------
|
||||
(define-skeleton cmake-project-skeleton
|
||||
"A cmake project template file"
|
||||
"Name: "
|
||||
"cmake_minimum_required(VERSION 2.6)\n"
|
||||
"project(" str ")\n"
|
||||
"\n"
|
||||
"set(" str "_VERSION_MAJOR 0)\n"
|
||||
"set(" str "_VERSION_MINOR 0)\n"
|
||||
"set(" str "_VERSION_PATCH 0)\n"
|
||||
"\n"
|
||||
"set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})\n"
|
||||
"add_subdirectory(src)")
|
||||
|
||||
(autoload 'cmake-mode "cmake-mode" "Major mode for CMake" t)
|
||||
(add-to-list 'auto-mode-alist '("CMakeLists\\.txt$" . cmake-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.cmake$" . cmake-mode))
|
||||
|
||||
;;-----[ Rainbow ]-------------------------------------------------------
|
||||
(autoload 'rainbow-mode "rainbow-mode" "Minor mode for colors" t)
|
||||
|
||||
;;-----[ Git-commit mode ]-----------------------------------------------
|
||||
(autoload 'git-commit-mode "git-commit" "" t)
|
||||
(add-to-list 'auto-mode-alist '("COMMIT_EDITMSG$" . git-commit-mode))
|
||||
(add-hook 'git-commit-mode-hook 'auto-fill-mode)
|
||||
|
||||
;;-----[ Ido ]-----------------------------------------------------------
|
||||
(ido-mode t)
|
||||
(setq ido-save-directory-list-file nil)
|
||||
(setq ido-auto-merge-delay-time 2)
|
||||
|
||||
;;-----[ Js mode ]-------------------------------------------------------
|
||||
(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js-mode))
|
||||
|
||||
;;-----[ CSS mode ]------------------------------------------------------
|
||||
(add-to-list 'auto-mode-alist '("\\.css$" . css-mode))
|
||||
(add-hook 'css-mode-hook 'rainbow-mode)
|
||||
|
||||
;;-----[ ELPA ]----------------------------------------------------------
|
||||
(setq package-archives
|
||||
'(("ELPA" . "http://tromey.com/elpa/")
|
||||
("gnu" . "http://elpa.gnu.org/packages/")
|
||||
("marmalade" . "http://marmalade-repo.org/packages/")))
|
||||
|
||||
;;-----[ Windmove ]------------------------------------------------------
|
||||
(windmove-default-keybindings 'meta)
|
||||
|
||||
;;-----[ Autocomplete ]--------------------------------------------------
|
||||
(when (require 'auto-complete-config nil 'noerror)
|
||||
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
|
||||
(setq ac-comphist-file "~/.emacs.d/ac-comphist.dat")
|
||||
(ac-config-default))
|
||||
|
||||
;;-----[ Ide-skel ]------------------------------------------------------
|
||||
(require 'ide-skel)
|
||||
(global-set-key [f10] 'ide-skel-toggle-left-view-window)
|
||||
(global-set-key [f11] 'ide-skel-toggle-bottom-view-window)
|
||||
(global-set-key [f12] 'ide-skel-toggle-right-view-window)
|
||||
|
||||
;;-----[ Misc ]----------------------------------------------------------
|
||||
(defun oni/reload-buffer ()
|
||||
(interactive)
|
||||
(revert-buffer nil t nil))
|
||||
|
||||
(defvar font-lock-operator-face 'font-lock-operator-face)
|
||||
(defvar font-lock-end-statement 'font-lock-end-statement)
|
||||
|
||||
(setq-default indent-tabs-mode nil)
|
||||
(setq-default truncate-lines t)
|
||||
(setq-default tab-width 4)
|
||||
(setq-default require-final-newline t)
|
||||
|
||||
(setq inhibit-startup-message t)
|
||||
(setq inhibit-default-init t)
|
||||
(setq scroll-conservatively 101)
|
||||
(setq browse-url-browser-function 'browse-url-generic)
|
||||
(setq browse-url-generic-program (getenv "BROWSER"))
|
||||
(setq uniquify-buffer-name-style 'reverse)
|
||||
(setq jit-lock-defer-time 0.2)
|
||||
(setq mouse-autoselect-window t)
|
||||
(setq frame-title-format '(:eval (concat "emacs: " (buffer-name))))
|
||||
(setq backup-directory-alist `((".*" . ,temporary-file-directory)))
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,temporary-file-directory t)))
|
||||
|
||||
(setq default-frame-alist
|
||||
(append '((font . "DejaVu Sans Mono:pixelsize=13"))))
|
||||
|
||||
(setq initial-frame-alist
|
||||
(append '((font . "DejaVu Sans Mono:pixelsize=13"))))
|
||||
|
||||
(fset 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
(tool-bar-mode -1)
|
||||
(menu-bar-mode -1)
|
||||
(line-number-mode -1)
|
||||
(global-linum-mode t)
|
||||
(column-number-mode t)
|
||||
(global-font-lock-mode t)
|
||||
(delete-selection-mode t)
|
||||
(show-paren-mode t)
|
||||
|
||||
(add-to-list 'compilation-finish-functions 'ext/my-comp-finish-function)
|
||||
|
||||
(global-set-key "\C-m" 'newline-and-indent)
|
||||
(global-set-key (kbd "C-x n r") 'narrow-to-region)
|
||||
(global-set-key [f5] 'oni/reload-buffer)
|
||||
|
||||
(add-hook 'before-save-hook 'oni/before-save-hook)
|
||||
(add-hook 'after-save-hook 'oni/after-save-hook)
|
||||
|
||||
(make-face 'font-lock-operator-face)
|
||||
(make-face 'font-lock-end-statement)
|
||||
(set-face-foreground 'font-lock-operator-face "#EDD400")
|
||||
(set-face-foreground 'font-lock-end-statement "#888A85")
|
||||
|
||||
;; Custom file
|
||||
(setq custom-file "~/.emacs.d/custom.el")
|
||||
(if (file-exists-p custom-file)
|
||||
(load custom-file))
|
||||
|
||||
(defvar home-file "~/wiki.info" "File to open when starting")
|
||||
|
||||
(if (file-exists-p home-file)
|
||||
(info home-file))
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 42d880560ba0ef838e5f2a037be35e0fd16f8fa6
|
24
.gitmodules
vendored
24
.gitmodules
vendored
|
@ -1,24 +1,6 @@
|
|||
[submodule ".zsh/syntax-highlighting"]
|
||||
path = .zsh/syntax-highlighting
|
||||
url = git://github.com/zsh-users/zsh-syntax-highlighting
|
||||
[submodule ".emacs.d/naquadah-theme"]
|
||||
path = .emacs.d/naquadah-theme
|
||||
url = git://git.naquadah.org/naquadah-theme.git
|
||||
[submodule ".emacs.d/auto-complete-clang"]
|
||||
path = .emacs.d/auto-complete-clang
|
||||
url = git://github.com/brianjcj/auto-complete-clang.git
|
||||
[submodule ".emacs.d/elisp/markdown-mode"]
|
||||
path = .emacs.d/elisp/markdown-mode
|
||||
url = git://jblevins.org/git/markdown-mode.git
|
||||
[submodule ".emacs.d/elisp/git-commit-mode"]
|
||||
path = .emacs.d/elisp/git-commit-mode
|
||||
url = git://github.com/rafl/git-commit-mode.git
|
||||
[submodule ".emacs.d/elisp/rainbow-delimiters"]
|
||||
path = .emacs.d/elisp/rainbow-delimiters
|
||||
url = git://github.com/jlr/rainbow-delimiters.git
|
||||
[submodule ".emacs.d/elisp/rainbow"]
|
||||
path = .emacs.d/elisp/rainbow
|
||||
url = git://git.naquadah.org/rainbow.git
|
||||
[submodule ".emacs.d/elisp/php-mode"]
|
||||
path = .emacs.d/elisp/php-mode
|
||||
url = git://github.com/ejmr/php-mode.git
|
||||
[submodule ".emacs.d"]
|
||||
path = .emacs.d
|
||||
url = git://github.com/ryuslash/dotemacs.git
|
||||
|
|
Loading…
Reference in a new issue