summaryrefslogtreecommitdiffstats
path: root/lisp/ravi-init-marks.el
diff options
context:
space:
mode:
authorRavi R Kiran <aine.marina@gmail.com>2015-10-23 18:57:59 (GMT)
committerRavi R Kiran <aine.marina@gmail.com>2015-10-23 18:57:59 (GMT)
commitcd1924466152177ea06b17c843f256463c1b91b8 (patch)
treeaf90afe028e5e392f242a3ea36302aafe1c1769d /lisp/ravi-init-marks.el
parent5561df232cfa49822f322196d98170f95aa1139e (diff)
parent74c319ef12dd3130f6afc17abc59404b59d601d1 (diff)
downloaddotemacs-cd1924466152177ea06b17c843f256463c1b91b8.zip
dotemacs-cd1924466152177ea06b17c843f256463c1b91b8.tar.gz
dotemacs-cd1924466152177ea06b17c843f256463c1b91b8.tar.bz2
Merge branch 'master' into rtags-attempt
* master: (139 commits) Add pdf-tools as a nicer replacement for doc-view Add pdf-tools submodule Fix maildir data with correct path Add desktop notifications for email Potential use for modes without repls Attach files more easily in mu Update to newest version of mu Please remove tooltips after a while, please ace-window gets confused when tooltips are present Sometimes the dispatch list does come in handy Pre-populate searches Succumb to muscle memory of control keys Remove ropemacs due to disuse Do not let company-quickhelp steal a global key Manage word navigation Use proper helm function to replace completing-read Electric operators on python mode Use which-key in preference to guide-key Navigate easier Simplify config with magit 2.1.0 ...
Diffstat (limited to 'lisp/ravi-init-marks.el')
-rw-r--r--lisp/ravi-init-marks.el78
1 files changed, 78 insertions, 0 deletions
diff --git a/lisp/ravi-init-marks.el b/lisp/ravi-init-marks.el
new file mode 100644
index 0000000..803b2cb
--- /dev/null
+++ b/lisp/ravi-init-marks.el
@@ -0,0 +1,78 @@
+;;; ravi-init-marks.el --- Handling the mark
+
+;; Copyright (C) 2013
+
+;; Author: <ravi@nero.lan>
+;; Keywords:
+
+;; 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 3 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, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Handling the mark
+
+;;; Code:
+
+;; Show active region
+(transient-mark-mode 1)
+(make-variable-buffer-local 'transient-mark-mode)
+(put 'transient-mark-mode 'permanent-local t)
+(setq-default transient-mark-mode t)
+
+;; When popping the mark, continue popping until the cursor actually moves
+;; Also, if the last command was a copy - skip past all the expand-region cruft.
+;; Stolen from Magnar Sveen's emacs.d on github.
+(defadvice pop-to-mark-command (around ensure-new-position activate)
+ (let ((p (point)))
+ (when (eq last-command 'save-region-or-current-line)
+ ad-do-it
+ ad-do-it
+ ad-do-it)
+ (dotimes (i 10)
+ (when (= p (point)) ad-do-it))))
+
+;; Allow mark-based navigation even in transient-mark-mode; see
+;; http://www.masteringemacs.org/articles/2010/12/22/fixing-mark-commands-transient-mark-mode/
+
+(defun ravi/push-mark-no-activate ()
+ "Pushes `point' to `mark-ring' and does not activate the region
+Equivalent to \\[set-mark-command] when \\[transient-mark-mode] is disabled"
+ (interactive)
+ (push-mark (point) t nil)
+ (message "Pushed mark to ring"))
+(bind-key "C-`" 'ravi/push-mark-no-activate)
+
+(defun ravi/jump-to-mark ()
+ "Jumps to the local mark, respecting the `mark-ring' order.
+This is the same as using \\[set-mark-command] with the prefix argument."
+ (interactive)
+ (set-mark-command 1))
+(bind-key "M-`" 'ravi/jump-to-mark)
+
+; Prevents C-x C-x from highlighting region
+(defun ravi/exchange-point-and-mark-no-activate ()
+ "Identical to \\[exchange-point-and-mark] but will not activate the region."
+ (interactive)
+ (exchange-point-and-mark)
+ (deactivate-mark nil))
+(define-key global-map [remap exchange-point-and-mark] 'ravi/exchange-point-and-mark-no-activate)
+
+(use-package browse-kill-ring
+ :config (browse-kill-ring-default-keybindings)
+ :ensure t
+ :if (not ravi/use-helm-instead-of-ido)
+ )
+
+(provide 'ravi-init-marks)
+;;; ravi-init-marks.el ends here