[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Search]

Fix for emacspeak-atom-browse with w3m under emacs 21



Hi all,

under emacs 21, the function browse-url-for-buffer generates temporary
file names that do not end in .html. Unfortunately, w3m does not like
to open local files whose file extension does not identify them as
HTML files. Thus, emacspeak commands like emacspeak-atom-browse do not
work properly if browse-url is set up to use w3m. I put a fix at the
end of this e-mail. basically, browser-url-of-buffer is redefined to
use the make-temp-file function from the apel library if emacs 21 is used. You can put the
snippet somewhere in your .emacs file.

Best regards, Lukas

(when (= emacs-major-version 21)
  (require 'poe)
  (require 'browse-url)  
  (defun browse-url-of-buffer (&optional buffer)
	"Ask a WWW browser to display BUFFER.
Display the current buffer if BUFFER is nil.  Display only the
currently visible part of BUFFER (from a temporary file) if buffer is
narrowed."
	(interactive)
	(save-excursion
	  (and buffer (set-buffer buffer))
	  (let ((file-name
			 ;; Ignore real name if restricted
			 (and (= (- (point-max) (point-min)) (buffer-size))
				  (or buffer-file-name
					  (and (boundp 'dired-directory) dired-directory)))))
		(or file-name
			(progn
			  (or browse-url-temp-file-name
				  (setq browse-url-temp-file-name
						(convert-standard-filename
						 (make-temp-file
						  (expand-file-name "burl" browse-url-temp-dir)
						  nil ".html"))))
			  (setq file-name browse-url-temp-file-name)
			  (write-region (point-min) (point-max) file-name nil 'no-message)))
		(browse-url-of-file file-name))))
  )

-----------------------------------------------------------------------------
To unsubscribe from the emacspeak list or change your address on the
emacspeak list send mail to "emacspeak-request@xxxxxxxxxxx" with a
subject of "unsubscribe" or "help"



If you have questions about this archive or had problems using it, please send mail to:

priestdo@xxxxxxxxxxx No Soliciting!

Emacspeak List Archive | 2007 | 2006 | 2005 | 2004 | 2003 | 2002 | 2001 | 2000 | 1999 | 1998 | Pre 1998

Emacspeak Files | Emacspeak Blog