 (if (package-installed-p 'ace-jump-mode)
     (ng/set-keys "C-j" ace-jump-mode))
 
+;; For older versions of emacs
+(unless (fboundp 'use-region-p)
+  (defun use-region-p ()
+    (and transient-mark-mode
+         mark-active
+         (> (region-end) (region-begninng)))))
+
 ;; Designed to be bound to C-a
 (defun ng/move-or-mc-edit-beginning-of-line (&optional arg)
   "If there's an active region, create cursors at the end of each

  "If there is an active region, kill it. Otherwise, kill the following line."
  (interactive "p")
  (if (use-region-p)
      (kill-region (point) (mark))
    (kill-line arg)))

;; Designed to be bound to C-x k -- similar to standard behacvior, but

forward."
  (interactive)
  (if (use-region-p)
      (mc/mark-all-in-region (region-beginning) (region-end))
    (isearch-forward)))

;; Designed to be bound to Alt-F4 to match standard Windows behaviour
