mlf176f2 pushed a commit to branch externals/ergoemacs-mode in repository elpa.
commit 9812a9336cdb0dfdc8c01c9139c2df3477c195e7 Author: Matthew L. Fidler <[email protected]> Date: Fri Jun 27 08:55:26 2014 -0500 Revert ergoemacs-select-text-in-quote; Make expand-region consistent --- ergoemacs-functions.el | 80 ++++++++---------------------------------------- ergoemacs-macros.el | 12 ------- ergoemacs-themes.el | 2 +- 3 files changed, 14 insertions(+), 80 deletions(-) diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el index 2c47821..e0c8c39 100644 --- a/ergoemacs-functions.el +++ b/ergoemacs-functions.el @@ -532,6 +532,7 @@ This will not honor `shift-select-mode'." ;; Extends behavior of ;; http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/ +(defvar font-lock) (defvar ergoemacs-beginning-of-line-or-what-last-command nil) (declare-function comment-search-backward "newcomment.el") (declare-function comment-search-forward "newcomment.el") @@ -783,9 +784,9 @@ the prefix arguments of `end-of-buffer', ;;; TEXT SELECTION RELATED (defun ergoemacs-select-current-line () - "Select the current line." + "Select the current line" (interactive) - (end-of-line) + (end-of-line) ; move to end of line (set-mark (line-beginning-position))) (defun ergoemacs-select-current-block () @@ -803,72 +804,17 @@ the prefix arguments of `end-of-buffer', (setq p2 (point)))) (set-mark p1))) -(defun ergoemacs-select-text-in-ascii-quote () - "Select text between ASCII quotes, single or double. - -By putting your cursor at ▮ in the following example: - - \"some ▮ \\\"thing\\\" and another\" - -This function should select the whole string." - (interactive) - (let (p1 p2) - (cond - ((and (<= 24 emacs-major-version) - (<= 4 emacs-minor-version)) - (if (nth 3 (syntax-ppss)) - (progn - (ergoemacs-backward-up-list 1 "ESCAPE-STRINGS" "NO-SYNTAX-CROSSING") - (setq p1 (point)) - (forward-sexp 1) - (setq p2 (point)) - (goto-char (1+ p1)) - (set-mark (1- p2))) - (user-error "Cursor not inside quote"))) - ((and font-lock-mode (memq (get-text-property (point) 'face) - '(font-lock-string-face font-lock-doc-face))) - (setq p1 (or (previous-single-property-change (point) 'face (current-buffer) (point-min)) (point-min))) - (setq p2 (or (next-single-property-change (point) 'face (current-buffer) (point-max)) (point-max))) - (goto-char (1+ p1)) - (set-mark (1- p2))) - (font-lock-mode - (user-error "Cursor not inside quote")) - (t - (let (p1) - (skip-chars-backward "^“\"") - (setq p1 (point)) - (skip-chars-forward "^”\"") - (set-mark p1))))))) - -(defun ergoemacs-select-text-in-bracket-or-quote () - "Select text between the nearest brackets. -Bracket here includes: () [] {} «» ‹› “” 〖〗 【】 「」 『』 () 〈〉 - 《》 〔〕 ⦗⦘ 〘〙 ⦅⦆ 〚〛 ⦃⦄ ⟨⟩." - (interactive) - (with-syntax-table (standard-syntax-table) - (modify-syntax-entry ?\« "(»") - (modify-syntax-entry ?\» ")«") - (modify-syntax-entry ?\‹ "(›") - (modify-syntax-entry ?\› ")‹") - (modify-syntax-entry ?\“ "(”") - (modify-syntax-entry ?\” ")“") - (modify-syntax-entry ?\‘ "(’") - (modify-syntax-entry ?\’ ")‘") - (let (pos p1 p2) - (setq pos (point)) - (search-backward-regexp "\\s(" nil t ) - (setq p1 (point)) - (forward-sexp 1) - (setq p2 (point)) - (goto-char (1+ p1)) - (set-mark (1- p2))))) - (defun ergoemacs-select-text-in-quote () - "Select text between the nearest brackets or quote." - (interactive) - (if (nth 3 (syntax-ppss)) - (ergoemacs-select-text-in-ascii-quote) - (ergoemacs-select-text-in-bracket-or-quote))) + "Select text between the nearest left and right delimiters. +Delimiters are paired characters: + () [] {} «» ‹› “” 〖〗 【】 「」 『』 () 〈〉 《》 〔〕 ⦗⦘ 〘〙 ⦅⦆ 〚〛 ⦃⦄ ⟨⟩ + For practical purposes, also: \"\", but not single quotes." + (interactive) + (let (p1) + (skip-chars-backward "^<>([{“「『‹«(〈《〔【〖⦗〘⦅〚⦃⟨\"") + (setq p1 (point)) + (skip-chars-forward "^<>)]}”」』›»)〉》〕】〗⦘〙⦆〛⦄⟩\"") + (set-mark p1))) ;; by Nikolaj Schumacher, 2008-10-20. Released under GPL. (defun ergoemacs-semnav-up (arg) diff --git a/ergoemacs-macros.el b/ergoemacs-macros.el index 20ee71d..89738af 100644 --- a/ergoemacs-macros.el +++ b/ergoemacs-macros.el @@ -429,18 +429,6 @@ This was stole/modified from `c-save-buffer-state'" (buffer-modified-p) (set-buffer-modified-p nil))))) -;;;###autoload - -(defmacro ergoemacs-backward-up-list (arg arg1 arg2) - "Allow the three argument list for emacs 24.4. - -See `backward-up-list' for more information on your emacs -version's implementation of this function." - (cond - ((and (<= 24 emacs-major-version) - (<= 4 emacs-minor-version)) - `(backward-up-list ,arg ,arg1 ,arg2)) - (t `(backward-up-list ,arg)))) (provide 'ergoemacs-macros) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el index 2db1c4c..d8ee01e 100644 --- a/ergoemacs-themes.el +++ b/ergoemacs-themes.el @@ -653,7 +653,7 @@ "Select Items" (global-set-key (kbd "M-S-SPC") 'mark-paragraph) (global-set-key (kbd "M-8") '(er/expand-region ergoemacs-extend-selection)) - (global-set-key (kbd "M-*") '(er/mark-outside-quotes ergoemacs-select-text-in-quote)) + (global-set-key (kbd "M-*") '(er/mark-inside-quotes ergoemacs-select-text-in-quote)) (global-set-key (kbd "M-6") 'ergoemacs-select-current-block) (global-set-key (kbd "M-7") 'ergoemacs-select-current-line))
