torsten  committed 757e871

removed the parent keymap stuff

  • Participants
  • Parent commits 5454812
  • Branches default

Comments (0)

Files changed (1)

   "Keymap used when point is over the link")
-(defun link-set-parent-keymap (keymap)
-  "Defines `keymap' as parent keymap in the current buffer"
-  ;; Force link-keymap to be local
-  (unless (local-variable-p 'link-keymap (current-buffer))
-    (make-local-variable 'link-keymap))
-  ;; Ensure that keymap is a parent keymap
-  ;; XEmacs defines set-keymap-parents
-  (if (fboundp 'set-keymap-parents)
-      (let ((parents (keymap-parents link-keymap)))
-	(unless (member keymap parents)
-	  (set-keymap-parents link-keymap (append parents (list keymap)))))
-    ;; GNU Emacs knows about set-keymap-parent
-    (set-keymap-parent link-keymap keymap)))
 (defun link-create-link (start end face function &optional data)
   "Create a link in the current buffer starting from `start' going to `end'.
 The `face' is used for displaying, the `data' are stored together with the
 link.  Upon clicking the `function' is called with `data' as argument."
-  (link-set-parent-keymap (current-local-map))
   (let ((properties `(face ,face
 	              mouse-face highlight
 		      link-data ,data
     (insert text)
     (link-create-link start (point) face function data)))
-(defun link-selected ()
+(defun link-selected (&optional all)
   "Is called upon clicking or otherwise visiting the link."
 	 (function (extent-property extent 'link-function))
 	 (data (extent-property extent 'link-data)))
     (if function
-	(funcall function data))))
+	(funcall function data all))))
-(defun link-mouse-click (event)
+(defun link-selected-all ()
+  "Called for meta clicking the link"
+  (interactive)
+  (link-selected 'all))
+(defun link-mouse-click (event &optional all)
   "Is called upon clicking the link."
   (interactive "@e")
   (mouse-set-point event)
+(defun link-mouse-click-all (event)
+  "Is called upon meta clicking the link."
+  (interactive "@e")
+  (mouse-set-point event)
+  (link-selected-all))
 (defun link-next-link ()
   "Return the position of the next link or nil if there is none"
   (let ((oldpos 0)
 	    (setq found (point)))))
+(defun link-remove-link ()
+  "Remove the link at the current position"
+  (let ((extent (extent-at (point) (current-buffer))))
+    (if extent
+	(delete-extent extent))))
 (unless link-keymap
   (setq link-keymap (make-sparse-keymap))
   (define-key link-keymap [button2] 'link-mouse-click)
-  (define-key link-keymap [return] 'link-selected))
+  (define-key link-keymap [(meta button2)] 'link-mouse-click-all)
+  (define-key link-keymap [return] 'link-selected)
+  (define-key link-keymap [(meta return)] 'link-selected-all))
 (provide 'link)