[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 219/287: `ergoemacs-select-text-in-quote' can now deal with escap
From: |
Matthew Fidler |
Subject: |
[elpa] 219/287: `ergoemacs-select-text-in-quote' can now deal with escaped quote in string. |
Date: |
Wed, 02 Jul 2014 14:46:09 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit 4bf715ff25141471305feb735ecc7dfc73bbe48e
Author: Xah Lee <address@hidden>
Date: Wed Jun 25 22:36:09 2014 -0700
`ergoemacs-select-text-in-quote' can now deal with escaped quote in
string.
---
ergoemacs-functions.el | 57 +++++++++++++++++++++++++++++++++++++----------
1 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el
index e21432e..e8bbd42 100644
--- a/ergoemacs-functions.el
+++ b/ergoemacs-functions.el
@@ -771,9 +771,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) ; move to end of line
+ (end-of-line)
(set-mark (line-beginning-position)))
(defun ergoemacs-select-current-block ()
@@ -791,17 +791,50 @@ 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."
+ (interactive)
+ (let (p1 p2)
+ (if (nth 3 (syntax-ppss))
+ (progn
+ (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)))
+ (progn
+ (user-error "Cursor not inside quote")))))
+
+(defun ergoemacs-select-text-in-bracket ()
+ "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 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)))
+ "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)))
;; by Nikolaj Schumacher, 2008-10-20. Released under GPL.
(defun ergoemacs-semnav-up (arg)
- [elpa] 220/287: Partial Fix for Issue #243, (continued)
- [elpa] 220/287: Partial Fix for Issue #243, Matthew Fidler, 2014/07/02
- [elpa] 222/287: Merge branch 'master' of github.com:ergoemacs/ergoemacs-mode, Matthew Fidler, 2014/07/02
- [elpa] 221/287: Be more careful with links. Issue #247, Matthew Fidler, 2014/07/02
- [elpa] 225/287: Added disabling to redo based on undo-tree-mode, Matthew Fidler, 2014/07/02
- [elpa] 218/287: Merge branch 'master' of github.com:ergoemacs/ergoemacs-mode, Matthew Fidler, 2014/07/02
- [elpa] 231/287: Change layout descriptions, Matthew Fidler, 2014/07/02
- [elpa] 229/287: Fix order of operations, Matthew Fidler, 2014/07/02
- [elpa] 226/287: Remove default redo keys; Possibly Fix Issue #242, Matthew Fidler, 2014/07/02
- [elpa] 224/287: Make undo-tree the default undo method and installed when ergoemacs-mode is installed. Issue #242, Matthew Fidler, 2014/07/02
- [elpa] 228/287: Add `cua-rect` require so that tests pass, Matthew Fidler, 2014/07/02
- [elpa] 219/287: `ergoemacs-select-text-in-quote' can now deal with escaped quote in string.,
Matthew Fidler <=
- [elpa] 233/287: Change the default option back, Matthew Fidler, 2014/07/02
- [elpa] 230/287: Fix `ergoemacs-beginning-of-line-or-what` and `ergoemacs-end-of-line-or-what`, Matthew Fidler, 2014/07/02
- [elpa] 227/287: Be more careful of cua--rectangle, Matthew Fidler, 2014/07/02
- [elpa] 232/287: Fix beginning of line function again..., Matthew Fidler, 2014/07/02
- [elpa] 238/287: Fix warnings for cua-clear-rectangle-mark., Matthew Fidler, 2014/07/02
- [elpa] 240/287: Move the fixed bracket moving to the bracket theme component., Matthew Fidler, 2014/07/02
- [elpa] 236/287: add electric-pair-made as an option, Matthew Fidler, 2014/07/02
- [elpa] 237/287: Expanded outlook integration with Emacs org-mode, Matthew Fidler, 2014/07/02
- [elpa] 234/287: Make comment-search-backward less fragile, Matthew Fidler, 2014/07/02
- [elpa] 235/287: Add the uri encoding function, Matthew Fidler, 2014/07/02