Source

vm / vm-mouse.el

Diff from to

vm-mouse.el

 (defvar buffer-file-type)
 
 (defun vm-mouse-send-url-to-mosaic (url &optional new-mosaic new-window)
-  (message "Sending URL to Mosaic...")
-  (if (null new-mosaic)
-      (let ((pid-file "~/.mosaicpid")
-	    (work-buffer " *mosaic work*")
-	    (coding-system-for-read (vm-line-ending-coding-system))
-	    (coding-system-for-write (vm-line-ending-coding-system))
-	    pid)
-	(cond ((file-exists-p pid-file)
-	       (set-buffer (get-buffer-create work-buffer))
-	       (setq selective-display nil)
-	       (erase-buffer)
-	       (insert-file-contents pid-file)
-	       (setq pid (int-to-string (string-to-int (buffer-string))))
-	       (erase-buffer)
-	       (insert (if new-window "newwin" "goto") ?\n)
-	       (insert url ?\n)
-	       ;; newline convention used should be the local
-	       ;; one, whatever that is.
-	       (setq buffer-file-type nil)
-	       (if (fboundp 'set-buffer-file-coding-system)
-		   (set-buffer-file-coding-system
-		    (vm-line-ending-coding-system) nil))
-	       (write-region (point-min) (point-max)
-			     (concat "/tmp/Mosaic." pid)
-			     nil 0)
-	       (set-buffer-modified-p nil)
-	       (kill-buffer work-buffer)))
-	(cond ((or (null pid)
-		   (not (equal 0 (vm-run-command "kill" "-USR1" pid))))
-	       (setq new-mosaic t)))))
-  (if new-mosaic
-     (apply 'vm-run-background-command vm-mosaic-program
-	    (append vm-mosaic-program-switches (list url))))
-  (message "Sending URL to Mosaic... done"))
+  (vm-mouse-send-url-to-xxxx-mosaic 'mosaic url new-mosaic new-window))
+
+(defun vm-mouse-send-url-to-mmosaic (url &optional new-mosaic new-window)
+  (vm-mouse-send-url-to-xxxx-mosaic 'mmosaic url new-mosaic new-window))
+
+(defun vm-mouse-send-url-to-xxxx-mosaic (m-type url &optional
+					 new-mosaic new-window)
+  (let ((what (cond ((eq m-type 'mmosaic) "mMosaic")
+		    (t "Mosaic"))))
+    (message "Sending URL to %s..." what)
+    (if (null new-mosaic)
+	(let ((pid-file (cond ((eq m-type 'mmosaic)
+			       "~/.mMosaic/.mosaicpid")
+			      (t "~/.mosaicpid")))
+	      (work-buffer " *mosaic work*")
+	      (coding-system-for-read (vm-line-ending-coding-system))
+	      (coding-system-for-write (vm-line-ending-coding-system))
+	      pid)
+	  (cond ((file-exists-p pid-file)
+		 (set-buffer (get-buffer-create work-buffer))
+		 (setq selective-display nil)
+		 (erase-buffer)
+		 (insert-file-contents pid-file)
+		 (setq pid (int-to-string (string-to-int (buffer-string))))
+		 (erase-buffer)
+		 (insert (if new-window "newwin" "goto") ?\n)
+		 (insert url ?\n)
+		 ;; newline convention used should be the local
+		 ;; one, whatever that is.
+		 (setq buffer-file-type nil)
+		 (if (fboundp 'set-buffer-file-coding-system)
+		     (set-buffer-file-coding-system
+		      (vm-line-ending-coding-system) nil))
+		 (write-region (point-min) (point-max)
+			       (concat "/tmp/Mosaic." pid)
+			       nil 0)
+		 (set-buffer-modified-p nil)
+		 (kill-buffer work-buffer)))
+	  (cond ((or (null pid)
+		     (not (equal 0 (vm-run-command "kill" "-USR1" pid))))
+		 (setq new-mosaic t)))))
+    (if new-mosaic
+	(apply 'vm-run-background-command
+	       (cond ((eq m-type 'mmosaic) vm-mmosaic-program)
+		     (t vm-mosaic-program))
+	       (append (cond ((eq m-type 'mmosaic) vm-mmosaic-program-switches)
+			     (t vm-mosaic-program-switches))
+		       (list url))))
+    (message "Sending URL to %s... done" what)))
 
 (defun vm-mouse-send-url-to-mosaic-new-window (url)
   (vm-mouse-send-url-to-mosaic url nil t))