From 92e8b785c554f3c3682c6a41124d1934c8da6979 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 18 Oct 2018 15:31:52 -0700 Subject: [emacs] Further simplifications. - consistently use 'fcuny/' for custom prefixes - add a function to remove | in text (when I need to trim input from MySQL) - do not use ivy completion with magit --- configs/rcs/emacs.d/init.el | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'configs/rcs') diff --git a/configs/rcs/emacs.d/init.el b/configs/rcs/emacs.d/init.el index 20ff378..1f915b1 100644 --- a/configs/rcs/emacs.d/init.el +++ b/configs/rcs/emacs.d/init.el @@ -22,16 +22,13 @@ (require 'use-package) -(defvar fcuny-path-home (getenv "HOME") - "Path to the user's home directory.") - -(defvar fcuny-bookmarks-dir (expand-file-name "bookmarks" fcuny-path-emacs-var) +(defvar fcuny/bookmarks-dir (expand-file-name "bookmarks" fcuny-path-emacs-var) "Path to save the bookmarks") -(defvar fcuny-custom-settings (expand-file-name "emacs-custom.el" fcuny-path-emacs-var) +(defvar fcuny/custom-settings (expand-file-name "emacs-custom.el" fcuny-path-emacs-var) "Path to emacs custom variables.") -(defun fc/rename-this-buffer-and-file () +(defun fcuny/rename-this-buffer-and-file () "Renames current buffer and file it is visiting." (interactive) (let ((name (buffer-name)) @@ -49,10 +46,17 @@ (set-buffer-modified-p nil) (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name)))))))) -(defun fc/check-work-machine-p () +(defun fcuny/check-work-machine-p () "Returns t if this is a work machine" (string-match "tw-mbp.*" (system-name))) +(defun fcuny/remove-mysql-columns () + "Removes | from text. This is useful when I want to drop the column separator from some text coming from a mysql query." + (interactive) + (if (region-active-p) + (replace-regexp "\s?|\s?" "" nil (region-beginning) (region-end)) + (replace-regexp "\s?|\s?" ""))) + ;; set utf-8 as the default encoding (prefer-coding-system 'utf-8-unix) (set-terminal-coding-system 'utf-8) @@ -64,7 +68,7 @@ (setq auto-save-default nil) ;; don't auto save files (setq auto-save-list-file-prefix nil) ;; no backups (setq create-lockfiles nil) ;; don't use a lock file -(setq custom-file fcuny-custom-settings) ;; where to save custom settings +(setq custom-file fcuny/custom-settings) ;; where to save custom settings (setq make-backup-files nil) ;; really no backups (setq minibuffer-message-timeout 0.5) ;; How long to display an echo-area message (setq next-screen-context-lines 5) ;; scroll 5 lines at a time @@ -75,7 +79,7 @@ (setq column-number-mode t) ;; show column number in the mode line (setq-default indent-tabs-mode nil) ;; turn off tab indentation (setq-default cursor-type 'hbar) ;; cursor is a horizontal bar -(setq bookmark-default-file fcuny-bookmarks-dir) ;; where to save bookmarks +(setq bookmark-default-file fcuny/bookmarks-dir) ;; where to save bookmarks (setq bookmark-save-flag 1) ;; save bookmarks when emacs qui (setq vc-handled-backends nil) ;; don't use the VC backend, it's too slow with source (setq-default delete-by-moving-to-trash t) ;; delete files by moving them to the trash @@ -95,14 +99,14 @@ :bind (("C-c C-m" . toggle-frame-fullscreen)) :config (progn - (defun fc/setup-frame(&optional frame) + (defun fcuny/setup-frame(&optional frame) (fringe-mode '(5 . 5)) (setq-default frame-title-format "%b") (set-face-attribute 'default nil :height 150 :weight 'normal :width 'normal :font "Source Code Pro") (when (eq system-type 'darwin) (setq ns-use-native-fullscreen nil) (setq mac-allow-anti-aliasing t))) - (fc/setup-frame))) + (fcuny/setup-frame))) (use-package general :config @@ -248,7 +252,6 @@ :hook ((magit-mode . hl-line-mode)) :bind (("C-x g s" . magit-status)) :config - (setq magit-completing-read-function 'ivy-completing-read) (setq git-commit-summary-max-length 50) (setq git-commit-fill-column 72) (setq git-commit-turn-on-auto-fill t)) -- cgit 1.4.1