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

Possible bug in emacspeak-wizards-cycle-browser



Hi Raman,

I've found what I think might be a bug in emacspeak-wizards-cycle-browser, but I'm not sure how you may want to address it. 

The problem appears to be related to how emacspeak-wizards-available-browsers is defined. The current definition is

(defvar emacspeak-wizards-available-browsers
  (delq nil
        (list
         (when
             (or (featurep 'w3) (locate-library "w3"))
           'browse-url-w3)
         (when (or (featurep 'eww)  (locate-library "eww"))'eww-browse-url)
         (when
             (or (featurep 'w3m)  (locate-library "w3m"))'w3m-browse-url)))
  "List of available browsers to cycle through.")

However, this definition does not take into account the current value for browse-url-browser-function. In the 'old days' this probably wasn't an issue as we were pretty much stuck with using w3 or w3m from within emacs. However, these days and thanks to ChromeVox, I tend to use Chrome as my default browser and have my browse-url-browser-function set to browse-url-default-browser.  Unfortunately, this causes emacspeak-wizards-cycle-browser to fail with a Wrong type argument: number-or-marker-p, nil error. 

I believe this error is being caused by the line in the let of the function

(current (position browse-url-browser-function
                            emacspeak-wizards-available-browsers))

which will return nil because none of the values in emacspeak-wiards-available-browsers is in browse-url-browser-function.  As this value is nil, the next line in the function which selects a new browser fails.

Not sure how to fix this. The obvious and trivial fix wold be to just add the value of browse-url-browser-function to the list of available browsers. However, this would have the downside for those who are only using w3 and eww of duplicating one of these browsers in the list and it would not work for those who may have slightly more sophisticated/complex settings for browse-url-browser-function. The other problem is that as emacspeak needs to be loaded early in the init process, it is possible that this package could get loaded before the browse-url library and any user configuration. 

Removing duplicate entries is not that hard, but I wonder if perhaps, given the possible additional complexity of dealing with browdr-url options, perhaps it would be better to change the defvar to a defcustom, use the existing code with addition of browse-url-browser-function (with duplicates removed) as the default and provide users with an easy way to add additional browsers/browser-fuctions if they want?

The 'simple' per user fix would be to just setq a new list with the default-browser function in it, which is what I'll do for now. Happy to provide a more robust patch once I know what your preference is.

Tim

--
regards,

Tim

--
Tim Cross



|All Past Years |Current Year|


If you have questions about this archive or had problems using it, please contact us.

Contact Info Page