Anonymous committed ad3d7e9

* Added goto-[begin/end]-of-buffer in mc/mode
* Additional hacking with TM mode.

  • Participants
  • Parent commits 10bebdb

Comments (0)

Files changed (3)

 (setq mc/cmds-to-run-for-all
+        mc/goto-end-of-region


   (setq mc/keymap (make-sparse-keymap))
   (define-key mc/keymap (kbd "C-g") 'mc/keyboard-quit)
+  (define-key mc/keymap (kbd "C-c e") 'mc/goto-end-of-region)
+  (define-key mc/keymap (kbd "C-c a") 'mc/goto-beginning-of-region)
   (define-key mc/keymap (kbd "<return>") 'multiple-cursors-mode))
+(defun mc/goto-beginning-of-region ()
+  (interactive)
+  (goto-char (region-beginning)))
+(defun mc/goto-end-of-region ()
+  (interactive)
+  (goto-char (region-end)))
 (defun mc--all-equal (entries)
   "Are all these entries equal?"
   (let ((first (car entries))


   :group 'textmate)
 (make-variable-buffer-local 'tm/dont-activate)
+(defun get-buffer-mode ()
+  "Returns the major mode associated with a buffer."
+  (with-current-buffer (current-buffer) major-mode))
 (defun tm/initialize ()
   "Do the necessary initialization"
   (setq skeleton-pair t)
 (defun tm/minor-mode-on ()
+  "We do not turn this on in minibuffer, [backspace] messes up the ido"
-  (tm/minor-mode 1))
+  (unless (eq (get-buffer-mode) 'minibuffer-inactive-mode)
+    (tm/minor-mode 1)))
 (defun tm/minor-mode-off ()
   (define-key tm/minor-mode-map [backspace] 'tm/pair-backspace)
   (dolist (arg skeleton-pair-alist)
     (define-key tm/minor-mode-map (string (car arg)) 'tm/pair-insert)
-    (define-key tm/minor-mode-map (string (car (last arg))) 'tm/pair-insert))
+    (define-key tm/minor-mode-map (condition-case ex
+                                      (string (car (last arg)))
+                                    ('error (car (last arg)))) 'tm/pair-insert))
   (add-to-list 'minor-mode-map-alist (cons 'tm/minor-mode tm/minor-mode-map)))
 (defun tm/pair-insert (arg)
   (interactive "P")
-  (let ((ignore-list (car (last (assoc major-mode tm/non-insert-alist))))
-        (keys (recent-keys)))
+  (let* ((ignore-list (car (last (assoc major-mode tm/non-insert-alist))))
+         (keys (recent-keys))
+         (last-but-one-char (elt keys (- (length keys) 2)))
+         (pair (assq last-but-one-char skeleton-pair-alist)))
      ((member last-command-event ignore-list)
       (insert-char last-command-event 1))
      ((assq last-command-event skeleton-pair-alist)
       (tm/pair-open arg))
-     ((assq (elt keys (- (length keys) 2)) skeleton-pair-alist)
+     ((and pair
+           (eq (char-after) (car (last pair))))
       (tm/pair-close arg)))
      ;; in string or comment face, do not autoinsert pairs
      ;; crude! rely on the mode's hilighting and enabled faces
      ((or (eq 'font-lock-string-face face)
+          (eq 'font-lock-doc-face face)
           (eq 'font-lock-comment-face face))
       (self-insert-command (prefix-numeric-value arg)))
      ((and (not mark-active)
     (if pairfromlist
         (let* ((closing-pair (car (last pairfromlist)))
               (pairchar (condition-case ex
-                            (setq retval (string-to-char closing-pair))
+                            (string-to-char closing-pair)
                           ('error closing-pair))))
           (if (eq (char-after)
               (and (char-after) (delete-char 1))))))
   (if (eq tm/backspace-delete-column t)
-    (delete-backward-char 1))))
+    (delete-backward-char 1)))
 ;; Thanks to Trey Jackson