~ubuntu-branches/ubuntu/hardy/vm/hardy

« back to all changes in this revision

Viewing changes to vm-mouse.el

  • Committer: Bazaar Package Importer
  • Author(s): Manoj Srivastava
  • Date: 2005-05-02 23:57:59 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050502235759-lsq60hinwkchrbxp
Tags: 7.19-4
* Bug fix: "vm: Please do not discriminate against XEmacs", thanks to
  Dirk Eddelbuettel. Well, back in the mists of time, VM was packaged to
  be byte-compiled for XEmacs, but the XEmacs maintainer at that time
  asked me to cease and desist. Times change, so that is reverted. 
                                                        (Closes: #306876).
* Bug fix: "vm: purge doesn't", thanks to Ian Zimmerman. This should be
  better.                                               (Closes: #303519).

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
;;; along with this program; if not, write to the Free Software
16
16
;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
17
 
18
 
(provide 'vm-mouse)
 
18
;;(provide 'vm-mouse)
19
19
 
20
20
(defun vm-mouse-set-mouse-track-highlight (start end &optional overlay)
21
21
  (if (null overlay)
181
181
                          (overlay-end o)))
182
182
               (vm-mouse-send-url url browser)))))))
183
183
 
184
 
(defun vm-mouse-send-url (url &optional browser)
 
184
(defun vm-mouse-send-url (url &optional browser switches)
185
185
  (if (string-match "^mailto:" url)
186
186
      (vm-mail-to-mailto-url url)
187
 
    (let ((browser (or browser vm-url-browser)))
 
187
    (let ((browser (or browser vm-url-browser))
 
188
          (switches (or switches vm-url-browser-switches)))
188
189
      (cond ((symbolp browser)
189
190
             (funcall browser url))
190
191
            ((stringp browser)
191
192
             (message "Sending URL to %s..." browser)
192
 
             (vm-run-background-command browser url)
 
193
             (apply 'vm-run-background-command browser
 
194
                    (append switches (list url)))
193
195
             (message "Sending URL to %s... done" browser))))))
194
196
 
195
197
(defun vm-mouse-send-url-to-netscape (url &optional new-netscape new-window)
268
270
(defun vm-mouse-send-url-to-mosaic-new-window (url)
269
271
  (vm-mouse-send-url-to-mosaic url nil t))
270
272
 
 
273
(defun vm-mouse-send-url-to-konqueror (url &optional new-konqueror)
 
274
  (message "Sending URL to Konqueror...")
 
275
  (if new-konqueror
 
276
      (apply 'vm-run-background-command vm-konqueror-program
 
277
             (append vm-konqueror-program-switches (list url)))
 
278
    (or (equal 0 (apply 'vm-run-command vm-konqueror-client-program
 
279
                        (append vm-konqueror-client-program-switches
 
280
                                (list "openURL" url))))
 
281
        (vm-mouse-send-url-to-konqueror url t)))
 
282
  (message "Sending URL to Konqueror... done"))
 
283
 
 
284
(defun vm-mouse-send-url-to-konqueror-new-browser (url)
 
285
  (vm-mouse-send-url-to-konqueror url t))
 
286
 
 
287
(defun vm-mouse-send-url-to-clipboard (url)
 
288
  (message "Sending URL to X Clipboard...")
 
289
  (cond ((fboundp 'own-selection)
 
290
         (own-selection url 'CLIPBOARD))
 
291
        ((fboundp 'x-own-clipboard)
 
292
         (x-own-clipboard url))
 
293
        ((fboundp 'x-own-selection-internal)
 
294
         (x-own-selection-internal 'CLIPBOARD url)))
 
295
  (message "Sending URL to X Clipboard... done"))
 
296
 
 
297
;; this code courtesy Thomas F. Burdick
 
298
(defun vm-mouse-send-url-to-safari (url)
 
299
  "Sends URL to Safari, using Apple's Open Scripting Architecture."
 
300
  (message "Sending URL to Safari...")
 
301
  (with-temp-buffer
 
302
    (insert "tell application \"Safari\"\n")
 
303
    (insert " activate\n")
 
304
    (insert " make new document at the beginning of documents\n")
 
305
    (insert (format " set the URL of the front document to \"%s\"\n" url))
 
306
    (insert "end tell\n")
 
307
    (call-process-region (point-min) (point-max) "/usr/bin/osascript"))
 
308
  (message "Sending URL to Safari... done"))
 
309
 
271
310
(defun vm-mouse-install-mouse ()
272
311
  (cond ((vm-mouse-xemacs-mouse-p)
273
312
         (if (null (lookup-key vm-mode-map 'button2))
536
575
  (if normal-exit
537
576
      (throw 'exit nil)
538
577
    (throw 'exit t)))
 
578
 
 
579
(provide 'vm-mouse)