From 81c2476f5f94797d49bf04d8d7e107496a5e8cb7 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 28 Apr 2015 11:14:35 +0200 Subject: [PATCH] added elpa/ace-jump-mode and elpa/centered-cursor-mode Signed-off-by: Andreas Gerler --- bba.org | 1 + .../ace-jump-mode-autoloads.el | 71 +++++++ .../ace-jump-mode-pkg.el | 1 + .../ace-jump-mode.el | 176 +++++++----------- elpa/ace-jump-mode-readme.txt | 65 +++++++ .../centered-cursor-mode-autoloads.el | 30 +++ .../centered-cursor-mode-pkg.el | 1 + .../centered-cursor-mode.el | 29 ++- elpa/centered-cursor-mode-readme.txt | 16 ++ 9 files changed, 276 insertions(+), 114 deletions(-) create mode 100644 elpa/ace-jump-mode-20140616.115/ace-jump-mode-autoloads.el create mode 100644 elpa/ace-jump-mode-20140616.115/ace-jump-mode-pkg.el rename ace-jump-mode.el => elpa/ace-jump-mode-20140616.115/ace-jump-mode.el (88%) create mode 100644 elpa/ace-jump-mode-readme.txt create mode 100644 elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode-autoloads.el create mode 100644 elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode-pkg.el rename centered-cursor-mode.el => elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode.el (97%) create mode 100644 elpa/centered-cursor-mode-readme.txt diff --git a/bba.org b/bba.org index 7d250561..5f41e655 100644 --- a/bba.org +++ b/bba.org @@ -260,6 +260,7 @@ See [[https://github.com/toctan/smartparens][Smartparens on github]]. *** ace-jump-mode #+BEGIN_SRC emacs-lisp + (add-to-list 'load-path "~/.emacs.d/elpa/ace-jump-mode-20140616.115") (require 'ace-jump-mode) (define-key global-map (kbd "C-c C-@") 'ace-jump-mode) diff --git a/elpa/ace-jump-mode-20140616.115/ace-jump-mode-autoloads.el b/elpa/ace-jump-mode-20140616.115/ace-jump-mode-autoloads.el new file mode 100644 index 00000000..24f1b171 --- /dev/null +++ b/elpa/ace-jump-mode-20140616.115/ace-jump-mode-autoloads.el @@ -0,0 +1,71 @@ +;;; ace-jump-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (ace-jump-mode ace-jump-line-mode ace-jump-word-mode +;;;;;; ace-jump-char-mode ace-jump-mode-pop-mark) "ace-jump-mode" +;;;;;; "ace-jump-mode.el" (21823 16778 0 0)) +;;; Generated autoloads from ace-jump-mode.el + +(autoload 'ace-jump-mode-pop-mark "ace-jump-mode" "\ +Pop up a postion from `ace-jump-mode-mark-ring', and jump back to that position + +\(fn)" t nil) + +(autoload 'ace-jump-char-mode "ace-jump-mode" "\ +AceJump char mode + +\(fn QUERY-CHAR)" t nil) + +(autoload 'ace-jump-word-mode "ace-jump-mode" "\ +AceJump word mode. +You can set `ace-jump-word-mode-use-query-char' to nil to prevent +asking for a head char, that will mark all the word in current +buffer. + +\(fn HEAD-CHAR)" t nil) + +(autoload 'ace-jump-line-mode "ace-jump-mode" "\ +AceJump line mode. +Marked each no empty line and move there + +\(fn)" t nil) + +(autoload 'ace-jump-mode "ace-jump-mode" "\ +AceJump mode is a minor mode for you to quick jump to a +position in the curret view. + There is three submode now: + `ace-jump-char-mode' + `ace-jump-word-mode' + `ace-jump-line-mode' + +You can specify the sequence about which mode should enter +by customize `ace-jump-mode-submode-list'. + +If you do not want to query char for word mode, you can change +`ace-jump-word-mode-use-query-char' to nil. + +If you don't like the default move keys, you can change it by +setting `ace-jump-mode-move-keys'. + +You can constrol whether use the case sensitive via +`ace-jump-mode-case-fold'. + +\(fn &optional PREFIX)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("ace-jump-mode-pkg.el") (21823 16778 629811 +;;;;;; 0)) + +;;;*** + +(provide 'ace-jump-mode-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; ace-jump-mode-autoloads.el ends here diff --git a/elpa/ace-jump-mode-20140616.115/ace-jump-mode-pkg.el b/elpa/ace-jump-mode-20140616.115/ace-jump-mode-pkg.el new file mode 100644 index 00000000..1f7e34f4 --- /dev/null +++ b/elpa/ace-jump-mode-20140616.115/ace-jump-mode-pkg.el @@ -0,0 +1 @@ +(define-package "ace-jump-mode" "20140616.115" "a quick cursor location minor mode for emacs" (quote nil)) diff --git a/ace-jump-mode.el b/elpa/ace-jump-mode-20140616.115/ace-jump-mode.el similarity index 88% rename from ace-jump-mode.el rename to elpa/ace-jump-mode-20140616.115/ace-jump-mode.el index 43a938ed..768ffbac 100644 --- a/ace-jump-mode.el +++ b/elpa/ace-jump-mode-20140616.115/ace-jump-mode.el @@ -4,6 +4,7 @@ ;; Author : winterTTr ;; URL : https://github.com/winterTTr/ace-jump-mode/ +;; Package-Version: 20140616.115 ;; Version : 2.0.RC ;; Keywords : motion, location, cursor @@ -122,7 +123,6 @@ `(aj-visual-area-recover-buffer (aj-position-visual-area ,aj-pos))) - ;; --------------------- ;; aj-visual-area ;; --------------------- @@ -199,11 +199,12 @@ background.") (defvar ace-jump-mode-scope 'global "Define what is the scope that ace-jump-mode works. -Now, there three kind of values for this: -1. 'global : ace jump can work across any window and frame, this is also the default. -2. 'frame : ace jump will work for the all windows in current frame. -3. 'window : ace jump will only work on current window only. - This is the same behavior for 1.0 version.") +Now, there are four kinds of values for this: +1. 'global : ace jump can work across any window and frame, this is also the default. +2. 'frame : ace jump will work for the all windows in current frame. +3. 'visible : ace jump will work for all windows in visible frames. +3. 'window : ace jump will only work on current window only. + This is the same behavior for 1.0 version.") (defvar ace-jump-mode-detect-punc t "When this is non-nil, the ace jump word mode will detect the @@ -265,14 +266,6 @@ is used to highlight the target positions.") "Save the current mode. See `ace-jump-mode-submode-list' for possible value.") -(defvar ace-jump-recover-visual-area-list nil - "Save the ace jump aj-visual-area structure list. - -Sometimes, the different window may display the same buffer. For -this case, we need to create a indirect buffer for them to make -ace jump overlay can work across the differnt window with the -same buffer. When ace jump ends, we need to recover the window to -its original buffer.") (defvar ace-jump-sync-emacs-mark-ring nil "When this variable is not-nil, everytime `ace-jump-mode-pop-mark' is called, ace jump will try to remove the same mark from buffer local mark @@ -284,6 +277,10 @@ jump internal use. If you want to change it, use `ace-jump-mode-enable-mark-sync' or `ace-jump-mode-disable-mark-sync'.") +(defvar ace-jump-search-filter nil + "This should be nil or a point-dependant predicate +that `ace-jump-search-candidate' will use as an additional filter.") + (defgroup ace-jump nil "ace jump group" :group 'convenience) @@ -296,10 +293,10 @@ jump internal use. If you want to change it, use (defface ace-jump-face-foreground - '((((class color)) (:foreground "red")) - (((background dark)) (:foreground "gray100")) - (((background light)) (:foreground "gray0")) - (t (:foreground "gray100"))) + '((((class color)) (:foreground "red" :underline nil)) + (((background dark)) (:foreground "gray100" :underline nil)) + (((background light)) (:foreground "gray0" :underline nil)) + (t (:foreground "gray100" :underline nil))) "Face for foreground of AceJump motion" :group 'ace-jump) @@ -371,7 +368,10 @@ The returned value is a list of `aj-position' record." until (or (> (point) end-point) (eobp)) - if (or ace-jump-allow-invisible (not (invisible-p (match-beginning 0)))) + if (and (or ace-jump-allow-invisible (not (invisible-p (match-beginning 0)))) + (or (null ace-jump-search-filter) + (ignore-errors + (funcall ace-jump-search-filter)))) collect (make-aj-position :offset (match-beginning 0) :visual-area va) ;; when we use "^" to search line mode, @@ -458,15 +458,20 @@ node and call LEAF-FUNC on each leaf node" ;; which will be fill in "update-overlay" function (func-create-overlay (lambda (node) (let* ((p (car position-list)) - (offset (aj-position-offset p)) - (va (aj-position-visual-area p)) - (w (aj-visual-area-window va)) - (b (aj-visual-area-buffer va)) + (o (aj-position-offset p)) + (w (aj-position-window p)) + (b (aj-position-buffer p)) ;; create one char overlay - (ol (make-overlay offset (1+ offset) b))) + (ol (make-overlay o (1+ o) b))) ;; update leaf node to remember the ol (setf (cdr node) ol) (overlay-put ol 'face 'ace-jump-face-foreground) + ;; this is important, because sometimes the different + ;; window may dispaly the same buffer, in that case, + ;; overlay for different window (but the same buffer) + ;; will show at the same time on both window + ;; So we make it only on the specific window + (overlay-put ol 'window w) ;; associate the aj-position data with overlay ;; so that we can use it to do the final jump (overlay-put ol 'aj-data p) @@ -516,7 +521,9 @@ node and call LEAF-FUNC on each leaf node" ((string-equal subs "\n") "\n") (t - ""))))))))) + ;; there are wide-width characters + ;; so, we need paddings + (make-string (max 0 (1- (string-width subs))) ? )))))))))) (loop for k in keys for n in (cdr tree) do (progn @@ -539,6 +546,13 @@ node and call LEAF-FUNC on each leaf node" collect (make-aj-visual-area :buffer (window-buffer w) :window w :frame f)))) + ((eq ace-jump-mode-scope 'visible) + (loop for f in (frame-list) + if (eq t (frame-visible-p f)) + append (loop for w in (window-list f) + collect (make-aj-visual-area :buffer (window-buffer w) + :window w + :frame f)))) ((eq ace-jump-mode-scope 'frame) (loop for w in (window-list (selected-frame)) collect (make-aj-visual-area :buffer (window-buffer w) @@ -553,46 +567,6 @@ node and call LEAF-FUNC on each leaf node" (error "[AceJump] Invalid ace-jump-mode-scope, please check your configuration")))) -(defun ace-jump-mode-make-indirect-buffer (visual-area-list) - "When the differnt window show the same buffer. The overlay -cannot work for same buffer at the same time. So the indirect -buffer need to create to make overlay can work correctly. - -VISUAL-AREA-LIST is aj-visual-area list. This function will -return the structure list for those make a indirect buffer. - -Side affect: All the created indirect buffer will show in its -relevant window." - (loop for va in visual-area-list - ;; check if the current visual-area (va) has the same buffer with - ;; the previous ones (vai) - if (loop for vai in visual-area-list - ;; stop at itself, don't need to find the ones behind it (va) - until (eq vai va) - ;; if the buffer is same, return those(vai) before - ;; it(va) so that we know the some visual area has - ;; the same buffer with current one (va) - if (eq (aj-visual-area-buffer va) - (aj-visual-area-buffer vai)) - collect vai) - ;; if indeed the same one find, we need create an indirect buffer - ;; to current visual area(va) - collect (with-selected-window (aj-visual-area-window va) - ;; store the orignal buffer - (setf (aj-visual-area-recover-buffer va) - (aj-visual-area-buffer va)) - ;; create indirect buffer to use as working buffer - (setf (aj-visual-area-buffer va) - (clone-indirect-buffer nil nil)) - ;; update window to the indirect buffer - (let ((ws (window-start))) - (set-window-buffer (aj-visual-area-window va) - (aj-visual-area-buffer va)) - (set-window-start - (aj-visual-area-window va) - ws)) - va))) - (defun ace-jump-do( re-query-string ) "The main function to start the AceJump mode. @@ -622,9 +596,6 @@ You can constrol whether use the case sensitive via `ace-jump-mode-case-fold'. (run-hooks 'ace-jump-mode-end-hook)) ;; more than one, we need to enter AceJump mode (t - ;; make indirect buffer for those windows that show the same buffer - (setq ace-jump-recover-visual-area-list - (ace-jump-mode-make-indirect-buffer visual-area-list)) ;; create background for each visual area (if ace-jump-mode-gray-background (setq ace-jump-background-overlay-list @@ -677,26 +648,38 @@ You can constrol whether use the case sensitive via `ace-jump-mode-case-fold'. (let ((offset (aj-position-offset position)) (frame (aj-position-frame position)) (window (aj-position-window position)) - (buffer (aj-position-buffer position))) - ;; focus to the frame - (if (and (frame-live-p frame) - (not (eq frame (selected-frame)))) - (select-frame-set-input-focus (window-frame window))) - - ;; select the correct window - (if (and (window-live-p window) - (not (eq window (selected-window)))) - (select-window window)) - - ;; swith to buffer - (if (and (buffer-live-p buffer) - (not (eq buffer (window-buffer window)))) - (switch-to-buffer buffer)) - ;; move to correct position - - (if (and (buffer-live-p buffer) - (eq (current-buffer) buffer)) - (goto-char offset)))) + (buffer (aj-position-buffer position)) + (line-mode-column 0)) + + ;; save the column before do line jump, so that we can jump to the + ;; same column as previous line, make it the same behavior as C-n/C-p + (if (eq ace-jump-current-mode 'ace-jump-line-mode) + (setq line-mode-column (current-column))) + + ;; focus to the frame + (if (and (frame-live-p frame) + (not (eq frame (selected-frame)))) + (select-frame-set-input-focus (window-frame window))) + + ;; select the correct window + (if (and (window-live-p window) + (not (eq window (selected-window)))) + (select-window window)) + + ;; swith to buffer + (if (and (buffer-live-p buffer) + (not (eq buffer (window-buffer window)))) + (switch-to-buffer buffer)) + + ;; move to correct position + (if (and (buffer-live-p buffer) + (eq (current-buffer) buffer)) + (goto-char offset)) + + ;; recover to the same column if we use the line jump mode + (if (eq ace-jump-current-mode 'ace-jump-line-mode) + (move-to-column line-mode-column)) + )) (defun ace-jump-push-mark () "Push the current position information onto the `ace-jump-mode-mark-ring'." @@ -942,10 +925,10 @@ You can constrol whether use the case sensitive via ((eq (car node) 'leaf) ;; need to save aj data, as `ace-jump-done' will clean it (let ((aj-data (overlay-get (cdr node) 'aj-data))) - (ace-jump-done) (ace-jump-push-mark) (run-hooks 'ace-jump-mode-before-jump-hook) (ace-jump-jump-to aj-data)) + (ace-jump-done) (run-hooks 'ace-jump-mode-end-hook)) (t (ace-jump-done) @@ -970,21 +953,6 @@ You can constrol whether use the case sensitive via (setq ace-jump-background-overlay-list nil) - ;; we clean the indirect buffer - (loop for va in ace-jump-recover-visual-area-list - do (with-selected-window (aj-visual-area-window va) - (let ((fake-buffer (aj-visual-area-buffer va)) - (original-buffer (aj-visual-area-recover-buffer va))) - ;; recover display buffer - (set-window-buffer (aj-visual-area-window va) - original-buffer) - ;; update visual area, which we need to use it to do the - ;; final jump, and as well, save in history - (setf (aj-visual-area-buffer va) original-buffer) - (setf (aj-visual-area-recover-buffer va) nil) - ;; kill indirect buffer - (ace-jump-kill-buffer fake-buffer)))) - ;; delete overlays in search tree (ace-jump-delete-overlay-in-search-tree ace-jump-search-tree) (setq ace-jump-search-tree nil) diff --git a/elpa/ace-jump-mode-readme.txt b/elpa/ace-jump-mode-readme.txt new file mode 100644 index 00000000..c332709f --- /dev/null +++ b/elpa/ace-jump-mode-readme.txt @@ -0,0 +1,65 @@ +INTRODUCTION + + +What's this? + +It is a minor mode for Emacs. It can help you to move your cursor +to ANY position in emacs by using only 3 times key press. + +Where does ace jump mode come from ? + +I firstly see such kind of moving style is in a vim plugin called +EasyMotion. It really attract me a lot. So I decide to write +one for Emacs and MAKE IT BETTER. + +So I want to thank to : + Bartlomiej P. for his PreciseJump + Kim Silkebækken for his EasyMotion + + +What's ace-jump-mode ? + +ace-jump-mode is an fast/direct cursor location minor mode. It will +create the N-Branch search tree internal and marks all the possible +position with predefined keys in within the whole emacs view. +Allowing you to move to the character/word/line almost directly. + + +Usage + +Add the following code to your init file, of course you can select +the key that you prefer to. +---------------------------------------------------------- + +ace jump mode major function + +(add-to-list 'load-path "/full/path/where/ace-jump-mode.el/in/") +(autoload + 'ace-jump-mode + "ace-jump-mode" + "Emacs quick move minor mode" + t) +you can select the key you prefer to +(define-key global-map (kbd "C-c SPC") 'ace-jump-mode) + + +enable a more powerful jump back function from ace jump mode + +(autoload + 'ace-jump-mode-pop-mark + "ace-jump-mode" + "Ace jump back:-)" + t) +(eval-after-load "ace-jump-mode" + '(ace-jump-mode-enable-mark-sync)) +(define-key global-map (kbd "C-x SPC") 'ace-jump-mode-pop-mark) + +If you use viper mode : +(define-key viper-vi-global-user-map (kbd "SPC") 'ace-jump-mode) +If you use evil +(define-key evil-normal-state-map (kbd "SPC") 'ace-jump-mode) +---------------------------------------------------------- + +For more information +Intro Doc: https://github.com/winterTTr/ace-jump-mode/wiki +FAQ : https://github.com/winterTTr/ace-jump-mode/wiki/AceJump-FAQ diff --git a/elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode-autoloads.el b/elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode-autoloads.el new file mode 100644 index 00000000..ddd13a6d --- /dev/null +++ b/elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode-autoloads.el @@ -0,0 +1,30 @@ +;;; centered-cursor-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (centered-cursor-mode) "centered-cursor-mode" "centered-cursor-mode.el" +;;;;;; (21823 20143 0 0)) +;;; Generated autoloads from centered-cursor-mode.el + +(autoload 'centered-cursor-mode "centered-cursor-mode" "\ +Makes the cursor stay vertically in a defined +position (usually centered). + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("centered-cursor-mode-pkg.el") (21823 +;;;;;; 20143 376262 0)) + +;;;*** + +(provide 'centered-cursor-mode-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; centered-cursor-mode-autoloads.el ends here diff --git a/elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode-pkg.el b/elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode-pkg.el new file mode 100644 index 00000000..03599a58 --- /dev/null +++ b/elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode-pkg.el @@ -0,0 +1 @@ +(define-package "centered-cursor-mode" "20150420.1942" "cursor stays vertically centered" (quote nil)) diff --git a/centered-cursor-mode.el b/elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode.el similarity index 97% rename from centered-cursor-mode.el rename to elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode.el index 35565b8f..0174c029 100644 --- a/centered-cursor-mode.el +++ b/elpa/centered-cursor-mode-20150420.1942/centered-cursor-mode.el @@ -6,11 +6,12 @@ ;; Maintainer: André Riemann ;; Created: 2007-09-14 ;; Keywords: convenience +;; Package-Version: 20150420.1942 -;; URL: http://www.emacswiki.org/cgi-bin/wiki/centered-cursor-mode.el -;; Compatibility: only tested with GNU Emacs 23.0 -;; Version: 0.5.2 -;; Last-Updated: 2009-08-31 +;; URL: http://www.emacswiki.org/emacs/centered-cursor-mode.el +;; Compatibility: tested with GNU Emacs 23.0, 24 +;; Version: 0.5.4 +;; Last-Updated: 2015-04-20 ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -56,6 +57,10 @@ ;; - more bugs? ;;; Change Log: +;; 2015-04-20 andre-r +;; * corrected URL in header +;; 2015-03-01 andre-r +;; * fixed bug where Emacs without X support (emacs-nox) didn't find mouse-wheel-mode ;; 2009-08-31 andre-r ;; * replaced window-body-height with window-text-height ;; (partially visible lines are not counted in window-text-height) @@ -94,7 +99,10 @@ ;; This file is *NOT* part of GNU Emacs. ;;; Code: - + + +(require 'mouse-wheel-mode nil 'noerror) + (defgroup centered-cursor nil "Makes the cursor stay vertically in a defined position (usually centered). Instead the cursor the text moves around the cursor." @@ -178,7 +186,7 @@ to successively recenter to") (define-key ccm-map [(control meta +)] 'ccm-vpos-down) (define-key ccm-map [(control meta =)] 'ccm-vpos-down) (define-key ccm-map [(control meta ?0)] 'ccm-vpos-recenter) - (when mouse-wheel-mode + (when (and (boundp 'mouse-wheel-mode) mouse-wheel-mode) (mapc (lambda (key) (define-key ccm-map key 'ccm-mwheel-scroll)) (list (vector mouse-wheel-up-event) @@ -194,7 +202,7 @@ to successively recenter to") ccm-map) "Keymap used in centered-cursor-mode.") - + (defun ccm-mwheel-scroll (event) "Very similar to `mwheel-scroll', but does not use `scroll-down' and `scroll-up' but `previous-line' and `next-line', that is, the @@ -251,7 +259,7 @@ the movement appears as page up." next-screen-context-lines)))) (forward-line amt))) - + (defun ccm-vpos-down (arg) "Adjust the value of the screen line (where the cursor stays) by arg. Negative values for arg are possible. Just the variable ccm-vpos @@ -385,6 +393,7 @@ centered-cursor-mode is called interactively." (ccm-position-cursor))) ;;(defalias 'ccm 'centered-cursor-mode) +;;;###autoload (define-minor-mode centered-cursor-mode "Makes the cursor stay vertically in a defined position (usually centered)." @@ -413,9 +422,9 @@ position (usually centered)." ;; (info "(elisp)Hooks") ;; (info "(elisp)Customization") ;; (find-function 'mwheel-scroll) - + ;; Local Variables: ;; coding: utf-8 ;; End: - + ;;; centered-cursor-mode.el ends here diff --git a/elpa/centered-cursor-mode-readme.txt b/elpa/centered-cursor-mode-readme.txt new file mode 100644 index 00000000..b062660c --- /dev/null +++ b/elpa/centered-cursor-mode-readme.txt @@ -0,0 +1,16 @@ +Makes the cursor stay vertically in a defined position (usually +centered). The vertical position can be altered, see key definition +below. + +To load put that in .emacs: + (require 'centered-cursor-mode) +To activate do: + M-x centered-cursor-mode +for buffer local or + M-x global-centered-cursor-mode +for global minor mode. +Also possible: put that in .emacs + (and + (require 'centered-cursor-mode) + (global-centered-cursor-mode +1)) +to always have centered-cursor-mode on in all buffers. -- 2.47.3