From 226f5277d493133338f87e5bf71bfffbf0aa7321 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Mon, 11 May 2020 13:22:02 +0200 Subject: Update yaml-mode and make .emacs .emacs.pure and .emacs.termfix compliant with eachother --- .emacs | 23 ++++++++--------------- .emacs.d/lisp/yaml-mode.el | 5 ++++- .emacs.pure | 27 +++++++++++++++++++++++++-- .emacs.termfix | 21 ++++++++++++--------- 4 files changed, 49 insertions(+), 27 deletions(-) diff --git a/.emacs b/.emacs index 6aa5873..222eb12 100644 --- a/.emacs +++ b/.emacs @@ -1,13 +1,6 @@ ;; Set up the keyboard so the delete key on both the regular keyboard ;; and the keypad delete the character under the cursor and to the right ;; under X, instead of the default, backspace behavior. - -;; Added by Package.el. This must come before configurations of -;; installed packages. Don't delete this line. If you don't want it, -;; just comment it out by adding a semicolon to the start of the line. -;; You may delete these explanatory comments. -;;(package-initialize) - (global-set-key [delete] 'delete-char) (global-set-key [kp-delete] 'delete-char) @@ -77,6 +70,14 @@ (setq which-func-modes '(c-mode c++-mode java-mode python-mode)) (which-function-mode t) +;; Python +(require 'whitespace) +(add-hook 'python-mode-hook + (lambda () + (progn + (setq whitespace-line-column 79) + (setq whitespace-style '(face empty tabs lines-tail trailing)) + (whitespace-mode)))) ;; Custom plugins (add-to-list 'load-path "~/.emacs.d/lisp/") @@ -94,14 +95,6 @@ (require 'yaml-mode) (add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode)) -;; Python -(require 'whitespace) -(add-hook 'python-mode-hook - (lambda () - (progn - (setq whitespace-line-column 79) - (setq whitespace-style '(face empty tabs lines-tail trailing)) - (whitespace-mode)))) ;; yasnippet (require 'yasnippet) diff --git a/.emacs.d/lisp/yaml-mode.el b/.emacs.d/lisp/yaml-mode.el index 66e41b3..6bd4000 100644 --- a/.emacs.d/lisp/yaml-mode.el +++ b/.emacs.d/lisp/yaml-mode.el @@ -284,7 +284,10 @@ that key is pressed to begin a block literal." ;; We're right after a quote that opens a string literal. ;; Skip over it (big speedup for long JSON strings). (goto-char (1- pt)) - (ignore-errors (forward-sexp))))))))) + (condition-case nil + (forward-sexp) + (scan-error + (goto-char end)))))))))) (defun yaml-font-lock-block-literals (bound) "Find lines within block literals. diff --git a/.emacs.pure b/.emacs.pure index 40c5ebd..085f6ea 100644 --- a/.emacs.pure +++ b/.emacs.pure @@ -4,6 +4,9 @@ (global-set-key [delete] 'delete-char) (global-set-key [kp-delete] 'delete-char) +(global-set-key (kbd "S-C-") 'shrink-window-horizontally) +(global-set-key (kbd "S-C-") 'enlarge-window-horizontally) + ;; My own key bindings ;; ;;(global-set-key [f1] 'compile) @@ -44,15 +47,35 @@ (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) +(put 'downcase-region 'disabled nil) +(kill-buffer "*scratch*") + ;; Programming section ;; Indentation -;;(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil) -(setq-default c-basic-offset 4 tab-width 4) +(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil) +;;(setq-default c-basic-offset 4 tab-width 4) ;; Default coding style (setq c-default-style "bsd") ;; Don't attempt to guess the Python-indent (setq python-indent-guess-indent-offset nil) + +;; Bind .ino (Arduino project) extension to C++ mode +(add-to-list 'auto-mode-alist '("\\.ino\\'" . c++-mode)) + +;; Enable which-function-mode for C, C++ and Python +(setq which-func-modes '(c-mode c++-mode java-mode python-mode)) +(which-function-mode t) + +;; Python +(require 'whitespace) +(add-hook 'python-mode-hook + (lambda () + (progn + (setq whitespace-line-column 79) + (setq whitespace-style '(face empty tabs lines-tail trailing)) + (whitespace-mode)))) + diff --git a/.emacs.termfix b/.emacs.termfix index d879257..704937f 100644 --- a/.emacs.termfix +++ b/.emacs.termfix @@ -1,13 +1,6 @@ ;; Set up the keyboard so the delete key on both the regular keyboard ;; and the keypad delete the character under the cursor and to the right ;; under X, instead of the default, backspace behavior. - -;; Added by Package.el. This must come before configurations of -;; installed packages. Don't delete this line. If you don't want it, -;; just comment it out by adding a semicolon to the start of the line. -;; You may delete these explanatory comments. -;;(package-initialize) - (global-set-key [delete] 'delete-char) (global-set-key [kp-delete] 'delete-char) @@ -66,6 +59,7 @@ (set-keyboard-coding-system 'utf-8) (put 'downcase-region 'disabled nil) +(kill-buffer "*scratch*") ;; Programming section @@ -87,13 +81,21 @@ (setq which-func-modes '(c-mode c++-mode java-mode python-mode)) (which-function-mode t) +;; Python +(require 'whitespace) +(add-hook 'python-mode-hook + (lambda () + (progn + (setq whitespace-line-column 79) + (setq whitespace-style '(face empty tabs lines-tail trailing)) + (whitespace-mode)))) ;; Custom plugins (add-to-list 'load-path "~/.emacs.d/lisp/") ;; PHP -;; (autoload 'php-mode "php-mode" "Mode for editing PHP source files") -;; (add-to-list 'auto-mode-alist '("\\.\\(inc\\|php[s34]?\\)" . php-mode)) +;;(autoload 'php-mode "php-mode" "Mode for editing PHP source files") +;;(add-to-list 'auto-mode-alist '("\\.\\(inc\\|php[s34]?\\)" . php-mode)) ;; Lua (autoload 'lua-mode "lua-mode" "Lua editing mode." t) @@ -104,6 +106,7 @@ (require 'yaml-mode) (add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode)) + ;; yasnippet (require 'yasnippet) (yas-global-mode 1) -- cgit v1.3