Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added support for except modes.

  • Loading branch information...
commit 3b18d0e1e4233f517c4be9b086998249e8d7c809 1 parent 8e59e6b
@rejeep authored
View
13 drag-stuff.el
@@ -47,6 +47,13 @@
;; Or use the global mode to activate it in all buffers.
;; (drag-stuff-global-mode t)
+;; Drag Stuff stores a list (`drag-stuff-except-modes') of modes in
+;; which `drag-stuff-mode' should not be activated in (note, only if
+;; you use the global mode) because of conflicting use.
+;;
+;; You can add new except modes:
+;; (add-to-list 'drag-stuff-except-modes 'conflicting-mode)
+
;; Default modifier key is the meta-key. This can be changed and is
;; controlled by the variable `drag-stuff-modifier'.
;;
@@ -61,6 +68,9 @@
(eval-when-compile
(require 'cl))
+(defvar drag-stuff-except-modes ()
+ "A list of modes in which `drag-stuff-mode' should not be activated.")
+
(defvar drag-stuff-modifier 'meta
"Modifier key(s) for bindings in `drag-stuff-mode-map'.")
@@ -262,7 +272,8 @@
(defun turn-on-drag-stuff-mode ()
"Turn on `drag-stuff-mode'"
(interactive)
- (drag-stuff-mode +1))
+ (unless (member major-mode drag-stuff-except-modes)
+ (drag-stuff-mode +1)))
;;;###autoload
(defun turn-off-drag-stuff-mode ()
View
25 features/drag-stuff.feature
@@ -26,3 +26,28 @@ Feature: Drag Stuff
line 2
line 1
"""
+
+ Scenario: Global mode except
+ When I load the following:
+ """
+ (setq drag-stuff-except-modes '(text-mode))
+ (drag-stuff-global-mode t)
+ """
+ And major mode is text-mode
+ When I insert:
+ """
+ line 1
+ line 2
+ """
+ And I go to line "1"
+ And I press "<M-down>"
+ Then I should see:
+ """
+ line 1
+ line 2
+ """
+ And I should not see:
+ """
+ line 2
+ line 1
+ """
View
4 features/step-definitions/drag-stuff-steps.el
@@ -3,3 +3,7 @@
(if (string= status "enable")
(turn-on-drag-stuff-mode)
(turn-off-drag-stuff-mode))))
+
+(Given "^major mode is text-mode$"
+ (lambda ()
+ (text-mode)))
Please sign in to comment.
Something went wrong with that request. Please try again.