From 4939ca2829dd641f4c0f6180ea9f7a04dc447750 Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Fri, 2 Mar 2018 00:23:08 -0500 Subject: [PATCH] Bubble up smart-line-beginning --- global.org | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/global.org b/global.org index 7b6945c..43dbbe0 100644 --- a/global.org +++ b/global.org @@ -230,6 +230,20 @@ (global-set-key (kbd "C-x k") 'kill-this-buffer) (global-set-key (kbd "C-S-v") 'scroll-down-command) #+END_SRC +** Smart beginning-of-line + This is a relatively smart way to go back to the beginning of the line + #+BEGIN_SRC emacs-lisp + (defun smart-line-beginning () + "Move point to the beginning of text on the current line; if that + is already the current position of point, then move it to the + beginning of the line." + (interactive) + (let ((pt (point))) + (beginning-of-line-text) + (when (eq pt (point)) + (beginning-of-line)))) + (global-set-key (kbd "C-a") 'smart-line-beginning) + #+END_SRC ** Whitespace Trailing whitespace is evil; get rid of it #+BEGIN_SRC emacs-lisp @@ -397,17 +411,6 @@ (global-smart-tab-mode 1) (global-set-key (kbd "C-j") 'smart-tab) ;; try this; I never use C-j for goto-line - ;; * redefine line-beginning to handle indentation properly - (defun smart-line-beginning () - "Move point to the beginning of text on the current line; if that is already - the current position of point, then move it to the beginning of the line." - (interactive) - (let ((pt (point))) - (beginning-of-line-text) - (when (eq pt (point)) - (beginning-of-line)))) - (global-set-key (kbd "C-a") 'smart-line-beginning) - ;; * load expand-region (require 'expand-region)