[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 04/15: Fix package-list-packages to show: X packages can be upgr
From: |
Matthew Fidler |
Subject: |
[elpa] 04/15: Fix package-list-packages to show: X packages can be upgraded; type `ã€â‡§Shift+U】' to mark them for upgrading. |
Date: |
Sun, 06 Jul 2014 03:56:15 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit 92e0a497ff2be3c267b03035c860309465c4402c
Author: Matthew L. Fidler <address@hidden>
Date: Thu Jul 3 11:35:41 2014 -0500
Fix package-list-packages to show:
X packages can be upgraded; type `ã€â‡§Shift+U】' to mark them for
upgrading.
---
ergoemacs-advices.el | 94 ++++++++++++++++++++++++++++++++-----------------
1 files changed, 61 insertions(+), 33 deletions(-)
diff --git a/ergoemacs-advices.el b/ergoemacs-advices.el
index d8a107b..964caae 100644
--- a/ergoemacs-advices.el
+++ b/ergoemacs-advices.el
@@ -227,8 +227,7 @@ Uses `ergoemacs-real-key-description'."
(declare-function ergoemacs-emulations "ergoemacs-mode.el")
(declare-function ergoemacs-remove-shortcuts "ergoemacs-shortcuts.el")
(defun ergoemacs-substitute-command (string &optional map)
- "Substitutes command STRING
-will add MAP to substitution."
+ "Substitutes command STRING within MAP or currently bound keys."
(save-match-data
(let* (ret
(test (ergoemacs-with-global
@@ -326,38 +325,67 @@ will add MAP to substitution."
(defvar ergoemacs-mode)
(defun ergoemacs-substitute-command-keys (string)
- "`ergoemacs-mode' replacement for substitute-command-keys.
-Actual substitute-command-keys is always in
`ergoemacs-real-substitute-command-keys'"
- (if (not string) nil
- (let (ret str mapvar)
- (if (not ergoemacs-mode)
- (setq ret (ergoemacs-real-substitute-command-keys string))
- (with-temp-buffer
- (insert string)
- (goto-char (point-min))
- (while (re-search-forward
"\\(\\(?:\\\\=\\)?\\)\\\\\\(\\[\\|<\\|{\\)\\(.*?\\)\\(\\]\\|>\\|}\\)" nil t)
+ "Substitute key descriptions for command names in STRING.
+`ergoemacs-mode' replacement for substitute-command-keys.
+
+Actual substitute-command-keys is always in
+`ergoemacs-real-substitute-command-keys'.
+
+Each substring of the form \\=\\[COMMAND] is replaced by either a
+keystroke sequence that invokes COMMAND, or \"M-x COMMAND\" if COMMAND
+is not on any keys.
+
+Each substring of the form \\=\\\{MAPVAR} is replaced by a summary of
+the value of MAPVAR as a keymap. This summary is similar to the one
+produced by `describe-bindings'. The summary ends in two newlines
+ (used by the helper function `help-make-xrefs' to find the end of the
+ summary).
+
+Each substring of the form \\=\\<MAPVAR> specifies the use of MAPVAR
+as the keymap for future \\=\\[COMMAND] substrings.
+\\=\\= quotes the following character and is discarded;
+thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[
into the output.
+
+Return the original STRING if no substitutions are made.
+Otherwise, return a new string, without any text properties."
+ (save-match-data
+ (if (not string) nil
+ (let (ret str mapvar (pt 0) tmp)
+ (if (not ergoemacs-mode)
+ (setq ret (ergoemacs-real-substitute-command-keys string))
+ (while (string-match
"\\(\\(?:\\\\=\\)?\\)\\\\\\(\\[\\|<\\|{\\)\\(.*?\\)\\(\\]\\|>\\|}\\)" string pt)
(cond
- ((string-match-p "\\\\=" (match-string 1))
- (replace-match "\\\\\\2\\3\\4" t nil))
- ((and (string-match-p "<" (match-string 2))
- (string-match-p ">" (match-string 4)))
- (setq mapvar (concat "\\<" (match-string 3) ">"))
- (replace-match ""))
- ((and (string-match-p "{" (match-string 2))
- (string-match-p "}" (match-string 4)))
- (replace-match (ergoemacs-substitute-map (match-string 0)) t t))
- ((and (string-match-p "\\[" (match-string 2))
- (string-match-p "\\]" (match-string 4)))
- (replace-match (ergoemacs-substitute-command (match-string 0)
mapvar) t t))))
- (goto-char (point-min))
- (while (re-search-forward "\\\\=" nil t)
- (replace-match "" t t)
- (re-search-forward "\\=\\\\=" nil t))
- (goto-char (point-min))
- (while (and (not ergoemacs-use-M-x-p) (re-search-forward
"\\(\\<M-x\\|<execute>\\) " nil t))
- (replace-match (ergoemacs-substitute-command
"\\[execute-extended-command] " "\\<global-map>") t t))
- (setq ret (buffer-string))))
- ret)))
+ ((string-match-p "\\\\=" (match-string 1 string))
+ (setq pt (+ (length (match-string 2 string))
+ (length (match-string 3 string))
+ (length (match-string 4 string))
+ (match-beginning 0)))
+ (setq string (replace-match "\\\\\\2\\3\\4" t nil string)))
+ ((and (string-match-p "<" (match-string 2 string))
+ (string-match-p ">" (match-string 4 string)))
+ (setq mapvar (concat "\\<" (match-string 3 string) ">"))
+ (setq string (replace-match "" nil nil string))
+ (setq pt (match-beginning 0)))
+ ((and (string-match-p "{" (match-string 2 string))
+ (string-match-p "}" (match-string 4 string)))
+ (setq tmp (ergoemacs-substitute-map (match-string 0 string)))
+ (setq string (replace-match tmp t t string))
+ (setq pt (+ (length tmp) (match-beginning 0))))
+ ((and (string-match-p "\\[" (match-string 2 string))
+ (string-match-p "\\]" (match-string 4 string)))
+ (setq tmp (ergoemacs-substitute-command (match-string 0 string)
mapvar))
+ (setq string (replace-match tmp t t string))
+ (setq pt (+ (length tmp) (match-beginning 0))))))
+ (setq pt 0 ret string)
+ (while (string-match "\\\\=" ret pt)
+ (setq ret (replace-match "" nil t ret))
+ (setq pt (match-beginning 0))
+ (when (string= "\\=" (substring ret pt (min (+ pt 2) (length
ret))))
+ (setq pt (+ pt 2))))
+ (when (not ergoemacs-use-M-x-p)
+ (setq ret (replace-regexp-in-string "\\(\\<M-x\\|<execute>\\) "
(ergoemacs-substitute-command "\\[execute-extended-command] " "\\<global-map>")
+ ret t t))))
+ ret))))
(declare-function ergoemacs-real-completing-read "ergoemacs-advices.el"
(prompt collection &optional
- [elpa] branch externals/ergoemacs-mode updated (376bdc5 -> e2ab286), Matthew Fidler, 2014/07/05
- [elpa] 01/15: Should fix Issue #251, Matthew Fidler, 2014/07/05
- [elpa] 05/15: Put back C-u -> Ctrl+U instead of Ctrl+u, Matthew Fidler, 2014/07/05
- [elpa] 03/15: Make U-> ã€â‡§Shift+U】, Matthew Fidler, 2014/07/05
- [elpa] 02/15: Check for pkg-dir to load ergoemacs-macros on compile, Matthew Fidler, 2014/07/05
- [elpa] 06/15: Fix website addresses, Matthew Fidler, 2014/07/05
- [elpa] 07/15: Allow short symbols to represent keys, Matthew Fidler, 2014/07/05
- [elpa] 04/15: Fix package-list-packages to show: X packages can be upgraded; type `ã€â‡§Shift+U】' to mark them for upgrading.,
Matthew Fidler <=
- [elpa] 08/15: Add test for U in package list, Matthew Fidler, 2014/07/05
- [elpa] 09/15: Add unbound commands test for C-x C-s, Matthew Fidler, 2014/07/05
- [elpa] 10/15: Fix Issue #264, Matthew Fidler, 2014/07/05
- [elpa] 11/15: declare real-key-binding, Matthew Fidler, 2014/07/05
- [elpa] 12/15: Make package a requirement., Matthew Fidler, 2014/07/05
- [elpa] 14/15: Remove unnecessary file expansion, Matthew Fidler, 2014/07/05
- [elpa] 13/15: remove ergoemacs-unbind-keymap compiler warning, Matthew Fidler, 2014/07/05
- [elpa] 15/15: Merge branch 'externals/ergoemacs-mode' of git+ssh://git.sv.gnu.org/srv/git/emacs/elpa, Matthew Fidler, 2014/07/05