2022-07-10 02:24:30 +02:00
|
|
|
;;; browse-url.el --- pass a URL to a web browser -*- lexical-binding: t; -*-
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2024-01-02 09:47:10 +08:00
|
|
|
;; Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
;; Author: Denis Howe <dbh@doc.ic.ac.uk>
|
2019-05-25 13:43:06 -07:00
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
2000-03-20 13:12:14 +00:00
|
|
|
;; Created: 03 Apr 1995
|
|
|
|
;; Keywords: hypertext, hypermedia, mouse
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 07:31:51 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-03-20 13:12:14 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 07:31:51 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
2022-07-10 02:24:30 +02:00
|
|
|
;; This package provides functions which read a URL from the
|
|
|
|
;; minibuffer, defaulting to the URL around point, and ask a web
|
|
|
|
;; browser to load it. It can also load the URL at point, or one
|
|
|
|
;; associated with the current buffer. The main functions are:
|
|
|
|
|
|
|
|
;; `browse-url' Open URL
|
|
|
|
;; `browse-url-at-point' Open URL at point
|
|
|
|
;; `browse-url-of-buffer' Use web browser to display buffer
|
|
|
|
;; `browse-url-of-file' Use web browser to display file
|
|
|
|
|
|
|
|
;; Different browsers use different methods of remote control so there
|
|
|
|
;; is one function for each supported browser. If the chosen browser
|
|
|
|
;; is not running, it is started. Currently there is support for the
|
|
|
|
;; following browsers, as well as some other obsolete ones:
|
2000-08-15 11:17:17 +00:00
|
|
|
|
|
|
|
;; Function Browser Earliest version
|
2005-06-18 10:36:11 +00:00
|
|
|
;; browse-url-firefox Firefox Don't know (tried with 1.0.1)
|
2016-01-24 14:37:38 -05:00
|
|
|
;; browse-url-chrome Chrome 47.0.2526.111
|
2011-10-19 12:03:39 +03:00
|
|
|
;; browse-url-chromium Chromium 3.0
|
2021-12-07 18:57:48 +01:00
|
|
|
;; browse-url-epiphany GNOME Web (Epiphany) Don't know
|
Add support for the Haiku operating system and its window system
* .gitignore: Add binaries specific to Haiku.
* Makefie.in (HAVE_BE_APP): New variable.
(install-arch-dep): Install Emacs and Emacs.pdmp when
using Haiku.
* configure.ac: Detect and configure for Haiku and
various related configurations.
(be-app, be-freetype, be-cairo): New options.
(HAVE_BE_APP, HAIKU_OBJ, HAIKU_CXX_OBJ)
(HAIKU_LIBS, HAIKU_CFLAGS): New variables.
(HAIKU, HAVE_TINY_SPEED_T): New define.
(emacs_config_features): Add BE_APP.
* doc/emacs/Makefile.in (EMACSSOURCES): Add Haiku
appendix.
* doc/emacs/emacs.texi: Add Haiku appendix to menus and
include it.
* doc/emacs/haiku.texi: New Haiku appendix.
* doc/lispref/display.texi (Defining Faces, Window Systems):
Explain meaning of `haiku' as a window system identifier.
(haiku-use-system-tooltips): Explain meaning of system
tooltips on
Haiku.
* doc/lispref/frames.texi (Multiple Terminals): Explain
meaning of haiku as a display type.
(Frame Layout): Clarify section for Haiku frames.
(Size Parameters): Explain limitations of fullwidth and
fullheight on Haiku.
(Management Parameters): Explain limitations of
inhibiting double buffering on builds with Cairo,
and the inability of frames with no-accept-focus to
receive keyboard input on Haiku.
(Font and Color Parameters): Explain the different font
backends available on Haiku.
(Raising and Lowering): Explain that lowering and
restacking frames doesn't work on Haiku.
(Child Frames): Explain oddities of child frame
visibility on Haiku.
* doc/lispref/os.texi (System Environment): Explain
meaning of haiku.
* etc/MACHINES: Add appropriate notices for Haiku.
* etc/NEWS: Document changes.
* etc/PROBLEMS: Document font spacing bug on Haiku.
* lib-src/Makefile.in: Build be-resources binary on
Haiku.
(CXX, CXXFLAGS, NON_CXX_FLAGS, ALL_CXXFLAGS)
(HAVE_BE_APP, HAIKU_LIBS, HAIKU_CFLAGS): New variables.
(DONT_INSTALL): Add be-resources binary if on Haiku.
(be-resources): New target.
* lib-src/be_resources: Add helper binary for setting
resources on the Emacs application.
* lib-src/emacsclient.c (decode_options): Set
alt_display to "be" on Haiku.
* lisp/cus-edit.el (custom-button, custom-button-mouse)
(custom-button-unraised, custom-button-pressed): Update
face definitions for Haiku.
* lisp/cus-start.el: Add haiku-debug-on-fatal-error and
haiku-use-system-tooltips.
* lisp/faces.el (face-valid-attribute-values): Clarify
attribute comment for Haiku.
(tool-bar): Add appropriate toolbar color for Haiku.
* lisp/frame.el (haiku-frame-geometry)
(haiku-mouse-absolute-pixel-position)
(haiku-set-mouse-absolute-pixel-position)
(haiku-frame-edges)
(haiku-frame-list-z-order): New function declarations.
(frame-geometry, frame-edges)
(mouse-absolute-pixel-position)
(set-mouse-absolute-pixel-position)
(frame-list-z-order): Call appropriate window system
functions on Haiku.
(display-mouse-p, display-graphic-p)
(display-images-p, display-pixel-height)
(display-pixel-width, display-mm-height)
(display-mm-width, display-backing-store)
(display-save-under, display-planes)
(display-color-cells, display-visual-class): Update type
tests for Haiku.
* lisp/international/mule-cmds.el
(set-coding-system-map): Also
prevent set-terminal-coding-system from appearing in the menu
bar on Haiku.
* lisp/loadup.el: Load Haiku-specific files when built
with Haiku, and don't rename newly built Emacs on Haiku as BFS
doesn't support hard links.
* lisp/menu-bar.el (menu-bar-open): Add for Haiku.
* lisp/mwheel.el (mouse-wheel-down-event): Expect
wheel-up on Haiku.
(mouse-wheel-up-event): Expect wheel-down on Haiku.
(mouse-wheel-left-event): Expect wheel-left on Haiku.
(mouse-wheel-right-event): Expect wheel-right on Haiku.
* lisp/net/browse-url.el
(browse-url--browser-defcustom-type):
Add option for WebPositive.
(browse-url-webpositive-program): New variable.
(browse-url-default-program): Search for WebPositive.
(browse-url-webpositive): New function.
* lisp/net/eww.el (eww-form-submit, eww-form-file)
(eww-form-checkbox, eww-form-select): Define faces
appropriately for Haiku.
* lisp/term/haiku-win.el: New file.
* lisp/tooltip.el (menu-or-popup-active-p): New function
declaration.
(tooltip-show-help): Don't use tooltips on Haiku when a
menu is active.
* lisp/version.el (haiku-get-version-string): New
function declaration.
(emacs-version): Add Haiku version string if
appropriate.
* src/Makefile.in: Also produce binary named "Emacs"
with Haiku resources set.
(CXX, HAIKU_OBJ, HAIKU_CXX_OBJ, HAIKU_LIBS)
(HAIKU_CFLAGS, HAVE_BE_APP, NON_CXX_FLAGS)
(ALL_CXX_FLAGS): New variables.
(.SUFFIXES): Add .cc.
(.cc.o): New target.
(base_obj): Add Haiku C objects.
(doc_obj, obj): Split objects that should scanned for
documentation into doc_obj.
(SOME_MACHINE_OBJECTS): Add appropriate Haiku C objects.
(all): Depend on Emacs and Emacs.pdmp on Haiku.
(LIBES): Add Haiku libraries.
(gl-stamp)
($(etc)/DOC): Scan doc_obj instead of obj
(temacs$(EXEEXT): Use C++ linker on Haiku.
(ctagsfiles3): New variable.
(TAGS): Scan C++ files.
* src/alloc.c (garbage_collect): Mark Haiku display.
* src/dispextern.h (HAVE_NATIVE_TRANSFORMS): Also enable
on Haiku.
(struct image): Add fields for Haiku transforms.
(RGB_PIXEL_COLOR): Define to unsigned long on Haiku as
well.
(sit_for): Also check USABLE_SIGPOLL.
(init_display_interactive): Set initial window system to
Haiku on Haiku builds.
* src/emacs.c (main): Define Haiku syms and init haiku
clipboard.
(shut_down_emacs): Quit BApplication on Haiku and
trigger debug
on aborts if haiku_debug_on_fatal_error.
(Vsystem_type): Update docstring.
* src/fileio.c (next-read-file-uses-dialog-p): Enable on
Haiku.
* src/filelock.c (WTMP_FILE): Only define if BOOT_TIME
is also defined.
* src/floatfns.c (double_integer_scale): Work around
Haiku libroot brain damage.
* src/font.c (syms_of_font): Define appropriate font
driver symbols for Haiku builds with various options.
* src/font.h: Also enable ftcrfont on Haiku builds with
Cairo.
(font_data_structures_may_be_ill_formed): Also enable on
Haiku builds that have Cairo.
* src/frame.c (Fframep): Update doc-string for Haiku
builds and return haiku if appropriate.
(syms_of_frame): New symbol `haiku'.
* src/frame.h (struct frame): Add output data for Haiku.
(FRAME_HAIKU_P): New macro.
(FRAME_WINDOW_P): Test for Haiku frames as well.
* src/ftcrfont.c (RED_FROM_ULONG, GREEN_FROM_ULONG)
(BLUE_FROM_ULONG): New macros.
(ftcrfont_draw): Add haiku specific code for Haiku
builds with Cairo.
* src/ftfont.c (ftfont_open): Set face.
(ftfont_has_char, ftfont_text_extents): Work around
crash.
(syms_of_ftfont): New symbol `mono'.
* src/ftfont.h (struct font_info): Enable Cairo-specific
fields for Cairo builds on Haiku.
* src/haiku_draw_support.cc:
* src/haiku_font_support.cc:
* src/haiku_io.c:
* src/haiku_select.cc:
* src/haiku_support.cc:
* src/haiku_support.h:
* src/haikufns.c:
* src/haikufont.c:
* src/haikugui.h:
* src/haikuimage.c:
* src/haikumenu.c:
* src/haikuselect.c:
* src/haikuselect.h:
* src/haikuterm.c:
* src/haikuterm.h: Add new files for Haiku windowing
support.
* src/haiku.c: Add new files for Haiku operating system
support.
* src/image.c: Implement image transforms and native XPM
support
on Haiku.
(GET_PIXEL, PUT_PIXEL, NO_PIXMAP)
(PIX_MASK_RETAIN, PIX_MASK_DRAW)
(RGB_TO_ULONG, RED_FROM_ULONG, GREEN_FROM_ULONG)
(BLUE_FROM_ULONG, RED16_FROM_ULONG, GREEN16_FROM_ULONG)
(BLUE16_FROM_ULONG): Define to appropriate values on
Haiku.
(image_create_bitmap_from_data): Add Haiku support.
(image_create_bitmap_from_file): Add TODO on Haiku.
(free_bitmap_record): Free bitmap on Haiku.
(image_size_in_bytes): Implement for Haiku bitmaps.
(image_set_transform): Implement on Haiku.
(image_create_x_image_and_pixmap_1): Implement on Haiku,
24-bit or 1-bit only.
(image_destroy_x_image, image_get_x_image): Use correct
img and pixmap values on Haiku.
(lookup_rgb_color): Use correct macro on Haiku.
(image_to_emacs_colors): Implement on Haiku.
(image_disable_image): Disable on Haiku.
(image_can_use_native_api): Test for translator presence
on Haiku.
(native_image_load): Use translator on Haiku.
(imagemagick_load_image): Add Haiku-specific quirks.
(Fimage_transforms_p): Allow rotate90 on Haiku.
(image_types): Enable native XPM support on Haiku.
(syms_of_image): Enable XPM images on Haiku.
* src/keyboard.c (kbd_buffer_get_event)
(handle_async_input, handle_input_available_signal)
(handle_user_signal, Fset_input_interrupt_mode)
(init_keyboard): Check for USABLE_SIGPOLL along with
USABLE_SIGIO.
* src/lisp.h (pD): Work around broken Haiku headers.
(HAVE_EXT_MENU_BAR): Define on Haiku.
(handle_input_available_signal): Enable if we just have
SIGPOLL as well.
* src/menu.c (have_boxes): Return true on Haiku.
(single_menu_item): Enable toolkit menus on Haiku.
(find_and_call_menu_selection): Also enable on Haiku.
* src/process.c (keyboard_bit_set): Enable with only
usable SIGPOLL.
(wait_reading_process_output): Test for SIGPOLL as well
as SIGIO availability.
* src/sound.c (sound_perror, vox_open)
(vox_configure, vox_close): Enable for usable SIGPOLL as
well.
* src/sysdep.c (sys_subshell): Enable for usable SIGPOLL.
(reset_sigio): Make conditional on F_SETOWN.
(request_sigio, unrequest_sigio)
(emacs_sigaction_init): Also handle SIGPOLLs.
(init_sys_modes): Disable TCXONC usage on Haiku, as it
doesn't have any ttys other than pseudo ttys, which don't
support C-s/C-q flow control, and causes compiler warnings.
(speeds): Disable high speeds if HAVE_TINY_SPEED_T.
* src/termhooks.h (enum output_method): Add output_haiku.
(struct terminal): Add Haiku display info.
(TERMINAL_FONT_CACHE): Enable for Haiku.
* src/terminal.c (Fterminal_live_p): Return `haiku' if
appropriate.
* src/verbose.mk.in (AM_V_CXX, AM_V_CXXLD): New logging
variables.
* src/xdisp.c (redisplay_internal)
(note_mouse_highlight): Return on Haiku if a popup is activated.
(display_menu_bar): Return on Haiku if frame is a Haiku
frame.
* src/xfaces.c (GCGraphicsExposures): Enable correctly on Haiku.
(x_create_gc): Enable dummy GC code on Haiku.
* src/xfns.c (x-server-version, x-file-dialog): Add
Haiku specifics to doc strings.
* src/xterm.c (syms_of_xterm): Add Haiku information to
doc string.
2021-11-20 21:30:08 +08:00
|
|
|
;; browse-url-webpositive WebPositive 1.2-alpha (Haiku R1/beta3)
|
2022-07-10 02:24:30 +02:00
|
|
|
;; browse-url-text-* Any text browser 0
|
2000-08-15 11:17:17 +00:00
|
|
|
;; browse-url-generic arbitrary
|
|
|
|
;; browse-url-default-windows-browser MS-Windows browser
|
2016-11-06 00:33:43 -07:00
|
|
|
;; browse-url-default-macosx-browser macOS browser
|
2017-03-09 19:01:19 -08:00
|
|
|
;; browse-url-xdg-open freedesktop.org xdg-open
|
2001-05-18 11:27:38 +00:00
|
|
|
;; browse-url-kde KDE konqueror (kfm)
|
2007-09-07 04:37:01 +00:00
|
|
|
;; browse-url-elinks Elinks Don't know (tried with 0.12.GIT)
|
2023-01-24 17:31:16 +08:00
|
|
|
;; browse-url-default-android-browser Android 2.3.3 (should work on 2.2 too)
|
2021-06-07 20:41:30 +02:00
|
|
|
;; eww-browse-url Emacs Web Wowser
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2022-07-10 02:24:30 +02:00
|
|
|
;; Browsers can cache web pages so it may be necessary to tell them to
|
2015-03-17 17:09:34 -07:00
|
|
|
;; reload the current page if it has changed (e.g., if you have edited
|
2000-03-20 13:12:14 +00:00
|
|
|
;; it). There is currently no perfect automatic solution to this.
|
|
|
|
|
2022-07-10 02:24:30 +02:00
|
|
|
;; See also the ffap.el package. The huge hyperbole package also
|
|
|
|
;; contains similar functions.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Usage
|
|
|
|
|
|
|
|
;; To display the URL at or before point:
|
|
|
|
;; M-x browse-url-at-point RET
|
|
|
|
;; or, similarly but with the opportunity to edit the URL extracted from
|
|
|
|
;; the buffer, use:
|
|
|
|
;; M-x browse-url
|
|
|
|
|
2012-09-17 13:41:04 +08:00
|
|
|
;; To display a URL by shift-clicking on it, put this in your init file:
|
2000-03-20 13:12:14 +00:00
|
|
|
;; (global-set-key [S-mouse-2] 'browse-url-at-mouse)
|
|
|
|
;; (Note that using Shift-mouse-1 is not desirable because
|
|
|
|
;; that event has a standard meaning in Emacs.)
|
|
|
|
|
|
|
|
;; To display the current buffer in a web browser:
|
|
|
|
;; M-x browse-url-of-buffer RET
|
|
|
|
|
|
|
|
;; To display the current region in a web browser:
|
|
|
|
;; M-x browse-url-of-region RET
|
|
|
|
|
|
|
|
;; In Dired, to display the file named on the current line:
|
|
|
|
;; M-x browse-url-of-dired-file RET
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2022-07-10 02:24:30 +02:00
|
|
|
;; Customization (Init File)
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
;; To see what variables are available for customization, type
|
|
|
|
;; `M-x set-variable browse-url TAB'. Better, use
|
|
|
|
;; `M-x customize-group browse-url'.
|
|
|
|
|
2022-07-10 02:24:30 +02:00
|
|
|
;; Bind the browse-url commands to keys with the `C-c C-z' prefix:
|
|
|
|
|
2022-06-23 21:51:19 +02:00
|
|
|
;; (keymap-global-set "C-c C-z ." 'browse-url-at-point)
|
|
|
|
;; (keymap-global-set "C-c C-z b" 'browse-url-of-buffer)
|
|
|
|
;; (keymap-global-set "C-c C-z r" 'browse-url-of-region)
|
|
|
|
;; (keymap-global-set "C-c C-z u" 'browse-url)
|
|
|
|
;; (keymap-global-set "C-c C-z v" 'browse-url-of-file)
|
2000-03-20 13:12:14 +00:00
|
|
|
;; (add-hook 'dired-mode-hook
|
|
|
|
;; (lambda ()
|
2022-06-23 21:51:19 +02:00
|
|
|
;; (keymap-local-set "C-c C-z f" 'browse-url-of-dired-file)))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2000-08-15 11:17:17 +00:00
|
|
|
;; Browse URLs in mail messages under RMAIL by clicking mouse-2:
|
2000-03-20 13:12:14 +00:00
|
|
|
;; (add-hook 'rmail-mode-hook (lambda () ; rmail-mode startup
|
2022-06-23 21:51:19 +02:00
|
|
|
;; (keymap-set rmail-mode-map [mouse-2] 'browse-url-at-mouse)))
|
2000-08-15 11:17:17 +00:00
|
|
|
;; Alternatively, add `goto-address' to `rmail-show-message-hook'.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2000-08-15 11:17:17 +00:00
|
|
|
;; Gnus provides a standard feature to activate URLs in article
|
|
|
|
;; buffers for invocation of browse-url.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2022-07-07 13:25:23 +02:00
|
|
|
;; Use the Emacs Web Wowser (EWW) when not running under X11:
|
2000-03-20 13:12:14 +00:00
|
|
|
;; (or (eq window-system 'x)
|
2022-07-07 13:25:23 +02:00
|
|
|
;; (setq browse-url-browser-function #'eww-browse-url))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
;; To always save modified buffers before displaying the file in a browser:
|
|
|
|
;; (setq browse-url-save-file t)
|
|
|
|
|
2020-05-04 11:24:08 +02:00
|
|
|
;; To invoke different browsers/tools for different URLs, customize
|
|
|
|
;; `browse-url-handlers'. In earlier versions of Emacs, the same
|
|
|
|
;; could be done by setting `browse-url-browser-function' to an alist
|
|
|
|
;; but this usage is deprecated now.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2020-05-07 13:02:13 +02:00
|
|
|
;; All browser functions provided by here have a
|
|
|
|
;; `browse-url-browser-kind' symbol property set to either `internal'
|
|
|
|
;; or `external' which determines if they browse the given URL inside
|
|
|
|
;; Emacs or spawn an external application with it. Some parts of
|
|
|
|
;; Emacs make use of that, e.g., when an URL is dragged into Emacs, it
|
|
|
|
;; is not sensible to invoke an external browser with it, so here only
|
|
|
|
;; internal browsers are considered. Therefore, it is advised to put
|
|
|
|
;; that property also on custom browser functions.
|
2020-05-10 20:41:42 +02:00
|
|
|
;; (function-put 'my-browse-url-in-emacs 'browse-url-browser-kind
|
|
|
|
;; 'internal)
|
|
|
|
;; (function-put 'my-browse-url-externally 'browse-url-browser-kind
|
|
|
|
;; 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;;; Code:
|
|
|
|
|
2020-10-17 11:24:03 +02:00
|
|
|
(require 'url)
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Variables
|
|
|
|
|
|
|
|
(defgroup browse-url nil
|
|
|
|
"Use a web browser to look at a URL."
|
|
|
|
:prefix "browse-url-"
|
2000-03-26 18:34:30 +00:00
|
|
|
:link '(emacs-commentary-link "browse-url")
|
2010-03-12 12:47:22 -05:00
|
|
|
:group 'external
|
2010-03-12 14:13:38 -05:00
|
|
|
:group 'comm)
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2019-07-28 15:55:31 +02:00
|
|
|
(defvar browse-url--browser-defcustom-type
|
2022-07-09 17:47:33 +02:00
|
|
|
`(choice
|
|
|
|
(function-item :tag "Emacs Web Wowser (EWW)" :value eww-browse-url)
|
2019-07-28 15:55:31 +02:00
|
|
|
(function-item :tag "Firefox" :value browse-url-firefox)
|
|
|
|
(function-item :tag "Google Chrome" :value browse-url-chrome)
|
|
|
|
(function-item :tag "Chromium" :value browse-url-chromium)
|
2021-12-07 18:57:48 +01:00
|
|
|
(function-item :tag "GNOME Web (Epiphany)" :value browse-url-epiphany)
|
2022-07-09 17:47:33 +02:00
|
|
|
,@(when (eq system-type 'haiku)
|
|
|
|
(list '(function-item :tag "WebPositive" :value browse-url-webpositive)))
|
2019-07-28 15:55:31 +02:00
|
|
|
(function-item :tag "Text browser in an xterm window"
|
|
|
|
:value browse-url-text-xterm)
|
|
|
|
(function-item :tag "Text browser in an Emacs window"
|
|
|
|
:value browse-url-text-emacs)
|
|
|
|
(function-item :tag "KDE" :value browse-url-kde)
|
|
|
|
(function-item :tag "Elinks" :value browse-url-elinks)
|
|
|
|
(function-item :tag "Specified by `Browse Url Generic Program'"
|
2022-07-09 17:47:33 +02:00
|
|
|
:value browse-url-generic)
|
|
|
|
,@(when (eq system-type 'windows-nt)
|
|
|
|
(list '(function-item :tag "Default Windows browser"
|
|
|
|
:value browse-url-default-windows-browser)))
|
|
|
|
,@(when (eq system-type 'darwin)
|
|
|
|
(list '(function-item :tag "Default macOS browser"
|
|
|
|
:value browse-url-default-macosx-browser)))
|
2023-01-24 17:31:16 +08:00
|
|
|
,@(when (eq system-type 'android)
|
|
|
|
(list '(function-item :tag "Default Android browser"
|
|
|
|
:value browse-url-default-android-browser)))
|
2019-07-28 15:55:31 +02:00
|
|
|
(function-item :tag "Default browser"
|
|
|
|
:value browse-url-default-browser)
|
|
|
|
(function :tag "Your own function")
|
|
|
|
(alist :tag "Regexp/function association list"
|
2020-05-04 11:24:08 +02:00
|
|
|
:key-type regexp :value-type function
|
|
|
|
:format "%{%t%}\n%d%v\n"
|
|
|
|
:doc "Deprecated. Use `browse-url-handlers' instead.")))
|
2019-07-28 15:55:31 +02:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;###autoload
|
2019-07-28 15:55:31 +02:00
|
|
|
(defcustom browse-url-browser-function 'browse-url-default-browser
|
2007-08-23 18:41:14 +00:00
|
|
|
"Function to display the current buffer in a WWW browser.
|
2000-03-20 13:12:14 +00:00
|
|
|
This is used by the `browse-url-at-point', `browse-url-at-mouse', and
|
|
|
|
`browse-url-of-file' commands.
|
|
|
|
|
2020-05-04 11:24:08 +02:00
|
|
|
Also see `browse-url-secondary-browser-function' and
|
|
|
|
`browse-url-handlers'."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type browse-url--browser-defcustom-type
|
|
|
|
:version "24.1")
|
|
|
|
|
2019-07-29 00:07:34 +02:00
|
|
|
(defcustom browse-url-secondary-browser-function 'browse-url-default-browser
|
|
|
|
"Function used to launch an alternative browser.
|
2019-08-02 16:39:53 +03:00
|
|
|
This is usually an external browser (that is, not eww or w3m),
|
|
|
|
used as the secondary browser choice, typically when a prefix
|
|
|
|
argument is given to a URL-opening command in those modes that
|
2019-08-02 21:45:19 +02:00
|
|
|
support this (for instance, eww/shr).
|
|
|
|
|
|
|
|
Also see `browse-url-browser-function'."
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "27.1"
|
|
|
|
:type browse-url--browser-defcustom-type)
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2010-11-24 07:29:06 +01:00
|
|
|
(defcustom browse-url-mailto-function 'browse-url-mail
|
|
|
|
"Function to display mailto: links.
|
|
|
|
This variable uses the same syntax as the
|
|
|
|
`browse-url-browser-function' variable. If the
|
|
|
|
`browse-url-mailto-function' variable is nil, that variable will
|
|
|
|
be used instead."
|
|
|
|
:type '(choice
|
|
|
|
(function-item :tag "Emacs Mail" :value browse-url-mail)
|
|
|
|
(function-item :tag "None" nil))
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "24.1")
|
2010-11-24 07:29:06 +01:00
|
|
|
|
2016-10-21 11:23:39 -04:00
|
|
|
(defcustom browse-url-man-function 'browse-url-man
|
|
|
|
"Function to display man: links."
|
|
|
|
:type '(radio
|
|
|
|
(function-item :tag "Emacs Man" :value browse-url-man)
|
|
|
|
(const :tag "None" nil)
|
|
|
|
(function :tag "Other function"))
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "26.1")
|
|
|
|
|
2022-07-11 05:14:57 -07:00
|
|
|
(defcustom browse-url-irc-function 'browse-url-irc
|
|
|
|
"Function to open an irc:// link."
|
|
|
|
:type '(choice
|
|
|
|
(function-item :tag "Emacs IRC" :value browse-url-irc)
|
|
|
|
(const :tag "None" nil)
|
|
|
|
(function :tag "Other function"))
|
|
|
|
:version "29.1")
|
|
|
|
|
2019-07-28 15:55:31 +02:00
|
|
|
(defcustom browse-url-button-regexp
|
|
|
|
(concat
|
2023-08-30 20:56:14 +02:00
|
|
|
"\\b\\(\\(www\\.\\|\\(s?https?\\|ftps?\\|file\\|gophers?\\|gemini\\|"
|
2019-07-28 15:55:31 +02:00
|
|
|
"nntp\\|news\\|telnet\\|wais\\|mailto\\|info\\):\\)"
|
|
|
|
"\\(//[-a-z0-9_.]+:[0-9]*\\)?"
|
|
|
|
(let ((chars "-a-z0-9_=#$@~%&*+\\/[:word:]")
|
|
|
|
(punct "!?:;.,"))
|
|
|
|
(concat
|
|
|
|
"\\(?:"
|
|
|
|
;; Match paired parentheses, e.g. in Wikipedia URLs:
|
2023-10-24 09:37:21 +02:00
|
|
|
;; http://thread.gmane.org/47B4E3B2.3050402@gmail.com [dead link]
|
2020-02-20 15:45:44 +01:00
|
|
|
"[" chars punct "]+" "(" "[" chars punct "]+" ")"
|
2019-07-28 15:55:31 +02:00
|
|
|
"\\(?:" "[" chars punct "]+" "[" chars "]" "\\)?"
|
|
|
|
"\\|"
|
|
|
|
"[" chars punct "]+" "[" chars "]"
|
|
|
|
"\\)"))
|
|
|
|
"\\)")
|
|
|
|
"Regular expression that matches URLs."
|
|
|
|
:version "27.1"
|
|
|
|
:type 'regexp)
|
2016-10-21 11:23:39 -04:00
|
|
|
|
2001-11-19 19:12:31 +00:00
|
|
|
(defcustom browse-url-browser-display nil
|
2012-02-28 00:17:21 -08:00
|
|
|
"The X display for running the browser, if not same as Emacs's."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(choice string (const :tag "Default" nil)))
|
2001-11-19 19:12:31 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-mozilla-program "mozilla"
|
2007-08-23 18:41:14 +00:00
|
|
|
"The name by which to invoke Mozilla."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'string)
|
2022-07-10 12:15:48 +02:00
|
|
|
(make-obsolete-variable 'browse-url-mozilla-program nil "29.1")
|
2001-11-19 19:12:31 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-mozilla-arguments nil
|
2007-08-23 18:41:14 +00:00
|
|
|
"A list of strings to pass to Mozilla as arguments."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2022-07-10 12:15:48 +02:00
|
|
|
(make-obsolete-variable 'browse-url-mozilla-arguments nil "29.1")
|
2001-11-19 19:12:31 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-mozilla-startup-arguments browse-url-mozilla-arguments
|
2007-08-23 18:41:14 +00:00
|
|
|
"A list of strings to pass to Mozilla when it starts up.
|
2001-11-19 19:12:31 +00:00
|
|
|
Defaults to the value of `browse-url-mozilla-arguments' at the time
|
|
|
|
`browse-url' is loaded."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2022-07-10 12:15:48 +02:00
|
|
|
(make-obsolete-variable 'browse-url-mozilla-startup-arguments nil "29.1")
|
2001-11-19 19:12:31 +00:00
|
|
|
|
2021-12-07 19:46:21 +01:00
|
|
|
(defun browse-url--find-executable (candidates default)
|
|
|
|
(while (and candidates (not (executable-find (car candidates))))
|
|
|
|
(setq candidates (cdr candidates)))
|
|
|
|
(or (car candidates) default))
|
|
|
|
|
2010-04-29 10:04:33 -04:00
|
|
|
(defcustom browse-url-firefox-program
|
2021-12-07 19:46:21 +01:00
|
|
|
(browse-url--find-executable '("icecat" "iceweasel") "firefox")
|
2015-03-22 03:39:21 -04:00
|
|
|
"The name by which to invoke Firefox or a variant of it."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'string)
|
2005-06-18 10:36:11 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-firefox-arguments nil
|
2015-03-22 03:39:21 -04:00
|
|
|
"A list of strings to pass to Firefox (or variant) as arguments."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2005-06-18 10:36:11 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-firefox-startup-arguments browse-url-firefox-arguments
|
2015-03-22 03:39:21 -04:00
|
|
|
"A list of strings to pass to Firefox (or variant) when it starts up.
|
2005-06-18 10:36:11 +00:00
|
|
|
Defaults to the value of `browse-url-firefox-arguments' at the time
|
|
|
|
`browse-url' is loaded."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2005-06-18 10:36:11 +00:00
|
|
|
|
2015-02-24 18:02:11 -05:00
|
|
|
(make-obsolete-variable 'browse-url-firefox-startup-arguments
|
|
|
|
"it no longer has any effect." "24.5")
|
|
|
|
|
2016-01-24 14:37:38 -05:00
|
|
|
(defcustom browse-url-chrome-program
|
2021-12-07 19:46:21 +01:00
|
|
|
(browse-url--find-executable '("google-chrome-stable" "google-chrome")
|
|
|
|
"chromium")
|
2016-01-25 08:49:09 -08:00
|
|
|
"The name by which to invoke the Chrome browser."
|
2016-01-24 14:37:38 -05:00
|
|
|
:type 'string
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "25.1")
|
2016-01-24 14:37:38 -05:00
|
|
|
|
|
|
|
(defcustom browse-url-chrome-arguments nil
|
|
|
|
"A list of strings to pass to Google Chrome as arguments."
|
|
|
|
:type '(repeat (string :tag "Argument"))
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "25.1")
|
2016-01-24 14:37:38 -05:00
|
|
|
|
2011-10-19 12:03:39 +03:00
|
|
|
(defcustom browse-url-chromium-program
|
2021-12-07 19:46:21 +01:00
|
|
|
(browse-url--find-executable '("chromium" "chromium-browser") "chromium")
|
2011-10-19 12:03:39 +03:00
|
|
|
"The name by which to invoke Chromium."
|
|
|
|
:type 'string
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "24.1")
|
2011-10-19 12:03:39 +03:00
|
|
|
|
|
|
|
(defcustom browse-url-chromium-arguments nil
|
|
|
|
"A list of strings to pass to Chromium as arguments."
|
|
|
|
:type '(repeat (string :tag "Argument"))
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "24.1")
|
2011-10-19 12:03:39 +03:00
|
|
|
|
2003-07-07 20:54:56 +00:00
|
|
|
(defcustom browse-url-epiphany-program "epiphany"
|
2021-12-07 18:57:48 +01:00
|
|
|
"The name by which to invoke GNOME Web (Epiphany)."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'string)
|
2003-07-07 20:54:56 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-epiphany-arguments nil
|
2021-12-07 18:57:48 +01:00
|
|
|
"A list of strings to pass to GNOME Web (Epiphany) as arguments."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2003-07-07 20:54:56 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-epiphany-startup-arguments browse-url-epiphany-arguments
|
2021-12-07 18:57:48 +01:00
|
|
|
"A list of strings to pass to GNOME Web (Epiphany) when it starts up.
|
2003-07-07 20:54:56 +00:00
|
|
|
Defaults to the value of `browse-url-epiphany-arguments' at the time
|
|
|
|
`browse-url' is loaded."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2003-07-07 20:54:56 +00:00
|
|
|
|
Add support for the Haiku operating system and its window system
* .gitignore: Add binaries specific to Haiku.
* Makefie.in (HAVE_BE_APP): New variable.
(install-arch-dep): Install Emacs and Emacs.pdmp when
using Haiku.
* configure.ac: Detect and configure for Haiku and
various related configurations.
(be-app, be-freetype, be-cairo): New options.
(HAVE_BE_APP, HAIKU_OBJ, HAIKU_CXX_OBJ)
(HAIKU_LIBS, HAIKU_CFLAGS): New variables.
(HAIKU, HAVE_TINY_SPEED_T): New define.
(emacs_config_features): Add BE_APP.
* doc/emacs/Makefile.in (EMACSSOURCES): Add Haiku
appendix.
* doc/emacs/emacs.texi: Add Haiku appendix to menus and
include it.
* doc/emacs/haiku.texi: New Haiku appendix.
* doc/lispref/display.texi (Defining Faces, Window Systems):
Explain meaning of `haiku' as a window system identifier.
(haiku-use-system-tooltips): Explain meaning of system
tooltips on
Haiku.
* doc/lispref/frames.texi (Multiple Terminals): Explain
meaning of haiku as a display type.
(Frame Layout): Clarify section for Haiku frames.
(Size Parameters): Explain limitations of fullwidth and
fullheight on Haiku.
(Management Parameters): Explain limitations of
inhibiting double buffering on builds with Cairo,
and the inability of frames with no-accept-focus to
receive keyboard input on Haiku.
(Font and Color Parameters): Explain the different font
backends available on Haiku.
(Raising and Lowering): Explain that lowering and
restacking frames doesn't work on Haiku.
(Child Frames): Explain oddities of child frame
visibility on Haiku.
* doc/lispref/os.texi (System Environment): Explain
meaning of haiku.
* etc/MACHINES: Add appropriate notices for Haiku.
* etc/NEWS: Document changes.
* etc/PROBLEMS: Document font spacing bug on Haiku.
* lib-src/Makefile.in: Build be-resources binary on
Haiku.
(CXX, CXXFLAGS, NON_CXX_FLAGS, ALL_CXXFLAGS)
(HAVE_BE_APP, HAIKU_LIBS, HAIKU_CFLAGS): New variables.
(DONT_INSTALL): Add be-resources binary if on Haiku.
(be-resources): New target.
* lib-src/be_resources: Add helper binary for setting
resources on the Emacs application.
* lib-src/emacsclient.c (decode_options): Set
alt_display to "be" on Haiku.
* lisp/cus-edit.el (custom-button, custom-button-mouse)
(custom-button-unraised, custom-button-pressed): Update
face definitions for Haiku.
* lisp/cus-start.el: Add haiku-debug-on-fatal-error and
haiku-use-system-tooltips.
* lisp/faces.el (face-valid-attribute-values): Clarify
attribute comment for Haiku.
(tool-bar): Add appropriate toolbar color for Haiku.
* lisp/frame.el (haiku-frame-geometry)
(haiku-mouse-absolute-pixel-position)
(haiku-set-mouse-absolute-pixel-position)
(haiku-frame-edges)
(haiku-frame-list-z-order): New function declarations.
(frame-geometry, frame-edges)
(mouse-absolute-pixel-position)
(set-mouse-absolute-pixel-position)
(frame-list-z-order): Call appropriate window system
functions on Haiku.
(display-mouse-p, display-graphic-p)
(display-images-p, display-pixel-height)
(display-pixel-width, display-mm-height)
(display-mm-width, display-backing-store)
(display-save-under, display-planes)
(display-color-cells, display-visual-class): Update type
tests for Haiku.
* lisp/international/mule-cmds.el
(set-coding-system-map): Also
prevent set-terminal-coding-system from appearing in the menu
bar on Haiku.
* lisp/loadup.el: Load Haiku-specific files when built
with Haiku, and don't rename newly built Emacs on Haiku as BFS
doesn't support hard links.
* lisp/menu-bar.el (menu-bar-open): Add for Haiku.
* lisp/mwheel.el (mouse-wheel-down-event): Expect
wheel-up on Haiku.
(mouse-wheel-up-event): Expect wheel-down on Haiku.
(mouse-wheel-left-event): Expect wheel-left on Haiku.
(mouse-wheel-right-event): Expect wheel-right on Haiku.
* lisp/net/browse-url.el
(browse-url--browser-defcustom-type):
Add option for WebPositive.
(browse-url-webpositive-program): New variable.
(browse-url-default-program): Search for WebPositive.
(browse-url-webpositive): New function.
* lisp/net/eww.el (eww-form-submit, eww-form-file)
(eww-form-checkbox, eww-form-select): Define faces
appropriately for Haiku.
* lisp/term/haiku-win.el: New file.
* lisp/tooltip.el (menu-or-popup-active-p): New function
declaration.
(tooltip-show-help): Don't use tooltips on Haiku when a
menu is active.
* lisp/version.el (haiku-get-version-string): New
function declaration.
(emacs-version): Add Haiku version string if
appropriate.
* src/Makefile.in: Also produce binary named "Emacs"
with Haiku resources set.
(CXX, HAIKU_OBJ, HAIKU_CXX_OBJ, HAIKU_LIBS)
(HAIKU_CFLAGS, HAVE_BE_APP, NON_CXX_FLAGS)
(ALL_CXX_FLAGS): New variables.
(.SUFFIXES): Add .cc.
(.cc.o): New target.
(base_obj): Add Haiku C objects.
(doc_obj, obj): Split objects that should scanned for
documentation into doc_obj.
(SOME_MACHINE_OBJECTS): Add appropriate Haiku C objects.
(all): Depend on Emacs and Emacs.pdmp on Haiku.
(LIBES): Add Haiku libraries.
(gl-stamp)
($(etc)/DOC): Scan doc_obj instead of obj
(temacs$(EXEEXT): Use C++ linker on Haiku.
(ctagsfiles3): New variable.
(TAGS): Scan C++ files.
* src/alloc.c (garbage_collect): Mark Haiku display.
* src/dispextern.h (HAVE_NATIVE_TRANSFORMS): Also enable
on Haiku.
(struct image): Add fields for Haiku transforms.
(RGB_PIXEL_COLOR): Define to unsigned long on Haiku as
well.
(sit_for): Also check USABLE_SIGPOLL.
(init_display_interactive): Set initial window system to
Haiku on Haiku builds.
* src/emacs.c (main): Define Haiku syms and init haiku
clipboard.
(shut_down_emacs): Quit BApplication on Haiku and
trigger debug
on aborts if haiku_debug_on_fatal_error.
(Vsystem_type): Update docstring.
* src/fileio.c (next-read-file-uses-dialog-p): Enable on
Haiku.
* src/filelock.c (WTMP_FILE): Only define if BOOT_TIME
is also defined.
* src/floatfns.c (double_integer_scale): Work around
Haiku libroot brain damage.
* src/font.c (syms_of_font): Define appropriate font
driver symbols for Haiku builds with various options.
* src/font.h: Also enable ftcrfont on Haiku builds with
Cairo.
(font_data_structures_may_be_ill_formed): Also enable on
Haiku builds that have Cairo.
* src/frame.c (Fframep): Update doc-string for Haiku
builds and return haiku if appropriate.
(syms_of_frame): New symbol `haiku'.
* src/frame.h (struct frame): Add output data for Haiku.
(FRAME_HAIKU_P): New macro.
(FRAME_WINDOW_P): Test for Haiku frames as well.
* src/ftcrfont.c (RED_FROM_ULONG, GREEN_FROM_ULONG)
(BLUE_FROM_ULONG): New macros.
(ftcrfont_draw): Add haiku specific code for Haiku
builds with Cairo.
* src/ftfont.c (ftfont_open): Set face.
(ftfont_has_char, ftfont_text_extents): Work around
crash.
(syms_of_ftfont): New symbol `mono'.
* src/ftfont.h (struct font_info): Enable Cairo-specific
fields for Cairo builds on Haiku.
* src/haiku_draw_support.cc:
* src/haiku_font_support.cc:
* src/haiku_io.c:
* src/haiku_select.cc:
* src/haiku_support.cc:
* src/haiku_support.h:
* src/haikufns.c:
* src/haikufont.c:
* src/haikugui.h:
* src/haikuimage.c:
* src/haikumenu.c:
* src/haikuselect.c:
* src/haikuselect.h:
* src/haikuterm.c:
* src/haikuterm.h: Add new files for Haiku windowing
support.
* src/haiku.c: Add new files for Haiku operating system
support.
* src/image.c: Implement image transforms and native XPM
support
on Haiku.
(GET_PIXEL, PUT_PIXEL, NO_PIXMAP)
(PIX_MASK_RETAIN, PIX_MASK_DRAW)
(RGB_TO_ULONG, RED_FROM_ULONG, GREEN_FROM_ULONG)
(BLUE_FROM_ULONG, RED16_FROM_ULONG, GREEN16_FROM_ULONG)
(BLUE16_FROM_ULONG): Define to appropriate values on
Haiku.
(image_create_bitmap_from_data): Add Haiku support.
(image_create_bitmap_from_file): Add TODO on Haiku.
(free_bitmap_record): Free bitmap on Haiku.
(image_size_in_bytes): Implement for Haiku bitmaps.
(image_set_transform): Implement on Haiku.
(image_create_x_image_and_pixmap_1): Implement on Haiku,
24-bit or 1-bit only.
(image_destroy_x_image, image_get_x_image): Use correct
img and pixmap values on Haiku.
(lookup_rgb_color): Use correct macro on Haiku.
(image_to_emacs_colors): Implement on Haiku.
(image_disable_image): Disable on Haiku.
(image_can_use_native_api): Test for translator presence
on Haiku.
(native_image_load): Use translator on Haiku.
(imagemagick_load_image): Add Haiku-specific quirks.
(Fimage_transforms_p): Allow rotate90 on Haiku.
(image_types): Enable native XPM support on Haiku.
(syms_of_image): Enable XPM images on Haiku.
* src/keyboard.c (kbd_buffer_get_event)
(handle_async_input, handle_input_available_signal)
(handle_user_signal, Fset_input_interrupt_mode)
(init_keyboard): Check for USABLE_SIGPOLL along with
USABLE_SIGIO.
* src/lisp.h (pD): Work around broken Haiku headers.
(HAVE_EXT_MENU_BAR): Define on Haiku.
(handle_input_available_signal): Enable if we just have
SIGPOLL as well.
* src/menu.c (have_boxes): Return true on Haiku.
(single_menu_item): Enable toolkit menus on Haiku.
(find_and_call_menu_selection): Also enable on Haiku.
* src/process.c (keyboard_bit_set): Enable with only
usable SIGPOLL.
(wait_reading_process_output): Test for SIGPOLL as well
as SIGIO availability.
* src/sound.c (sound_perror, vox_open)
(vox_configure, vox_close): Enable for usable SIGPOLL as
well.
* src/sysdep.c (sys_subshell): Enable for usable SIGPOLL.
(reset_sigio): Make conditional on F_SETOWN.
(request_sigio, unrequest_sigio)
(emacs_sigaction_init): Also handle SIGPOLLs.
(init_sys_modes): Disable TCXONC usage on Haiku, as it
doesn't have any ttys other than pseudo ttys, which don't
support C-s/C-q flow control, and causes compiler warnings.
(speeds): Disable high speeds if HAVE_TINY_SPEED_T.
* src/termhooks.h (enum output_method): Add output_haiku.
(struct terminal): Add Haiku display info.
(TERMINAL_FONT_CACHE): Enable for Haiku.
* src/terminal.c (Fterminal_live_p): Return `haiku' if
appropriate.
* src/verbose.mk.in (AM_V_CXX, AM_V_CXXLD): New logging
variables.
* src/xdisp.c (redisplay_internal)
(note_mouse_highlight): Return on Haiku if a popup is activated.
(display_menu_bar): Return on Haiku if frame is a Haiku
frame.
* src/xfaces.c (GCGraphicsExposures): Enable correctly on Haiku.
(x_create_gc): Enable dummy GC code on Haiku.
* src/xfns.c (x-server-version, x-file-dialog): Add
Haiku specifics to doc strings.
* src/xterm.c (syms_of_xterm): Add Haiku information to
doc string.
2021-11-20 21:30:08 +08:00
|
|
|
(defcustom browse-url-webpositive-program "WebPositive"
|
|
|
|
"The name by which to invoke WebPositive."
|
|
|
|
:type 'string
|
2021-11-21 16:00:11 +01:00
|
|
|
:version "29.1")
|
Add support for the Haiku operating system and its window system
* .gitignore: Add binaries specific to Haiku.
* Makefie.in (HAVE_BE_APP): New variable.
(install-arch-dep): Install Emacs and Emacs.pdmp when
using Haiku.
* configure.ac: Detect and configure for Haiku and
various related configurations.
(be-app, be-freetype, be-cairo): New options.
(HAVE_BE_APP, HAIKU_OBJ, HAIKU_CXX_OBJ)
(HAIKU_LIBS, HAIKU_CFLAGS): New variables.
(HAIKU, HAVE_TINY_SPEED_T): New define.
(emacs_config_features): Add BE_APP.
* doc/emacs/Makefile.in (EMACSSOURCES): Add Haiku
appendix.
* doc/emacs/emacs.texi: Add Haiku appendix to menus and
include it.
* doc/emacs/haiku.texi: New Haiku appendix.
* doc/lispref/display.texi (Defining Faces, Window Systems):
Explain meaning of `haiku' as a window system identifier.
(haiku-use-system-tooltips): Explain meaning of system
tooltips on
Haiku.
* doc/lispref/frames.texi (Multiple Terminals): Explain
meaning of haiku as a display type.
(Frame Layout): Clarify section for Haiku frames.
(Size Parameters): Explain limitations of fullwidth and
fullheight on Haiku.
(Management Parameters): Explain limitations of
inhibiting double buffering on builds with Cairo,
and the inability of frames with no-accept-focus to
receive keyboard input on Haiku.
(Font and Color Parameters): Explain the different font
backends available on Haiku.
(Raising and Lowering): Explain that lowering and
restacking frames doesn't work on Haiku.
(Child Frames): Explain oddities of child frame
visibility on Haiku.
* doc/lispref/os.texi (System Environment): Explain
meaning of haiku.
* etc/MACHINES: Add appropriate notices for Haiku.
* etc/NEWS: Document changes.
* etc/PROBLEMS: Document font spacing bug on Haiku.
* lib-src/Makefile.in: Build be-resources binary on
Haiku.
(CXX, CXXFLAGS, NON_CXX_FLAGS, ALL_CXXFLAGS)
(HAVE_BE_APP, HAIKU_LIBS, HAIKU_CFLAGS): New variables.
(DONT_INSTALL): Add be-resources binary if on Haiku.
(be-resources): New target.
* lib-src/be_resources: Add helper binary for setting
resources on the Emacs application.
* lib-src/emacsclient.c (decode_options): Set
alt_display to "be" on Haiku.
* lisp/cus-edit.el (custom-button, custom-button-mouse)
(custom-button-unraised, custom-button-pressed): Update
face definitions for Haiku.
* lisp/cus-start.el: Add haiku-debug-on-fatal-error and
haiku-use-system-tooltips.
* lisp/faces.el (face-valid-attribute-values): Clarify
attribute comment for Haiku.
(tool-bar): Add appropriate toolbar color for Haiku.
* lisp/frame.el (haiku-frame-geometry)
(haiku-mouse-absolute-pixel-position)
(haiku-set-mouse-absolute-pixel-position)
(haiku-frame-edges)
(haiku-frame-list-z-order): New function declarations.
(frame-geometry, frame-edges)
(mouse-absolute-pixel-position)
(set-mouse-absolute-pixel-position)
(frame-list-z-order): Call appropriate window system
functions on Haiku.
(display-mouse-p, display-graphic-p)
(display-images-p, display-pixel-height)
(display-pixel-width, display-mm-height)
(display-mm-width, display-backing-store)
(display-save-under, display-planes)
(display-color-cells, display-visual-class): Update type
tests for Haiku.
* lisp/international/mule-cmds.el
(set-coding-system-map): Also
prevent set-terminal-coding-system from appearing in the menu
bar on Haiku.
* lisp/loadup.el: Load Haiku-specific files when built
with Haiku, and don't rename newly built Emacs on Haiku as BFS
doesn't support hard links.
* lisp/menu-bar.el (menu-bar-open): Add for Haiku.
* lisp/mwheel.el (mouse-wheel-down-event): Expect
wheel-up on Haiku.
(mouse-wheel-up-event): Expect wheel-down on Haiku.
(mouse-wheel-left-event): Expect wheel-left on Haiku.
(mouse-wheel-right-event): Expect wheel-right on Haiku.
* lisp/net/browse-url.el
(browse-url--browser-defcustom-type):
Add option for WebPositive.
(browse-url-webpositive-program): New variable.
(browse-url-default-program): Search for WebPositive.
(browse-url-webpositive): New function.
* lisp/net/eww.el (eww-form-submit, eww-form-file)
(eww-form-checkbox, eww-form-select): Define faces
appropriately for Haiku.
* lisp/term/haiku-win.el: New file.
* lisp/tooltip.el (menu-or-popup-active-p): New function
declaration.
(tooltip-show-help): Don't use tooltips on Haiku when a
menu is active.
* lisp/version.el (haiku-get-version-string): New
function declaration.
(emacs-version): Add Haiku version string if
appropriate.
* src/Makefile.in: Also produce binary named "Emacs"
with Haiku resources set.
(CXX, HAIKU_OBJ, HAIKU_CXX_OBJ, HAIKU_LIBS)
(HAIKU_CFLAGS, HAVE_BE_APP, NON_CXX_FLAGS)
(ALL_CXX_FLAGS): New variables.
(.SUFFIXES): Add .cc.
(.cc.o): New target.
(base_obj): Add Haiku C objects.
(doc_obj, obj): Split objects that should scanned for
documentation into doc_obj.
(SOME_MACHINE_OBJECTS): Add appropriate Haiku C objects.
(all): Depend on Emacs and Emacs.pdmp on Haiku.
(LIBES): Add Haiku libraries.
(gl-stamp)
($(etc)/DOC): Scan doc_obj instead of obj
(temacs$(EXEEXT): Use C++ linker on Haiku.
(ctagsfiles3): New variable.
(TAGS): Scan C++ files.
* src/alloc.c (garbage_collect): Mark Haiku display.
* src/dispextern.h (HAVE_NATIVE_TRANSFORMS): Also enable
on Haiku.
(struct image): Add fields for Haiku transforms.
(RGB_PIXEL_COLOR): Define to unsigned long on Haiku as
well.
(sit_for): Also check USABLE_SIGPOLL.
(init_display_interactive): Set initial window system to
Haiku on Haiku builds.
* src/emacs.c (main): Define Haiku syms and init haiku
clipboard.
(shut_down_emacs): Quit BApplication on Haiku and
trigger debug
on aborts if haiku_debug_on_fatal_error.
(Vsystem_type): Update docstring.
* src/fileio.c (next-read-file-uses-dialog-p): Enable on
Haiku.
* src/filelock.c (WTMP_FILE): Only define if BOOT_TIME
is also defined.
* src/floatfns.c (double_integer_scale): Work around
Haiku libroot brain damage.
* src/font.c (syms_of_font): Define appropriate font
driver symbols for Haiku builds with various options.
* src/font.h: Also enable ftcrfont on Haiku builds with
Cairo.
(font_data_structures_may_be_ill_formed): Also enable on
Haiku builds that have Cairo.
* src/frame.c (Fframep): Update doc-string for Haiku
builds and return haiku if appropriate.
(syms_of_frame): New symbol `haiku'.
* src/frame.h (struct frame): Add output data for Haiku.
(FRAME_HAIKU_P): New macro.
(FRAME_WINDOW_P): Test for Haiku frames as well.
* src/ftcrfont.c (RED_FROM_ULONG, GREEN_FROM_ULONG)
(BLUE_FROM_ULONG): New macros.
(ftcrfont_draw): Add haiku specific code for Haiku
builds with Cairo.
* src/ftfont.c (ftfont_open): Set face.
(ftfont_has_char, ftfont_text_extents): Work around
crash.
(syms_of_ftfont): New symbol `mono'.
* src/ftfont.h (struct font_info): Enable Cairo-specific
fields for Cairo builds on Haiku.
* src/haiku_draw_support.cc:
* src/haiku_font_support.cc:
* src/haiku_io.c:
* src/haiku_select.cc:
* src/haiku_support.cc:
* src/haiku_support.h:
* src/haikufns.c:
* src/haikufont.c:
* src/haikugui.h:
* src/haikuimage.c:
* src/haikumenu.c:
* src/haikuselect.c:
* src/haikuselect.h:
* src/haikuterm.c:
* src/haikuterm.h: Add new files for Haiku windowing
support.
* src/haiku.c: Add new files for Haiku operating system
support.
* src/image.c: Implement image transforms and native XPM
support
on Haiku.
(GET_PIXEL, PUT_PIXEL, NO_PIXMAP)
(PIX_MASK_RETAIN, PIX_MASK_DRAW)
(RGB_TO_ULONG, RED_FROM_ULONG, GREEN_FROM_ULONG)
(BLUE_FROM_ULONG, RED16_FROM_ULONG, GREEN16_FROM_ULONG)
(BLUE16_FROM_ULONG): Define to appropriate values on
Haiku.
(image_create_bitmap_from_data): Add Haiku support.
(image_create_bitmap_from_file): Add TODO on Haiku.
(free_bitmap_record): Free bitmap on Haiku.
(image_size_in_bytes): Implement for Haiku bitmaps.
(image_set_transform): Implement on Haiku.
(image_create_x_image_and_pixmap_1): Implement on Haiku,
24-bit or 1-bit only.
(image_destroy_x_image, image_get_x_image): Use correct
img and pixmap values on Haiku.
(lookup_rgb_color): Use correct macro on Haiku.
(image_to_emacs_colors): Implement on Haiku.
(image_disable_image): Disable on Haiku.
(image_can_use_native_api): Test for translator presence
on Haiku.
(native_image_load): Use translator on Haiku.
(imagemagick_load_image): Add Haiku-specific quirks.
(Fimage_transforms_p): Allow rotate90 on Haiku.
(image_types): Enable native XPM support on Haiku.
(syms_of_image): Enable XPM images on Haiku.
* src/keyboard.c (kbd_buffer_get_event)
(handle_async_input, handle_input_available_signal)
(handle_user_signal, Fset_input_interrupt_mode)
(init_keyboard): Check for USABLE_SIGPOLL along with
USABLE_SIGIO.
* src/lisp.h (pD): Work around broken Haiku headers.
(HAVE_EXT_MENU_BAR): Define on Haiku.
(handle_input_available_signal): Enable if we just have
SIGPOLL as well.
* src/menu.c (have_boxes): Return true on Haiku.
(single_menu_item): Enable toolkit menus on Haiku.
(find_and_call_menu_selection): Also enable on Haiku.
* src/process.c (keyboard_bit_set): Enable with only
usable SIGPOLL.
(wait_reading_process_output): Test for SIGPOLL as well
as SIGIO availability.
* src/sound.c (sound_perror, vox_open)
(vox_configure, vox_close): Enable for usable SIGPOLL as
well.
* src/sysdep.c (sys_subshell): Enable for usable SIGPOLL.
(reset_sigio): Make conditional on F_SETOWN.
(request_sigio, unrequest_sigio)
(emacs_sigaction_init): Also handle SIGPOLLs.
(init_sys_modes): Disable TCXONC usage on Haiku, as it
doesn't have any ttys other than pseudo ttys, which don't
support C-s/C-q flow control, and causes compiler warnings.
(speeds): Disable high speeds if HAVE_TINY_SPEED_T.
* src/termhooks.h (enum output_method): Add output_haiku.
(struct terminal): Add Haiku display info.
(TERMINAL_FONT_CACHE): Enable for Haiku.
* src/terminal.c (Fterminal_live_p): Return `haiku' if
appropriate.
* src/verbose.mk.in (AM_V_CXX, AM_V_CXXLD): New logging
variables.
* src/xdisp.c (redisplay_internal)
(note_mouse_highlight): Return on Haiku if a popup is activated.
(display_menu_bar): Return on Haiku if frame is a Haiku
frame.
* src/xfaces.c (GCGraphicsExposures): Enable correctly on Haiku.
(x_create_gc): Enable dummy GC code on Haiku.
* src/xfns.c (x-server-version, x-file-dialog): Add
Haiku specifics to doc strings.
* src/xterm.c (syms_of_xterm): Add Haiku information to
doc string.
2021-11-20 21:30:08 +08:00
|
|
|
|
2021-12-07 18:27:41 +01:00
|
|
|
;; GNOME means of invoking Mozilla.
|
2004-11-07 04:00:18 +00:00
|
|
|
(defvar browse-url-gnome-moz-program "gnome-moz-remote")
|
|
|
|
|
browse-url: mark some of the more obsolete stuff as such
* lisp/net/browse-url.el (browse-url-browser-function)
(browse-url-default-browser):
Remove obsolete items from the explicit listing.
(browse-url-new-window-flag, browse-url-of-file-hook): Doc fixes.
(browse-url-netscape-program, browse-url-netscape-arguments)
(browse-url-netscape-startup-arguments)
(browse-url-galeon-program, browse-url-galeon-arguments)
(browse-url-galeon-startup-arguments)
(browse-url-gnome-moz-program, browse-url-gnome-moz-arguments)
(browse-url-galeon-new-window-is-tab)
(browse-url-netscape-new-window-is-tab)
(browse-url-mosaic-program, browse-url-mosaic-arguments)
(browse-url-mosaic-pidfile, browse-url-CCI-port)
(browse-url-CCI-host, browse-url-netscape-version)
(browse-url-netscape, browse-url-netscape-sentinel)
(browse-url-netscape-reload, browse-url-netscape-send)
(browse-url-galeon, browse-url-galeon-sentinel)
(browse-url-gnome-moz, browse-url-mosaic, browse-url-cci)
(browse-url-w3-gnudoit): Make obsolete.
* etc/NEWS: Mention this.
* doc/misc/idlwave.texi (HTML Help Browser Tips): Remove obsolete info.
* lisp/ffap.el (ffap-url-fetcher): Simplify default and doc.
* lisp/x-dnd.el: Comment update.
2015-03-24 23:26:48 -07:00
|
|
|
(make-obsolete-variable 'browse-url-gnome-moz-program nil "25.1")
|
|
|
|
|
2004-11-07 04:00:18 +00:00
|
|
|
(defcustom browse-url-gnome-moz-arguments '()
|
2007-08-23 18:41:14 +00:00
|
|
|
"A list of strings passed to the GNOME mozilla viewer as arguments."
|
2004-11-07 04:00:18 +00:00
|
|
|
:version "21.1"
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2004-11-07 04:00:18 +00:00
|
|
|
|
browse-url: mark some of the more obsolete stuff as such
* lisp/net/browse-url.el (browse-url-browser-function)
(browse-url-default-browser):
Remove obsolete items from the explicit listing.
(browse-url-new-window-flag, browse-url-of-file-hook): Doc fixes.
(browse-url-netscape-program, browse-url-netscape-arguments)
(browse-url-netscape-startup-arguments)
(browse-url-galeon-program, browse-url-galeon-arguments)
(browse-url-galeon-startup-arguments)
(browse-url-gnome-moz-program, browse-url-gnome-moz-arguments)
(browse-url-galeon-new-window-is-tab)
(browse-url-netscape-new-window-is-tab)
(browse-url-mosaic-program, browse-url-mosaic-arguments)
(browse-url-mosaic-pidfile, browse-url-CCI-port)
(browse-url-CCI-host, browse-url-netscape-version)
(browse-url-netscape, browse-url-netscape-sentinel)
(browse-url-netscape-reload, browse-url-netscape-send)
(browse-url-galeon, browse-url-galeon-sentinel)
(browse-url-gnome-moz, browse-url-mosaic, browse-url-cci)
(browse-url-w3-gnudoit): Make obsolete.
* etc/NEWS: Mention this.
* doc/misc/idlwave.texi (HTML Help Browser Tips): Remove obsolete info.
* lisp/ffap.el (ffap-url-fetcher): Simplify default and doc.
* lisp/x-dnd.el: Comment update.
2015-03-24 23:26:48 -07:00
|
|
|
(make-obsolete-variable 'browse-url-gnome-moz-arguments nil "25.1")
|
|
|
|
|
2002-10-11 17:17:10 +00:00
|
|
|
(defcustom browse-url-mozilla-new-window-is-tab nil
|
2007-08-23 18:41:14 +00:00
|
|
|
"Whether to open up new windows in a tab or a new window.
|
2002-10-11 17:17:10 +00:00
|
|
|
If non-nil, then open the URL in a new tab rather than a new window if
|
|
|
|
`browse-url-mozilla' is asked to open it in a new window."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'boolean)
|
2022-07-10 12:15:48 +02:00
|
|
|
(make-obsolete-variable 'browse-url-mozilla-new-window-is-tab nil "29.1")
|
2002-10-11 17:17:10 +00:00
|
|
|
|
2005-06-18 10:36:11 +00:00
|
|
|
(defcustom browse-url-firefox-new-window-is-tab nil
|
2007-08-23 18:41:14 +00:00
|
|
|
"Whether to open up new windows in a tab or a new window.
|
2005-06-18 10:36:11 +00:00
|
|
|
If non-nil, then open the URL in a new tab rather than a new window if
|
2016-11-04 11:24:21 +02:00
|
|
|
`browse-url-firefox' is asked to open it in a new window."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'boolean)
|
2005-06-18 10:36:11 +00:00
|
|
|
|
2015-03-17 05:27:23 +05:30
|
|
|
(defcustom browse-url-conkeror-new-window-is-buffer nil
|
|
|
|
"Whether to open up new windows in a buffer or a new window.
|
2015-03-17 17:09:34 -07:00
|
|
|
If non-nil, then open the URL in a new buffer rather than a new window if
|
|
|
|
`browse-url-conkeror' is asked to open it in a new window."
|
2016-01-12 20:06:49 -05:00
|
|
|
:version "25.1"
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'boolean)
|
2015-03-17 05:27:23 +05:30
|
|
|
|
2020-05-24 18:48:16 +02:00
|
|
|
(make-obsolete-variable 'browse-url-conkeror-new-window-is-buffer nil "28.1")
|
|
|
|
|
2003-07-07 20:54:56 +00:00
|
|
|
(defcustom browse-url-epiphany-new-window-is-tab nil
|
2007-08-23 18:41:14 +00:00
|
|
|
"Whether to open up new windows in a tab or a new window.
|
2003-07-07 20:54:56 +00:00
|
|
|
If non-nil, then open the URL in a new tab rather than a new window if
|
|
|
|
`browse-url-epiphany' is asked to open it in a new window."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'boolean)
|
2003-07-07 20:54:56 +00:00
|
|
|
|
2001-04-18 12:48:36 +00:00
|
|
|
(defcustom browse-url-new-window-flag nil
|
2007-09-17 15:59:55 +00:00
|
|
|
"Non-nil means always open a new browser window with appropriate browsers.
|
2000-03-20 13:12:14 +00:00
|
|
|
Passing an interactive argument to \\[browse-url], or specific browser
|
browse-url: mark some of the more obsolete stuff as such
* lisp/net/browse-url.el (browse-url-browser-function)
(browse-url-default-browser):
Remove obsolete items from the explicit listing.
(browse-url-new-window-flag, browse-url-of-file-hook): Doc fixes.
(browse-url-netscape-program, browse-url-netscape-arguments)
(browse-url-netscape-startup-arguments)
(browse-url-galeon-program, browse-url-galeon-arguments)
(browse-url-galeon-startup-arguments)
(browse-url-gnome-moz-program, browse-url-gnome-moz-arguments)
(browse-url-galeon-new-window-is-tab)
(browse-url-netscape-new-window-is-tab)
(browse-url-mosaic-program, browse-url-mosaic-arguments)
(browse-url-mosaic-pidfile, browse-url-CCI-port)
(browse-url-CCI-host, browse-url-netscape-version)
(browse-url-netscape, browse-url-netscape-sentinel)
(browse-url-netscape-reload, browse-url-netscape-send)
(browse-url-galeon, browse-url-galeon-sentinel)
(browse-url-gnome-moz, browse-url-mosaic, browse-url-cci)
(browse-url-w3-gnudoit): Make obsolete.
* etc/NEWS: Mention this.
* doc/misc/idlwave.texi (HTML Help Browser Tips): Remove obsolete info.
* lisp/ffap.el (ffap-url-fetcher): Simplify default and doc.
* lisp/x-dnd.el: Comment update.
2015-03-24 23:26:48 -07:00
|
|
|
commands reverses the effect of this variable."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'boolean)
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2015-03-17 05:27:23 +05:30
|
|
|
(defcustom browse-url-conkeror-program "conkeror"
|
|
|
|
"The name by which to invoke Conkeror."
|
|
|
|
:type 'string
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "25.1")
|
2015-03-17 05:27:23 +05:30
|
|
|
|
2020-05-24 18:48:16 +02:00
|
|
|
(make-obsolete-variable 'browse-url-conkeror-program nil "28.1")
|
|
|
|
|
2015-03-17 05:27:23 +05:30
|
|
|
(defcustom browse-url-conkeror-arguments nil
|
|
|
|
"A list of strings to pass to Conkeror as arguments."
|
2016-01-12 20:06:49 -05:00
|
|
|
:version "25.1"
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2015-03-17 05:27:23 +05:30
|
|
|
|
2020-05-24 18:48:16 +02:00
|
|
|
(make-obsolete-variable 'browse-url-conkeror-arguments nil "28.1")
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
(defcustom browse-url-filename-alist
|
2015-12-25 23:32:55 +01:00
|
|
|
`(("^/\\(ftp@\\|anonymous@\\)?\\([^:/]+\\):/*" . "ftp://\\2/")
|
2000-03-20 13:12:14 +00:00
|
|
|
;; The above loses the username to avoid the browser prompting for
|
|
|
|
;; it in anonymous cases. If it's not anonymous the next regexp
|
|
|
|
;; applies.
|
2015-12-25 23:32:55 +01:00
|
|
|
("^/\\([^:@/]+@\\)?\\([^:/]+\\):/*" . "ftp://\\1\\2/")
|
2012-04-13 11:15:42 -04:00
|
|
|
,@(if (memq system-type '(windows-nt ms-dos))
|
2009-11-23 20:58:55 +00:00
|
|
|
'(("^\\([a-zA-Z]:\\)[\\/]" . "file:///\\1/")
|
2007-08-23 18:41:14 +00:00
|
|
|
("^[\\/][\\/]+" . "file://")))
|
2009-04-15 22:51:26 +00:00
|
|
|
("^/+" . "file:///"))
|
2007-08-23 18:41:14 +00:00
|
|
|
"An alist of (REGEXP . STRING) pairs used by `browse-url-of-file'.
|
2000-03-20 13:12:14 +00:00
|
|
|
Any substring of a filename matching one of the REGEXPs is replaced by
|
|
|
|
the corresponding STRING using `replace-match', not treating STRING
|
|
|
|
literally. All pairs are applied in the order given. The default
|
2022-07-27 23:33:03 +02:00
|
|
|
value converts ange-ftp-style file names into ftp URLs and prepends
|
2003-01-14 22:34:20 +00:00
|
|
|
`file:' to any file name beginning with `/'.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
For example, adding to the default a specific translation of an ange-ftp
|
|
|
|
address to an HTTP URL:
|
|
|
|
|
|
|
|
(setq browse-url-filename-alist
|
2015-09-03 15:31:12 -07:00
|
|
|
\\='((\"/webmaster@webserver:/home/www/html/\" .
|
2022-07-10 14:22:40 +02:00
|
|
|
\"https://www.example.org/\")
|
2015-12-25 23:32:55 +01:00
|
|
|
(\"^/\\(ftp@\\|anonymous@\\)?\\([^:/]+\\):/*\" . \"ftp://\\2/\")
|
|
|
|
(\"^/\\([^:@/]+@\\)?\\([^:/]+\\):/*\" . \"ftp://\\1\\2/\")
|
2007-08-23 18:41:14 +00:00
|
|
|
(\"^/+\" . \"file:/\")))"
|
2000-03-20 13:12:14 +00:00
|
|
|
:type '(repeat (cons :format "%v"
|
|
|
|
(regexp :tag "Regexp")
|
|
|
|
(string :tag "Replacement")))
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "25.1")
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-save-file nil
|
2007-08-23 18:41:14 +00:00
|
|
|
"If non-nil, save the buffer before displaying its file.
|
2000-03-20 13:12:14 +00:00
|
|
|
Used by the `browse-url-of-file' command."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'boolean)
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-of-file-hook nil
|
browse-url: mark some of the more obsolete stuff as such
* lisp/net/browse-url.el (browse-url-browser-function)
(browse-url-default-browser):
Remove obsolete items from the explicit listing.
(browse-url-new-window-flag, browse-url-of-file-hook): Doc fixes.
(browse-url-netscape-program, browse-url-netscape-arguments)
(browse-url-netscape-startup-arguments)
(browse-url-galeon-program, browse-url-galeon-arguments)
(browse-url-galeon-startup-arguments)
(browse-url-gnome-moz-program, browse-url-gnome-moz-arguments)
(browse-url-galeon-new-window-is-tab)
(browse-url-netscape-new-window-is-tab)
(browse-url-mosaic-program, browse-url-mosaic-arguments)
(browse-url-mosaic-pidfile, browse-url-CCI-port)
(browse-url-CCI-host, browse-url-netscape-version)
(browse-url-netscape, browse-url-netscape-sentinel)
(browse-url-netscape-reload, browse-url-netscape-send)
(browse-url-galeon, browse-url-galeon-sentinel)
(browse-url-gnome-moz, browse-url-mosaic, browse-url-cci)
(browse-url-w3-gnudoit): Make obsolete.
* etc/NEWS: Mention this.
* doc/misc/idlwave.texi (HTML Help Browser Tips): Remove obsolete info.
* lisp/ffap.el (ffap-url-fetcher): Simplify default and doc.
* lisp/x-dnd.el: Comment update.
2015-03-24 23:26:48 -07:00
|
|
|
"Hook run after `browse-url-of-file' has asked a browser to load a file."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'hook)
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2021-01-31 16:30:55 +01:00
|
|
|
(defvar-local browse-url-temp-file-name nil)
|
2008-07-08 14:45:36 +00:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
(defcustom browse-url-xterm-program "xterm"
|
2007-10-29 13:56:39 +00:00
|
|
|
"The name of the terminal emulator used by `browse-url-text-xterm'.
|
2005-06-10 14:13:42 +00:00
|
|
|
This might, for instance, be a separate color version of xterm."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'string)
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-xterm-args nil
|
2007-08-23 18:41:14 +00:00
|
|
|
"A list of strings defining options for `browse-url-xterm-program'.
|
2000-03-20 13:12:14 +00:00
|
|
|
These might set its size, for instance."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-gnudoit-program "gnudoit"
|
2007-08-23 18:41:14 +00:00
|
|
|
"The name of the `gnudoit' program used by `browse-url-w3-gnudoit'."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'string)
|
2022-07-07 13:18:01 +02:00
|
|
|
(make-obsolete-variable 'browse-url-gnudoit-program nil "29.1")
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-gnudoit-args '("-q")
|
2007-08-23 18:41:14 +00:00
|
|
|
"A list of strings defining options for `browse-url-gnudoit-program'.
|
2000-03-20 13:12:14 +00:00
|
|
|
These might set the port, for instance."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2022-07-07 13:18:01 +02:00
|
|
|
(make-obsolete-variable 'browse-url-gnudoit-args nil "29.1")
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-generic-program nil
|
2007-08-23 18:41:14 +00:00
|
|
|
"The name of the browser program used by `browse-url-generic'."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(choice string (const :tag "None" nil)))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-generic-args nil
|
2007-08-23 18:41:14 +00:00
|
|
|
"A list of strings defining options for `browse-url-generic-program'."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-temp-dir temporary-file-directory
|
2007-08-23 18:41:14 +00:00
|
|
|
"The name of a directory for browse-url's temporary files.
|
2000-03-20 13:12:14 +00:00
|
|
|
Such files are generated by functions like `browse-url-of-region'.
|
|
|
|
You might want to set this to somewhere with restricted read permissions
|
|
|
|
for privacy's sake."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type 'string)
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2007-10-29 13:56:39 +00:00
|
|
|
(defcustom browse-url-text-browser "lynx"
|
|
|
|
"The name of the text browser to invoke."
|
|
|
|
:type 'string
|
|
|
|
:version "23.1")
|
|
|
|
|
|
|
|
(defcustom browse-url-text-emacs-args (and (not window-system)
|
|
|
|
'("-show_cursor"))
|
|
|
|
"A list of strings defining options for a text browser in an Emacs buffer.
|
|
|
|
|
|
|
|
The default is none in a window system, otherwise `-show_cursor' to
|
|
|
|
indicate the position of the current link in the absence of
|
|
|
|
highlighting, assuming the normal default for showing the cursor."
|
|
|
|
:type '(repeat (string :tag "Argument"))
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "23.1")
|
2007-10-29 13:56:39 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-text-input-field 'avoid
|
|
|
|
"Action on selecting an existing text browser buffer at an input field.
|
|
|
|
What to do when sending a new URL to an existing text browser buffer in Emacs
|
|
|
|
if the browser cursor is on an input field (in which case the `g' command
|
2000-03-20 13:12:14 +00:00
|
|
|
would be entered as data). Such fields are recognized by the
|
2007-10-29 13:56:39 +00:00
|
|
|
underlines ____. Allowed values: nil: disregard it, `warn': warn the
|
|
|
|
user and don't emit the URL, `avoid': try to avoid the field by moving
|
2000-03-20 13:12:14 +00:00
|
|
|
down (this *won't* always work)."
|
|
|
|
:type '(choice (const :tag "Move to try to avoid field" :value avoid)
|
|
|
|
(const :tag "Disregard" :value nil)
|
|
|
|
(const :tag "Warn, don't emit URL" :value warn))
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "23.1")
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2007-10-29 13:56:39 +00:00
|
|
|
(defcustom browse-url-text-input-attempts 10
|
|
|
|
"How many times to try to move down from a series of text browser input fields."
|
2002-07-22 15:21:41 +00:00
|
|
|
:type 'integer
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "23.1")
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2007-10-29 13:56:39 +00:00
|
|
|
(defcustom browse-url-text-input-delay 0.2
|
|
|
|
"Seconds to wait for a text browser between moves down from an input field."
|
2002-07-22 15:21:41 +00:00
|
|
|
:type 'number
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "23.1")
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2001-05-18 11:27:38 +00:00
|
|
|
(defcustom browse-url-kde-program "kfmclient"
|
2007-08-23 18:41:14 +00:00
|
|
|
"The name by which to invoke the KDE web browser."
|
2001-05-18 11:27:38 +00:00
|
|
|
:type 'string
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "21.1")
|
2001-05-18 11:27:38 +00:00
|
|
|
|
|
|
|
(defcustom browse-url-kde-args '("openURL")
|
2007-08-23 18:41:14 +00:00
|
|
|
"A list of strings defining options for `browse-url-kde-program'."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Argument")))
|
2001-05-18 11:27:38 +00:00
|
|
|
|
2007-09-07 04:37:01 +00:00
|
|
|
(defcustom browse-url-elinks-wrapper '("xterm" "-e")
|
Remove leading `*' from docs of some defcustoms etc.
* emulation/crisp.el, emulation/cua-base.el, emulation/edt.el:
* emulation/pc-select.el, emulation/vip.el, international/iso-ascii.el:
* international/kkc.el, international/ogonek.el, mail/feedmail.el:
* net/browse-url.el, net/eudc-vars.el, net/net-utils.el:
* net/rcompile.el, net/rlogin.el, textmodes/enriched.el:
* textmodes/makeinfo.el, textmodes/page-ext.el, textmodes/picture.el:
* textmodes/refer.el, textmodes/spell.el, textmodes/table.el:
* textmodes/tex-mode.el, textmodes/two-column.el:
Remove leading `*' from docs of defcustoms etc.
2010-09-22 23:42:45 -07:00
|
|
|
"Wrapper command prepended to the Elinks command-line."
|
2019-07-28 15:55:31 +02:00
|
|
|
:type '(repeat (string :tag "Wrapper")))
|
2007-09-07 04:37:01 +00:00
|
|
|
|
2020-05-07 13:02:13 +02:00
|
|
|
(defun browse-url--browser-kind (function url)
|
|
|
|
"Return the browser kind of a browser FUNCTION for URL.
|
|
|
|
The browser kind is either `internal' (the browser runs inside
|
|
|
|
Emacs), `external' (the browser is spawned in an external
|
|
|
|
process), or nil (we don't know)."
|
|
|
|
(let ((kind (if (symbolp function)
|
|
|
|
(get function 'browse-url-browser-kind))))
|
|
|
|
(if (functionp kind)
|
|
|
|
(funcall kind url)
|
|
|
|
kind)))
|
|
|
|
|
2020-05-04 11:24:08 +02:00
|
|
|
(defun browse-url--mailto (url &rest args)
|
2020-06-16 21:32:58 +02:00
|
|
|
"Call `browse-url-mailto-function' with URL and ARGS."
|
2020-05-04 11:24:08 +02:00
|
|
|
(funcall browse-url-mailto-function url args))
|
|
|
|
|
2020-05-07 13:02:13 +02:00
|
|
|
(defun browse-url--browser-kind-mailto (url)
|
|
|
|
(browse-url--browser-kind browse-url-mailto-function url))
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url--mailto 'browse-url-browser-kind
|
|
|
|
#'browse-url--browser-kind-mailto)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2020-05-04 11:24:08 +02:00
|
|
|
(defun browse-url--man (url &rest args)
|
2020-06-16 21:32:58 +02:00
|
|
|
"Call `browse-url-man-function' with URL and ARGS."
|
2020-05-04 11:24:08 +02:00
|
|
|
(funcall browse-url-man-function url args))
|
|
|
|
|
2020-05-07 13:02:13 +02:00
|
|
|
(defun browse-url--browser-kind-man (url)
|
|
|
|
(browse-url--browser-kind browse-url-man-function url))
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url--man 'browse-url-browser-kind
|
|
|
|
#'browse-url--browser-kind-man)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2022-07-11 05:14:57 -07:00
|
|
|
(defun browse-url--irc (url &rest args)
|
|
|
|
"Call `browse-url-irc-function' with URL and ARGS."
|
|
|
|
(funcall browse-url-irc-function url args))
|
|
|
|
(function-put 'browse-url--irc 'browse-url-browser-kind 'internal)
|
|
|
|
|
2020-05-06 22:23:03 +02:00
|
|
|
(defun browse-url--browser (url &rest args)
|
2020-06-16 21:32:58 +02:00
|
|
|
"Call `browse-url-browser-function' with URL and ARGS."
|
2020-05-06 22:23:03 +02:00
|
|
|
(funcall browse-url-browser-function url args))
|
|
|
|
|
2020-05-07 13:02:13 +02:00
|
|
|
(defun browse-url--browser-kind-browser (url)
|
|
|
|
(browse-url--browser-kind browse-url-browser-function url))
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url--browser 'browse-url-browser-kind
|
|
|
|
#'browse-url--browser-kind-browser)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2020-05-08 20:57:19 +02:00
|
|
|
(defun browse-url--non-html-file-url-p (url)
|
|
|
|
"Return non-nil if URL is a file:// URL of a non-HTML file."
|
|
|
|
(and (string-match-p "\\`file://" url)
|
|
|
|
(not (string-match-p "\\`file://.*\\.html?\\b" url))))
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2020-05-04 11:24:08 +02:00
|
|
|
;;;###autoload
|
|
|
|
(defvar browse-url-default-handlers
|
|
|
|
'(("\\`mailto:" . browse-url--mailto)
|
|
|
|
("\\`man:" . browse-url--man)
|
2022-07-11 05:14:57 -07:00
|
|
|
("\\`irc6?s?://" . browse-url--irc)
|
2020-05-08 20:57:19 +02:00
|
|
|
(browse-url--non-html-file-url-p . browse-url-emacs))
|
2020-05-04 11:24:08 +02:00
|
|
|
"Like `browse-url-handlers' but populated by Emacs and packages.
|
|
|
|
|
|
|
|
Emacs and external packages capable of browsing certain URLs
|
|
|
|
should place their entries in this alist rather than
|
|
|
|
`browse-url-handlers' which is reserved for the user.")
|
|
|
|
|
|
|
|
(defcustom browse-url-handlers nil
|
2020-05-08 20:57:19 +02:00
|
|
|
"An alist with elements of the form (REGEXP-OR-PREDICATE . HANDLER).
|
|
|
|
Each REGEXP-OR-PREDICATE is matched against the URL to be opened
|
|
|
|
in turn and the first match's HANDLER is invoked with the URL.
|
2020-05-04 11:24:08 +02:00
|
|
|
|
|
|
|
A HANDLER must be a function with the same arguments as
|
|
|
|
`browse-url'.
|
|
|
|
|
2020-05-08 20:57:19 +02:00
|
|
|
If no REGEXP-OR-PREDICATE matches, the same procedure is
|
|
|
|
performed with the value of `browse-url-default-handlers'. If
|
|
|
|
there is also no match, the URL is opened using the value of
|
2020-05-04 11:24:08 +02:00
|
|
|
`browse-url-browser-function'."
|
2020-05-08 20:57:19 +02:00
|
|
|
:type '(alist :key-type (choice
|
|
|
|
(regexp :tag "Regexp")
|
|
|
|
(function :tag "Predicate"))
|
2020-05-04 11:24:08 +02:00
|
|
|
:value-type (function :tag "Handler"))
|
|
|
|
:version "28.1")
|
|
|
|
|
2020-05-07 09:53:54 +02:00
|
|
|
;;;###autoload
|
2020-05-07 13:02:13 +02:00
|
|
|
(defun browse-url-select-handler (url &optional kind)
|
|
|
|
"Return a handler of suitable for browsing URL.
|
2020-05-07 09:53:54 +02:00
|
|
|
This searches `browse-url-handlers', and
|
|
|
|
`browse-url-default-handlers' for a matching handler. Return nil
|
|
|
|
if no handler is found.
|
|
|
|
|
2020-05-07 13:02:13 +02:00
|
|
|
If KIND is given, the search is restricted to handlers whose
|
|
|
|
function symbol has the symbol-property `browse-url-browser-kind'
|
|
|
|
set to KIND.
|
|
|
|
|
2020-05-07 09:53:54 +02:00
|
|
|
Currently, it also consults `browse-url-browser-function' first
|
|
|
|
if it is set to an alist, although this usage is deprecated since
|
|
|
|
Emacs 28.1 and will be removed in a future release."
|
|
|
|
(catch 'custom-url-handler
|
2020-05-08 20:57:19 +02:00
|
|
|
(dolist (rxpred-handler
|
2020-05-07 09:53:54 +02:00
|
|
|
(append
|
|
|
|
;; The alist choice of browse-url-browser-function
|
|
|
|
;; is deprecated since 28.1, so the (unless ...)
|
|
|
|
;; can be removed at some point in time.
|
|
|
|
(when (and (consp browse-url-browser-function)
|
|
|
|
(not (functionp browse-url-browser-function)))
|
2020-05-07 16:59:26 +01:00
|
|
|
(lwarn 'browse-url :warning
|
|
|
|
"Having `browse-url-browser-function' set to an
|
2020-05-07 09:53:54 +02:00
|
|
|
alist is deprecated. Use `browse-url-handlers' instead.")
|
|
|
|
browse-url-browser-function)
|
|
|
|
browse-url-handlers
|
|
|
|
browse-url-default-handlers))
|
2020-05-08 20:57:19 +02:00
|
|
|
(let ((rx-or-pred (car rxpred-handler))
|
|
|
|
(handler (cdr rxpred-handler)))
|
|
|
|
(when (and (or (null kind)
|
|
|
|
(eq kind (browse-url--browser-kind
|
|
|
|
handler url)))
|
|
|
|
(if (functionp rx-or-pred)
|
|
|
|
(funcall rx-or-pred url)
|
|
|
|
(string-match-p rx-or-pred url)))
|
|
|
|
(throw 'custom-url-handler handler))))))
|
2020-05-07 09:53:54 +02:00
|
|
|
|
2007-09-07 04:37:01 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; URL encoding
|
|
|
|
|
2007-09-17 15:59:55 +00:00
|
|
|
(defun browse-url-url-encode-chars (text chars)
|
|
|
|
"URL-encode the chars in TEXT that match CHARS.
|
2021-09-07 17:41:31 +02:00
|
|
|
CHARS is a regexp that matches a character."
|
|
|
|
(replace-regexp-in-string chars
|
|
|
|
(lambda (s)
|
|
|
|
(format "%%%X" (string-to-char s)))
|
|
|
|
text))
|
2007-09-07 04:37:01 +00:00
|
|
|
|
2007-09-17 15:59:55 +00:00
|
|
|
(defun browse-url-encode-url (url)
|
|
|
|
"Escape annoying characters in URL.
|
2010-01-02 15:14:54 -05:00
|
|
|
The annoying characters are those that can mislead a web browser
|
|
|
|
regarding its parameter treatment."
|
|
|
|
;; FIXME: Is there an actual example of a web browser getting
|
2022-06-09 17:11:54 +02:00
|
|
|
;; confused? (This used to encode commas and dollar signs, but at
|
|
|
|
;; least Firefox handles commas correctly and doesn't accept those
|
|
|
|
;; encoded.)
|
|
|
|
(browse-url-url-encode-chars url "[\"() ]"))
|
2007-09-17 15:59:55 +00:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; URL input
|
|
|
|
|
2022-07-10 18:44:43 +02:00
|
|
|
(defcustom browse-url-default-scheme "http"
|
|
|
|
"URL scheme that `browse-url' (and related commands) will use by default.
|
2022-07-10 14:30:52 +02:00
|
|
|
|
|
|
|
For example, when point is on an URL fragment like
|
|
|
|
\"www.example.org\", `browse-url' will assume that this is an
|
|
|
|
\"http\" URL by default (i.e. \"http://www.example.org\").
|
|
|
|
|
|
|
|
Note that if you set this to \"https\", websites that do not yet
|
|
|
|
support HTTPS may not load correctly in your web browser. Such
|
|
|
|
websites are increasingly rare, but they do still exist."
|
2023-10-26 23:58:05 +02:00
|
|
|
:type '(choice (const :tag "HTTP" "http")
|
|
|
|
(const :tag "HTTPS" "https")
|
|
|
|
(string :tag "Something else" "https"))
|
2022-07-10 14:30:52 +02:00
|
|
|
:version "29.1")
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
(defun browse-url-url-at-point ()
|
2013-05-08 11:13:25 -04:00
|
|
|
(or (thing-at-point 'url t)
|
|
|
|
;; assume that the user is pointing at something like gnu.org/gnu
|
2024-02-04 03:20:24 +09:00
|
|
|
(when-let ((f (thing-at-point 'filename t)))
|
|
|
|
(if (string-match-p browse-url-button-regexp f)
|
|
|
|
f
|
|
|
|
(concat browse-url-default-scheme "://" f)))))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
;; Having this as a separate function called by the browser-specific
|
|
|
|
;; functions allows them to be stand-alone commands, making it easier
|
|
|
|
;; to switch between browsers.
|
|
|
|
|
2015-02-01 11:39:36 -08:00
|
|
|
(defun browse-url-interactive-arg (prompt)
|
2000-03-20 13:12:14 +00:00
|
|
|
"Read a URL from the minibuffer, prompting with PROMPT.
|
2004-05-23 22:38:30 +00:00
|
|
|
If `transient-mark-mode' is non-nil and the mark is active,
|
2004-05-29 15:34:50 +00:00
|
|
|
it defaults to the current region, else to the URL at or before
|
|
|
|
point. If invoked with a mouse button, it moves point to the
|
|
|
|
position clicked before acting.
|
|
|
|
|
2024-03-07 21:55:45 -08:00
|
|
|
This function returns a list (URL NEW-WINDOW-FLAG) for use in
|
|
|
|
`interactive'. NEW-WINDOW-FLAG is the prefix arg; if
|
|
|
|
`browse-url-new-window-flag' is non-nil, invert the prefix arg
|
|
|
|
instead."
|
2000-03-20 13:12:14 +00:00
|
|
|
(let ((event (elt (this-command-keys) 0)))
|
2021-11-22 14:23:26 -05:00
|
|
|
(mouse-set-point event))
|
2004-05-23 22:38:30 +00:00
|
|
|
(list (read-string prompt (or (and transient-mark-mode mark-active
|
|
|
|
;; rfc2396 Appendix E.
|
|
|
|
(replace-regexp-in-string
|
|
|
|
"[\t\r\f\n ]+" ""
|
|
|
|
(buffer-substring-no-properties
|
|
|
|
(region-beginning) (region-end))))
|
2015-02-01 11:39:36 -08:00
|
|
|
(browse-url-url-at-point)))
|
2024-03-07 21:55:45 -08:00
|
|
|
(xor browse-url-new-window-flag current-prefix-arg)))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2004-11-04 10:15:37 +00:00
|
|
|
;; called-interactive-p needs to be called at a function's top-level, hence
|
|
|
|
;; this macro. We use that rather than interactive-p because
|
|
|
|
;; use in a keyboard macro should not change this behavior.
|
2000-03-22 23:06:18 +00:00
|
|
|
(defmacro browse-url-maybe-new-window (arg)
|
2009-10-02 00:02:02 +00:00
|
|
|
`(if (or noninteractive (not (called-interactively-p 'any)))
|
2000-03-22 23:06:18 +00:00
|
|
|
,arg
|
2001-04-18 12:48:36 +00:00
|
|
|
browse-url-new-window-flag))
|
2000-03-22 23:06:18 +00:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Browse current buffer
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-of-file (&optional file)
|
2021-06-12 15:07:03 +02:00
|
|
|
"Use a web browser to display FILE.
|
2000-03-20 13:12:14 +00:00
|
|
|
Display the current buffer's file if FILE is nil or if called
|
|
|
|
interactively. Turn the filename into a URL with function
|
|
|
|
`browse-url-file-url'. Pass the URL to a browser using the
|
|
|
|
`browse-url' function then run `browse-url-of-file-hook'."
|
|
|
|
(interactive)
|
|
|
|
(or file
|
|
|
|
(setq file (buffer-file-name))
|
|
|
|
(error "Current buffer has no file"))
|
|
|
|
(let ((buf (get-file-buffer file)))
|
|
|
|
(if buf
|
2007-08-22 18:52:59 +00:00
|
|
|
(with-current-buffer buf
|
2000-03-20 13:12:14 +00:00
|
|
|
(cond ((not (buffer-modified-p)))
|
|
|
|
(browse-url-save-file (save-buffer))
|
|
|
|
(t (message "%s modified since last save" file))))))
|
2021-12-25 14:13:43 +01:00
|
|
|
(when (and (file-remote-p file)
|
|
|
|
(not browse-url-temp-file-name))
|
|
|
|
(setq browse-url-temp-file-name (file-local-copy file)
|
|
|
|
file browse-url-temp-file-name))
|
2000-03-20 13:12:14 +00:00
|
|
|
(browse-url (browse-url-file-url file))
|
|
|
|
(run-hooks 'browse-url-of-file-hook))
|
|
|
|
|
2022-03-07 03:27:55 +01:00
|
|
|
(defun browse-url--file-name-coding-system ()
|
|
|
|
(if (equal system-type 'windows-nt)
|
|
|
|
;; W32 pretends that file names are UTF-8 encoded.
|
|
|
|
'utf-8
|
|
|
|
(or file-name-coding-system default-file-name-coding-system)))
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
(defun browse-url-file-url (file)
|
|
|
|
"Return the URL corresponding to FILE.
|
|
|
|
Use variable `browse-url-filename-alist' to map filenames to URLs."
|
2022-03-07 03:27:55 +01:00
|
|
|
(when-let ((coding (browse-url--file-name-coding-system)))
|
|
|
|
(setq file (encode-coding-string file coding)))
|
|
|
|
(if (and (file-remote-p file)
|
|
|
|
;; We're applying special rules for FTP URLs for historical
|
|
|
|
;; reasons.
|
|
|
|
(seq-find (lambda (match)
|
|
|
|
(and (string-match-p (car match) file)
|
2022-03-07 05:58:39 +01:00
|
|
|
(not (string-match "\\`file:" (cdr match)))))
|
2022-03-07 03:27:55 +01:00
|
|
|
browse-url-filename-alist))
|
|
|
|
(setq file (browse-url-url-encode-chars file "[*\"()',=;?% ]"))
|
|
|
|
;; Encode all other file names properly.
|
2022-04-06 11:58:02 +02:00
|
|
|
(let ((bits (file-name-split file)))
|
|
|
|
(setq file
|
|
|
|
(string-join
|
|
|
|
;; On Windows, the first bit here might be "c:" or the
|
|
|
|
;; like, so don't encode the ":" in the first bit.
|
|
|
|
(cons (let ((url-unreserved-chars
|
|
|
|
(if (file-name-absolute-p file)
|
|
|
|
(cons ?: url-unreserved-chars)
|
|
|
|
url-unreserved-chars)))
|
|
|
|
(url-hexify-string (car bits)))
|
|
|
|
(mapcar #'url-hexify-string (cdr bits)))
|
|
|
|
"/"))))
|
2000-09-26 13:05:29 +00:00
|
|
|
(dolist (map browse-url-filename-alist)
|
|
|
|
(when (and map (string-match (car map) file))
|
|
|
|
(setq file (replace-match (cdr map) t nil file))))
|
2000-03-20 13:12:14 +00:00
|
|
|
file)
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-of-buffer (&optional buffer)
|
2021-06-12 15:07:03 +02:00
|
|
|
"Use a web browser to display BUFFER.
|
|
|
|
See `browse-url' for details.
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
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
|
2012-09-07 16:58:31 +08:00
|
|
|
(and (not (buffer-narrowed-p))
|
2000-03-20 13:12:14 +00:00
|
|
|
(or buffer-file-name
|
|
|
|
(and (boundp 'dired-directory) dired-directory)))))
|
2019-08-17 17:30:42 -07:00
|
|
|
(when (or (not file-name)
|
|
|
|
;; This can happen when we're looking at a file from a
|
|
|
|
;; zip file buffer, for instance.
|
|
|
|
(not (file-exists-p file-name)))
|
|
|
|
(unless 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))
|
2000-03-20 13:12:14 +00:00
|
|
|
(browse-url-of-file file-name))))
|
|
|
|
|
|
|
|
(defun browse-url-delete-temp-file (&optional temp-file-name)
|
2020-06-16 21:32:58 +02:00
|
|
|
"Delete `browse-url-temp-file-name' from the file system.
|
|
|
|
If optional arg TEMP-FILE-NAME is non-nil, delete it instead."
|
2000-03-20 13:12:14 +00:00
|
|
|
(let ((file-name (or temp-file-name browse-url-temp-file-name)))
|
|
|
|
(if (and file-name (file-exists-p file-name))
|
|
|
|
(delete-file file-name))))
|
|
|
|
|
2021-03-08 10:11:22 -05:00
|
|
|
(add-hook 'kill-buffer-hook #'browse-url-delete-temp-file)
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2010-10-08 17:52:12 -07:00
|
|
|
(declare-function dired-get-filename "dired"
|
|
|
|
(&optional localp no-error-if-not-filep))
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;###autoload
|
2023-04-25 12:28:47 +02:00
|
|
|
(defun browse-url-of-dired-file (&optional secondary)
|
|
|
|
"In Dired, ask a WWW browser to display the file named on this line.
|
|
|
|
With prefix arg, use the secondary browser instead (e.g. EWW if
|
|
|
|
`browse-url-secondary-browser-function' is set to
|
|
|
|
`eww-browse-url'."
|
|
|
|
(interactive "P")
|
2022-03-07 05:13:19 +01:00
|
|
|
(let ((tem (dired-get-filename t t))
|
2023-04-25 12:28:47 +02:00
|
|
|
(browse-url-browser-function
|
|
|
|
(if secondary
|
|
|
|
browse-url-secondary-browser-function
|
|
|
|
browse-url-browser-function))
|
2022-03-07 05:15:58 +01:00
|
|
|
;; Some URL handlers open files in Emacs. We want to always
|
|
|
|
;; open in a browser, so disable those.
|
|
|
|
(browse-url-default-handlers nil))
|
2011-05-08 14:34:51 -04:00
|
|
|
(if tem
|
|
|
|
(browse-url-of-file (expand-file-name tem))
|
|
|
|
(error "No file on this line"))))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-of-region (min max)
|
2021-06-12 15:07:03 +02:00
|
|
|
"Use a web browser to display the current region.
|
|
|
|
See `browse-url' for details."
|
2000-03-20 13:12:14 +00:00
|
|
|
(interactive "r")
|
|
|
|
(save-excursion
|
|
|
|
(save-restriction
|
|
|
|
(narrow-to-region min max)
|
|
|
|
(browse-url-of-buffer))))
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Browser-independent commands
|
|
|
|
|
|
|
|
;; A generic command to call the current browse-url-browser-function
|
|
|
|
|
2021-12-18 15:39:57 +02:00
|
|
|
(declare-function pgtk-backend-display-class "pgtkfns.c" (&optional terminal))
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url (url &rest args)
|
2021-06-12 15:07:03 +02:00
|
|
|
"Open URL using a configurable method.
|
|
|
|
This will typically (by default) open URL with an external web
|
|
|
|
browser, but a wide variety of different methods can be used,
|
|
|
|
depending on the URL type.
|
2020-05-04 11:24:08 +02:00
|
|
|
|
|
|
|
The variables `browse-url-browser-function',
|
|
|
|
`browse-url-handlers', and `browse-url-default-handlers'
|
|
|
|
determine which browser function to use.
|
|
|
|
|
2024-03-07 21:55:45 -08:00
|
|
|
Interactively, this command prompts for a URL, defaulting to the
|
|
|
|
URL at or before point.
|
2021-06-12 15:07:03 +02:00
|
|
|
|
2020-05-04 11:24:08 +02:00
|
|
|
The additional ARGS are passed to the browser function. See the
|
|
|
|
doc strings of the actual functions, starting with
|
|
|
|
`browse-url-browser-function', for information about the
|
|
|
|
significance of ARGS (most of the functions ignore it).
|
|
|
|
|
|
|
|
If ARGS are omitted, the default is to pass
|
2024-03-07 21:55:45 -08:00
|
|
|
`browse-url-new-window-flag' as ARGS. Interactively, pass the
|
|
|
|
prefix arg as ARGS; if `browse-url-new-window-flag' is non-nil,
|
|
|
|
invert the prefix arg instead."
|
2000-03-20 13:12:14 +00:00
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
2009-10-02 03:48:36 +00:00
|
|
|
(unless (called-interactively-p 'interactive)
|
2001-04-18 12:48:36 +00:00
|
|
|
(setq args (or args (list browse-url-new-window-flag))))
|
2019-08-23 06:00:36 +02:00
|
|
|
(when (and url-handler-mode
|
|
|
|
(not (file-name-absolute-p url))
|
|
|
|
(not (string-match "\\`[a-z]+:" url)))
|
2014-05-13 10:54:08 +02:00
|
|
|
(setq url (expand-file-name url)))
|
2010-11-24 07:29:06 +01:00
|
|
|
(let ((process-environment (copy-sequence process-environment))
|
2020-05-07 09:53:54 +02:00
|
|
|
(function (or (browse-url-select-handler url)
|
|
|
|
browse-url-browser-function))
|
2020-05-04 11:24:08 +02:00
|
|
|
;; Ensure that `default-directory' exists and is readable (bug#6077).
|
2014-05-13 10:54:08 +02:00
|
|
|
(default-directory (or (unhandled-file-name-directory default-directory)
|
|
|
|
(expand-file-name "~/"))))
|
2006-12-08 03:17:10 +00:00
|
|
|
;; When connected to various displays, be careful to use the display of
|
|
|
|
;; the currently selected frame, rather than the original start display,
|
|
|
|
;; which may not even exist any more.
|
2018-05-12 23:49:00 +09:00
|
|
|
(let ((dpy (frame-parameter nil 'display))
|
|
|
|
classname)
|
|
|
|
(if (stringp dpy)
|
|
|
|
(cond
|
|
|
|
((featurep 'pgtk)
|
|
|
|
(setq classname (pgtk-backend-display-class))
|
|
|
|
(if (equal classname "GdkWaylandDisplay")
|
2022-04-03 15:23:01 +08:00
|
|
|
(progn
|
|
|
|
;; The `display' frame parameter is probably wrong.
|
|
|
|
;; See bug#53969 for some context.
|
|
|
|
;; (setenv "WAYLAND_DISPLAY" dpy)
|
|
|
|
)
|
2018-05-12 23:49:00 +09:00
|
|
|
(setenv "DISPLAY" dpy)))
|
2023-09-06 10:31:26 +08:00
|
|
|
((featurep 'android)
|
|
|
|
;; Avoid modifying the DISPLAY environment variable here,
|
|
|
|
;; which interferes with any X server the user may have
|
|
|
|
;; expressly set.
|
|
|
|
nil)
|
2018-05-12 23:49:00 +09:00
|
|
|
(t
|
|
|
|
(setenv "DISPLAY" dpy)))))
|
2020-05-07 13:10:44 +02:00
|
|
|
(if (functionp function)
|
2020-05-07 09:53:54 +02:00
|
|
|
(apply function url args)
|
|
|
|
(error "No suitable browser for URL %s" url))))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
2000-03-22 23:06:18 +00:00
|
|
|
(defun browse-url-at-point (&optional arg)
|
2021-06-12 15:07:03 +02:00
|
|
|
"Open URL at point using a configurable method.
|
|
|
|
See `browse-url' for details.
|
2015-04-18 18:00:02 -07:00
|
|
|
Optional prefix argument ARG non-nil inverts the value of the option
|
|
|
|
`browse-url-new-window-flag'."
|
2000-03-22 23:06:18 +00:00
|
|
|
(interactive "P")
|
2000-08-15 11:17:17 +00:00
|
|
|
(let ((url (browse-url-url-at-point)))
|
|
|
|
(if url
|
|
|
|
(browse-url url (if arg
|
2001-04-18 12:48:36 +00:00
|
|
|
(not browse-url-new-window-flag)
|
|
|
|
browse-url-new-window-flag))
|
2000-08-15 11:17:17 +00:00
|
|
|
(error "No URL found"))))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2020-05-07 19:38:57 +02:00
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-with-browser-kind (kind url &optional arg)
|
|
|
|
"Browse URL with a browser of the given browser KIND.
|
|
|
|
KIND is either `internal' or `external'.
|
|
|
|
|
|
|
|
When called interactively, the default browser kind is the
|
|
|
|
opposite of the browser kind of `browse-url-browser-function'."
|
|
|
|
(interactive
|
|
|
|
(let* ((url-arg (browse-url-interactive-arg "URL: "))
|
|
|
|
;; Default to the inverse kind of the default browser.
|
|
|
|
(default (if (eq (browse-url--browser-kind
|
|
|
|
browse-url-browser-function (car url-arg))
|
|
|
|
'internal)
|
|
|
|
'external
|
|
|
|
'internal))
|
2020-05-08 21:07:56 +02:00
|
|
|
(k (intern (completing-read
|
Use `format-prompt' when prompting with default values
* lisp/woman.el (woman-file-name):
* lisp/wid-edit.el (widget-file-prompt-value)
(widget-coding-system-prompt-value):
* lisp/w32-fns.el (w32-set-system-coding-system):
* lisp/vc/vc.el (vc-print-root-log):
* lisp/vc/vc-annotate.el (vc-annotate):
* lisp/vc/emerge.el (emerge-read-file-name):
* lisp/vc/ediff.el (ediff-directories)
(ediff-directory-revisions, ediff-directories3)
(ediff-merge-directories, )
(ediff-merge-directories-with-ancestor)
(ediff-merge-directory-revisions)
(ediff-merge-directory-revisions-with-ancestor)
(ediff-merge-revisions, ediff-merge-revisions-with-ancestor)
(ediff-revision):
* lisp/vc/ediff-util.el (ediff-toggle-regexp-match):
* lisp/vc/ediff-mult.el (ediff-filegroup-action):
* lisp/vc/add-log.el (prompt-for-change-log-name):
* lisp/textmodes/table.el (table-insert-row-column)
(table-span-cell, table-split-cell-horizontally)
(table-split-cell, table-justify, table-generate-source)
(table-insert-sequence, table-capture)
(table--read-from-minibuffer, table--query-justification):
* lisp/textmodes/sgml-mode.el (sgml-tag, sgml-tag-help):
* lisp/textmodes/reftex-ref.el (reftex-goto-label):
* lisp/textmodes/refer.el (refer-get-bib-files):
* lisp/textmodes/css-mode.el (css-lookup-symbol):
* lisp/term.el (serial-read-name, serial-read-speed):
* lisp/speedbar.el (speedbar-change-initial-expansion-list):
* lisp/simple.el (previous-matching-history-element)
(set-variable):
* lisp/ses.el (ses-read-cell, ses-set-column-width):
* lisp/replace.el (query-replace-read-from)
(occur-read-primary-args):
* lisp/rect.el (string-rectangle, string-insert-rectangle):
* lisp/progmodes/tcl.el (tcl-help-on-word):
* lisp/progmodes/sh-script.el (sh-set-shell):
* lisp/progmodes/python.el (python-eldoc-at-point):
* lisp/progmodes/octave.el (octave-completing-read)
(octave-update-function-file-comment, octave-insert-defun):
* lisp/progmodes/inf-lisp.el (lisp-symprompt):
* lisp/progmodes/cperl-mode.el (cperl-info-on-command)
(cperl-perldoc):
* lisp/progmodes/compile.el (compilation-find-file):
* lisp/net/rcirc.el (rcirc-prompt-for-encryption):
* lisp/net/eww.el (eww):
* lisp/net/browse-url.el (browse-url-with-browser-kind):
* lisp/man.el (man):
* lisp/mail/sendmail.el (sendmail-query-user-about-smtp):
* lisp/mail/mailalias.el (build-mail-aliases):
* lisp/mail/mailabbrev.el (merge-mail-abbrevs)
(rebuild-mail-abbrevs):
* lisp/locate.el (locate-prompt-for-search-string):
* lisp/isearch.el (isearch-occur):
* lisp/international/ogonek.el (ogonek-read-encoding)
(ogonek-read-prefix):
* lisp/international/mule.el (read-buffer-file-coding-system)
(set-terminal-coding-system, set-keyboard-coding-system)
(set-next-selection-coding-system, recode-region):
* lisp/international/mule-cmds.el ()
(universal-coding-system-argument, search-unencodable-char)
(select-safe-coding-system-interactively):
* lisp/info.el (Info-search, Info-search-backward, Info-menu):
* lisp/info-look.el (info-lookup-interactive-arguments):
* lisp/imenu.el (imenu--completion-buffer):
* lisp/ibuf-ext.el (mode, used-mode, ibuffer-mark-by-mode):
* lisp/hi-lock.el (hi-lock-unface-buffer)
(hi-lock-read-face-name):
* lisp/help.el (view-emacs-news, where-is):
* lisp/help-fns.el (describe-variable, describe-symbol)
(describe-keymap):
* lisp/gnus/mm-decode.el (mm-save-part):
* lisp/gnus/gnus-sum.el (gnus-summary-browse-url):
* lisp/gnus/gnus-group.el (gnus-group--read-bug-ids)
(gnus-group-set-current-level):
* lisp/frame.el (make-frame-on-monitor)
(close-display-connection, select-frame-by-name):
* lisp/format.el (format-encode-buffer, format-encode-region):
* lisp/files.el (recode-file-name):
* lisp/files-x.el (read-file-local-variable)
(read-file-local-variable-value, )
(read-file-local-variable-mode):
* lisp/ffap.el (ffap-menu-ask):
* lisp/faces.el (face-read-string):
* lisp/facemenu.el (facemenu-set-charset):
* lisp/erc/erc-dcc.el (erc-dcc-do-GET-command):
* lisp/emulation/edt-mapper.el (edt-mapper):
* lisp/emacs-lisp/trace.el (trace--read-args)
(trace-function-foreground, trace-function-background):
* lisp/emacs-lisp/smie.el (smie-config-set-indent):
* lisp/emacs-lisp/re-builder.el (reb-change-syntax):
* lisp/emacs-lisp/package.el (describe-package):
* lisp/emacs-lisp/find-func.el (read-library-name)
(find-function-read):
* lisp/emacs-lisp/ert.el (ert-read-test-name)
(ert-run-tests-interactively):
* lisp/emacs-lisp/disass.el (disassemble):
* lisp/emacs-lisp/debug.el (debug-on-entry)
(debug-on-variable-change):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-read-regexp):
* lisp/dired-x.el (dired--mark-suffix-interactive-spec):
* lisp/dired-aux.el (dired-diff):
* lisp/cus-edit.el (custom-variable-prompt, customize-mode)
(customize-changed-options):
* lisp/completion.el (interactive-completion-string-reader):
* lisp/calendar/timeclock.el (timeclock-ask-for-project):
* lisp/calc/calcalg3.el (calc-get-fit-variables):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-bin.el (calc-word-size):
* lisp/bookmark.el (bookmark-set-internal):
* lisp/abbrev.el (read-abbrev-file): Use `format-prompt' for
prompting (bug#12443).
2020-09-06 16:56:44 +02:00
|
|
|
(format-prompt "Browser kind" default)
|
2020-05-08 21:07:56 +02:00
|
|
|
'(internal external)
|
|
|
|
nil t nil nil
|
|
|
|
default))))
|
2020-05-07 19:38:57 +02:00
|
|
|
(cons k url-arg)))
|
|
|
|
(let ((function (browse-url-select-handler url kind)))
|
|
|
|
(unless function
|
|
|
|
(setq function (if (eq kind 'external)
|
|
|
|
#'browse-url-default-browser
|
|
|
|
#'eww)))
|
|
|
|
(funcall function url arg)))
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-at-mouse (event)
|
2021-06-12 15:07:03 +02:00
|
|
|
"Use a web browser to load a URL clicked with the mouse.
|
|
|
|
See `browse-url' for details.
|
|
|
|
|
|
|
|
The URL is the one around or before the position of the mouse
|
|
|
|
click but point is not changed."
|
2000-03-20 13:12:14 +00:00
|
|
|
(interactive "e")
|
|
|
|
(save-excursion
|
2000-08-15 11:17:17 +00:00
|
|
|
(mouse-set-point event)
|
2002-06-21 09:58:32 +00:00
|
|
|
;; This handles browse-url-new-window-flag properly
|
|
|
|
;; when it gets no arg.
|
|
|
|
(browse-url-at-point)))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Browser-specific commands
|
|
|
|
|
|
|
|
;; --- Default MS-Windows browser ---
|
|
|
|
|
2005-07-03 16:31:40 +00:00
|
|
|
(defvar dos-windows-version)
|
2007-11-22 01:05:55 +00:00
|
|
|
(declare-function w32-shell-execute "w32fns.c") ;; Defined in C.
|
2005-07-03 16:31:40 +00:00
|
|
|
|
2013-09-10 23:52:26 +02:00
|
|
|
(defun browse-url-default-windows-browser (url &optional _new-window)
|
2015-12-26 20:47:42 +02:00
|
|
|
"Invoke the MS-Windows system's default Web browser.
|
|
|
|
The optional NEW-WINDOW argument is not used."
|
2000-03-20 13:12:14 +00:00
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
2021-09-07 17:46:52 +02:00
|
|
|
(setq url (browse-url-encode-url url))
|
2009-11-20 21:49:46 +00:00
|
|
|
(cond ((eq system-type 'ms-dos)
|
|
|
|
(if dos-windows-version
|
|
|
|
(shell-command (concat "start " (shell-quote-argument url)))
|
|
|
|
(error "Browsing URLs is not supported on this system")))
|
|
|
|
((eq system-type 'cygwin)
|
2009-11-23 20:58:55 +00:00
|
|
|
(call-process "cygstart" nil nil nil url))
|
2018-05-03 21:04:17 +03:00
|
|
|
(t
|
|
|
|
(w32-shell-execute "open"
|
|
|
|
;; w32-shell-execute passes file:// URLs
|
|
|
|
;; to APIs that expect file names, so we
|
|
|
|
;; need to unhex any %nn encoded
|
|
|
|
;; characters in the URL. We don't do
|
|
|
|
;; that for other URLs; in particular,
|
|
|
|
;; default Windows mail client barfs on
|
|
|
|
;; quotes in the MAILTO URLs, so we prefer
|
|
|
|
;; to leave the URL with its embedded %nn
|
|
|
|
;; encoding intact.
|
2022-07-26 13:47:03 -04:00
|
|
|
(if (string-prefix-p "file://" url)
|
2018-05-03 21:04:17 +03:00
|
|
|
(url-unhex-string url)
|
|
|
|
url)))))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-default-windows-browser 'browse-url-browser-kind
|
|
|
|
'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2013-09-10 23:52:26 +02:00
|
|
|
(defun browse-url-default-macosx-browser (url &optional _new-window)
|
2016-11-06 00:33:43 -07:00
|
|
|
"Invoke the macOS system's default Web browser.
|
lisp/*.el: Fix typos and other trivial doc fixes
* lisp/allout-widgets.el (allout-widgets-auto-activation)
(allout-current-decorated-p):
* lisp/auth-source.el (auth-source-protocols):
* lisp/autorevert.el (auto-revert-set-timer):
* lisp/battery.el (battery-mode-line-limit):
* lisp/calc/calcalg3.el (math-map-binop):
* lisp/calendar/cal-dst.el (calendar-dst-find-startend):
* lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute):
* lisp/calendar/calendar.el (calendar-date-echo-text)
(calendar-generate-month, calendar-string-spread)
(calendar-cursor-to-date, calendar-read, calendar-read-date)
(calendar-mark-visible-date, calendar-dayname-on-or-before):
* lisp/calendar/diary-lib.el (diary-ordinal-suffix):
* lisp/cedet/ede/autoconf-edit.el (autoconf-new-program)
(autoconf-find-last-macro, autoconf-parameter-strip):
* lisp/cedet/ede/config.el (ede-target-with-config-build):
* lisp/cedet/ede/linux.el (ede-linux--detect-architecture)
(ede-linux--get-architecture):
* lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache)
(semantic-displayer-abstract, semantic-displayer-point-position):
* lisp/cedet/semantic/format.el (semantic-format-face-alist)
(semantic-format-tag-short-doc):
* lisp/cedet/semantic/fw.el (semantic-find-file-noselect):
* lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time)
(semantic-idle-breadcrumbs-display-function)
(semantic-idle-breadcrumbs-format-tag-list-function):
* lisp/cedet/semantic/lex.el (semantic-lex-map-types)
(define-lex, define-lex-block-type-analyzer):
* lisp/cedet/semantic/senator.el (senator-search-default-tag-filter):
* lisp/cedet/semantic/symref.el (semantic-symref-result)
(semantic-symref-hit-to-tag-via-db):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-new-variable)
(semantic-tag-new-include, semantic-tag-new-package)
(semantic-tag-set-faux, semantic-create-tag-proxy)
(semantic-tag-function-parent)
(semantic-tag-components-with-overlays):
* lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces)
(srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict):
* lisp/cedet/srecode/dictionary.el (srecode-create-dictionary)
(srecode-dictionary-add-entries, srecode-dictionary-lookup-name)
(srecode-create-dictionaries-from-tags):
* lisp/cmuscheme.el (scheme-compile-region):
* lisp/color.el (color-lab-to-lch):
* lisp/doc-view.el (doc-view-image-width)
(doc-view-set-up-single-converter):
* lisp/dynamic-setting.el (font-setting-change-default-font)
(dynamic-setting-handle-config-changed-event):
* lisp/elec-pair.el (electric-pair-text-pairs)
(electric-pair-skip-whitespace-function)
(electric-pair-string-bound-function):
* lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance)
(avl-tree-member, avl-tree-mapcar, avl-tree-iter):
* lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree):
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag)
(checkdoc-spellcheck-documentation-flag, checkdoc-ispell)
(checkdoc-ispell-current-buffer, checkdoc-ispell-interactive)
(checkdoc-ispell-message-interactive)
(checkdoc-ispell-message-text, checkdoc-ispell-start)
(checkdoc-ispell-continue, checkdoc-ispell-comments)
(checkdoc-ispell-defun):
* lisp/emacs-lisp/cl-generic.el (cl--generic-search-method):
* lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group):
* lisp/emacs-lisp/lisp.el (forward-sexp, up-list):
* lisp/emacs-lisp/package-x.el (package--archive-contents-from-file):
* lisp/emacs-lisp/package.el (package-desc)
(package--make-autoloads-and-stuff, package-hidden-regexps):
* lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup):
* lisp/emacs-lisp/testcover.el (testcover-nohits)
(testcover-1value):
* lisp/epg.el (epg-receive-keys, epg-start-edit-key):
* lisp/erc/erc-backend.el (erc-server-processing-p)
(erc-split-line-length, erc-server-coding-system)
(erc-server-send, erc-message):
* lisp/erc/erc-button.el (erc-button-face, erc-button-alist)
(erc-browse-emacswiki):
* lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login):
* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation):
* lisp/erc/erc-log.el (erc-current-logfile):
* lisp/erc/erc-match.el (erc-log-match-format)
(erc-text-matched-hook):
* lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug):
* lisp/erc/erc-networks.el (erc-server-alist)
(erc-networks-alist, erc-current-network):
* lisp/erc/erc-ring.el (erc-input-ring-index):
* lisp/erc/erc-speedbar.el (erc-speedbar)
(erc-speedbar-update-channel):
* lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag):
* lisp/erc/erc-track.el (erc-track-position-in-mode-line)
(erc-track-remove-from-mode-line, erc-modified-channels-update)
(erc-track-last-non-erc-buffer, erc-track-sort-by-importance)
(erc-track-get-active-buffer):
* lisp/erc/erc.el (erc-get-channel-user-list)
(erc-echo-notice-hook, erc-echo-notice-always-hook)
(erc-wash-quit-reason, erc-format-@nick):
* lisp/ffap.el (ffap-latex-mode):
* lisp/files.el (abort-if-file-too-large)
(dir-locals--get-sort-score, buffer-stale--default-function):
* lisp/filesets.el (filesets-tree-max-level, filesets-data)
(filesets-update-pre010505):
* lisp/gnus/gnus-agent.el (gnus-agent-flush-cache):
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-prefer-mid-or-mail):
* lisp/gnus/gnus-cus.el (gnus-group-parameters):
* lisp/gnus/gnus-demon.el (gnus-demon-handlers)
(gnus-demon-run-callback):
* lisp/gnus/gnus-dired.el (gnus-dired-print):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer):
* lisp/gnus/gnus-range.el (gnus-range-normalize):
* lisp/gnus/gnus-spec.el (gnus-pad-form):
* lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud)
(gnus-server-opened, gnus-server-closed, gnus-server-denied)
(gnus-server-offline):
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir)
(gnus-refer-thread-limit-to-thread)
(gnus-summary-limit-include-thread, gnus-summary-refer-thread)
(gnus-summary-find-matching):
* lisp/gnus/gnus-util.el (gnus-rescale-image):
* lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server):
* lisp/gnus/mail-source.el (mail-source-incoming-file-prefix):
* lisp/gnus/message.el (message-cite-reply-position)
(message-cite-style-outlook, message-cite-style-thunderbird)
(message-cite-style-gmail, message--send-mail-maybe-partially):
* lisp/gnus/mm-extern.el (mm-inline-external-body):
* lisp/gnus/mm-partial.el (mm-inline-partial):
* lisp/gnus/mml-sec.el (mml-secure-message-sign)
(mml-secure-message-sign-encrypt, mml-secure-message-encrypt):
* lisp/gnus/mml2015.el (mml2015-epg-key-image)
(mml2015-epg-key-image-to-string):
* lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail):
* lisp/gnus/nnheader.el (nnheader-directory-files-is-safe):
* lisp/gnus/nnir.el (nnir-search-history)
(nnir-imap-search-other, nnir-artlist-length)
(nnir-artlist-article, nnir-artitem-group, nnir-artitem-number)
(nnir-artitem-rsv, nnir-article-group, nnir-article-number)
(nnir-article-rsv, nnir-article-ids, nnir-categorize)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-hyrex-additional-switches)
(gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms)
(nnir-read-parm, nnir-read-server-parm, nnir-search-thread):
* lisp/gnus/nnmairix.el (nnmairix-default-group)
(nnmairix-propagate-marks):
* lisp/gnus/smime.el (smime-keys, smime-crl-check)
(smime-verify-buffer, smime-noverify-buffer):
* lisp/gnus/spam-report.el (spam-report-url-ping-mm-url):
* lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header)
(spam-spamassassin-spam-status-header, spam-sa-learn-rebuild)
(spam-classifications, spam-check-stat, spam-spamassassin-score):
* lisp/help.el (describe-minor-mode-from-symbol):
* lisp/hippie-exp.el (hippie-expand-ignore-buffers):
* lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face)
(hfy-begin-span):
* lisp/ibuf-ext.el (ibuffer-update-saved-filters-format)
(ibuffer-saved-filters, ibuffer-old-saved-filters-warning)
(ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters)
(eval, ibuffer-unary-operand, file-extension, directory):
* lisp/image-dired.el (image-dired-cmd-pngcrush-options):
* lisp/image-mode.el (image-toggle-display):
* lisp/international/ccl.el (ccl-compile-read-multibyte-character)
(ccl-compile-write-multibyte-character):
* lisp/international/kkc.el (kkc-save-init-file):
* lisp/international/latin1-disp.el (latin1-display):
* lisp/international/ogonek.el (ogonek-name-encoding-alist)
(ogonek-information, ogonek-lookup-encoding)
(ogonek-deprefixify-region):
* lisp/isearch.el (isearch-filter-predicate)
(isearch--momentary-message):
* lisp/jsonrpc.el (jsonrpc-connection-send)
(jsonrpc-process-connection, jsonrpc-shutdown)
(jsonrpc--async-request-1):
* lisp/language/tibet-util.el (tibetan-char-p):
* lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date)
(feedmail-last-chance-hook, feedmail-before-fcc-hook)
(feedmail-send-it-immediately-wrapper, feedmail-find-eoh):
* lisp/mail/hashcash.el (hashcash-generate-payment)
(hashcash-generate-payment-async, hashcash-insert-payment)
(hashcash-verify-payment):
* lisp/mail/rmail.el (rmail-movemail-variant-in-use)
(rmail-get-attr-value):
* lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime):
* lisp/mail/rmailsum.el (rmail-summary-show-message):
* lisp/mail/supercite.el (sc-raw-mode-toggle):
* lisp/man.el (Man-start-calling):
* lisp/mh-e/mh-acros.el (mh-do-at-event-location)
(mh-iterate-on-messages-in-region, mh-iterate-on-range):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases)
(mh-alias-reload, mh-alias-ali)
(mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file)
(mh-alias-add-alias):
* lisp/mouse.el (mouse-save-then-kill):
* lisp/net/browse-url.el (browse-url-default-macosx-browser):
* lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value)
(eudc-variable-server-value, eudc-update-variable)
(eudc-expand-inline):
* lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result):
* lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list):
* lisp/net/pop3.el (pop3-list):
* lisp/net/soap-client.el (soap-namespace-put)
(soap-xs-parse-sequence, soap-parse-envelope):
* lisp/net/soap-inspect.el (soap-inspect-xs-complex-type):
* lisp/nxml/rng-xsd.el (rng-xsd-date-to-days):
* lisp/org/ob-C.el (org-babel-prep-session:C)
(org-babel-load-session:C):
* lisp/org/ob-J.el (org-babel-execute:J):
* lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote):
* lisp/org/ob-awk.el (org-babel-execute:awk):
* lisp/org/ob-core.el (org-babel-process-file-name):
* lisp/org/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/org/ob-forth.el (org-babel-execute:forth):
* lisp/org/ob-fortran.el (org-babel-execute:fortran)
(org-babel-prep-session:fortran, org-babel-load-session:fortran):
* lisp/org/ob-groovy.el (org-babel-execute:groovy):
* lisp/org/ob-io.el (org-babel-execute:io):
* lisp/org/ob-js.el (org-babel-execute:js):
* lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond)
(org-babel-lilypond-compile-post-tangle)
(org-babel-lilypond-display-pdf-post-tangle)
(org-babel-lilypond-tangle)
(org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-compile-lilyfile)
(org-babel-lilypond-check-for-compile-error)
(org-babel-lilypond-process-compile-error)
(org-babel-lilypond-mark-error-line)
(org-babel-lilypond-parse-error-line)
(org-babel-lilypond-attempt-to-open-pdf)
(org-babel-lilypond-attempt-to-play-midi)
(org-babel-lilypond-switch-extension)
(org-babel-lilypond-set-header-args):
* lisp/org/ob-lua.el (org-babel-prep-session:lua):
* lisp/org/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/org/ob-processing.el (org-babel-prep-session:processing):
* lisp/org/ob-python.el (org-babel-prep-session:python):
* lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message)
(org-babel-scheme-execute-with-geiser, org-babel-execute:scheme):
* lisp/org/ob-shen.el (org-babel-execute:shen):
* lisp/org/org-agenda.el (org-agenda-entry-types)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-time-grid, org-agenda-sorting-strategy)
(org-agenda-filter-by-category, org-agenda-forward-block):
* lisp/org/org-colview.el (org-columns--overlay-text):
* lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces):
* lisp/org/org-indent.el (org-indent-set-line-properties):
* lisp/org/org-macs.el (org-get-limited-outline-regexp):
* lisp/org/org-mobile.el (org-mobile-files):
* lisp/org/org.el (org-use-fast-todo-selection)
(org-extend-today-until, org-use-property-inheritance)
(org-refresh-effort-properties, org-open-at-point-global)
(org-track-ordered-property-with-tag, org-shiftright):
* lisp/org/ox-html.el (org-html-checkbox-type):
* lisp/org/ox-man.el (org-man-source-highlight)
(org-man-verse-block):
* lisp/org/ox-publish.el (org-publish-sitemap-default):
* lisp/outline.el (outline-head-from-level):
* lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-calc-command-indent, dcl-indent-to):
* lisp/progmodes/flymake.el (flymake-make-diagnostic)
(flymake--overlays, flymake-diagnostic-functions)
(flymake-diagnostic-types-alist, flymake--backend-state)
(flymake-is-running, flymake--collect, flymake-mode):
* lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop)
(gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer):
* lisp/progmodes/grep.el (grep-error-screen-columns):
* lisp/progmodes/gud.el (gud-prev-expr):
* lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column)
(ps-run-goto-error):
* lisp/progmodes/python.el (python-eldoc-get-doc)
(python-eldoc-function-timeout-permanent, python-eldoc-function):
* lisp/shadowfile.el (shadow-make-group):
* lisp/speedbar.el (speedbar-obj-do-check):
* lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook):
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib):
* lisp/textmodes/reftex-index.el (reftex-index-goto-entry)
(reftex-index-kill, reftex-index-undo):
* lisp/textmodes/reftex-parse.el (reftex-context-substring):
* lisp/textmodes/reftex.el (reftex-TeX-master-file):
* lisp/textmodes/rst.el (rst-next-hdr, rst-toc)
(rst-uncomment-region, rst-font-lock-extend-region-internal):
* lisp/thumbs.el (thumbs-mode):
* lisp/vc/ediff-util.el (ediff-restore-diff):
* lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag):
* lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p):
* lisp/wid-edit.el (widget-field-value-set, string):
* lisp/x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-21 00:27:53 +02:00
|
|
|
The optional NEW-WINDOW argument is not used."
|
2003-04-12 22:21:18 +00:00
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
2021-09-07 17:46:52 +02:00
|
|
|
(setq url (browse-url-encode-url url))
|
2003-04-12 22:21:18 +00:00
|
|
|
(start-process (concat "open " url) nil "open" url))
|
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-default-macosx-browser 'browse-url-browser-kind
|
|
|
|
'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
(defun browse-url-process-environment ()
|
2001-11-19 19:12:31 +00:00
|
|
|
"Set DISPLAY in the environment to the X display the browser will use.
|
|
|
|
This is either the value of variable `browse-url-browser-display' if
|
2000-03-20 13:12:14 +00:00
|
|
|
non-nil, or the same display as Emacs if different from the current
|
|
|
|
environment, otherwise just use the current environment."
|
2001-11-19 19:12:31 +00:00
|
|
|
(let ((display (or browse-url-browser-display (browse-url-emacs-display))))
|
2000-03-20 13:12:14 +00:00
|
|
|
(if display
|
2022-03-11 16:36:11 +08:00
|
|
|
(cons (concat (if (and (eq window-system 'pgtk)
|
|
|
|
(equal (pgtk-backend-display-class)
|
|
|
|
"GdkWaylandDisplay"))
|
|
|
|
"WAYLAND_DISPLAY="
|
|
|
|
"DISPLAY=")
|
|
|
|
display)
|
|
|
|
process-environment)
|
2000-03-20 13:12:14 +00:00
|
|
|
process-environment)))
|
|
|
|
|
|
|
|
(defun browse-url-emacs-display ()
|
|
|
|
"Return the X display Emacs is running on.
|
|
|
|
This is nil if the display is the same as the DISPLAY environment variable.
|
|
|
|
|
|
|
|
Actually Emacs could be using several displays; this just returns the
|
|
|
|
one showing the selected frame."
|
|
|
|
(let ((display (cdr-safe (assq 'display (frame-parameters)))))
|
|
|
|
(and (not (equal display (getenv "DISPLAY")))
|
|
|
|
display)))
|
|
|
|
|
2001-11-19 19:12:31 +00:00
|
|
|
(defun browse-url-default-browser (url &rest args)
|
|
|
|
"Find a suitable browser and ask it to load URL.
|
|
|
|
Default to the URL around or before point.
|
|
|
|
|
|
|
|
When called interactively, if variable `browse-url-new-window-flag' is
|
|
|
|
non-nil, load the document in a new window, if possible, otherwise use
|
|
|
|
a random existing one. A non-nil interactive prefix argument reverses
|
|
|
|
the effect of `browse-url-new-window-flag'.
|
|
|
|
|
2015-12-26 20:47:42 +02:00
|
|
|
When called non-interactively, optional second argument ARGS is used
|
|
|
|
instead of `browse-url-new-window-flag'."
|
2001-11-19 19:12:31 +00:00
|
|
|
(apply
|
2007-09-17 15:59:55 +00:00
|
|
|
(cond
|
2011-07-13 15:49:55 +02:00
|
|
|
((memq system-type '(windows-nt ms-dos cygwin))
|
|
|
|
'browse-url-default-windows-browser)
|
|
|
|
((memq system-type '(darwin))
|
|
|
|
'browse-url-default-macosx-browser)
|
2022-05-09 07:54:54 +00:00
|
|
|
((featurep 'haiku)
|
|
|
|
'browse-url-default-haiku-browser)
|
2023-01-24 17:31:16 +08:00
|
|
|
((eq system-type 'android)
|
|
|
|
'browse-url-default-android-browser)
|
2010-08-17 10:01:10 +02:00
|
|
|
((browse-url-can-use-xdg-open) 'browse-url-xdg-open)
|
browse-url: mark some of the more obsolete stuff as such
* lisp/net/browse-url.el (browse-url-browser-function)
(browse-url-default-browser):
Remove obsolete items from the explicit listing.
(browse-url-new-window-flag, browse-url-of-file-hook): Doc fixes.
(browse-url-netscape-program, browse-url-netscape-arguments)
(browse-url-netscape-startup-arguments)
(browse-url-galeon-program, browse-url-galeon-arguments)
(browse-url-galeon-startup-arguments)
(browse-url-gnome-moz-program, browse-url-gnome-moz-arguments)
(browse-url-galeon-new-window-is-tab)
(browse-url-netscape-new-window-is-tab)
(browse-url-mosaic-program, browse-url-mosaic-arguments)
(browse-url-mosaic-pidfile, browse-url-CCI-port)
(browse-url-CCI-host, browse-url-netscape-version)
(browse-url-netscape, browse-url-netscape-sentinel)
(browse-url-netscape-reload, browse-url-netscape-send)
(browse-url-galeon, browse-url-galeon-sentinel)
(browse-url-gnome-moz, browse-url-mosaic, browse-url-cci)
(browse-url-w3-gnudoit): Make obsolete.
* etc/NEWS: Mention this.
* doc/misc/idlwave.texi (HTML Help Browser Tips): Remove obsolete info.
* lisp/ffap.el (ffap-url-fetcher): Simplify default and doc.
* lisp/x-dnd.el: Comment update.
2015-03-24 23:26:48 -07:00
|
|
|
;;; ((executable-find browse-url-gnome-moz-program) 'browse-url-gnome-moz)
|
2007-09-17 15:59:55 +00:00
|
|
|
((executable-find browse-url-firefox-program) 'browse-url-firefox)
|
2011-10-19 12:03:39 +03:00
|
|
|
((executable-find browse-url-chromium-program) 'browse-url-chromium)
|
2007-09-17 15:59:55 +00:00
|
|
|
((executable-find browse-url-kde-program) 'browse-url-kde)
|
2016-01-30 11:52:42 -08:00
|
|
|
((executable-find browse-url-chrome-program) 'browse-url-chrome)
|
Add support for the Haiku operating system and its window system
* .gitignore: Add binaries specific to Haiku.
* Makefie.in (HAVE_BE_APP): New variable.
(install-arch-dep): Install Emacs and Emacs.pdmp when
using Haiku.
* configure.ac: Detect and configure for Haiku and
various related configurations.
(be-app, be-freetype, be-cairo): New options.
(HAVE_BE_APP, HAIKU_OBJ, HAIKU_CXX_OBJ)
(HAIKU_LIBS, HAIKU_CFLAGS): New variables.
(HAIKU, HAVE_TINY_SPEED_T): New define.
(emacs_config_features): Add BE_APP.
* doc/emacs/Makefile.in (EMACSSOURCES): Add Haiku
appendix.
* doc/emacs/emacs.texi: Add Haiku appendix to menus and
include it.
* doc/emacs/haiku.texi: New Haiku appendix.
* doc/lispref/display.texi (Defining Faces, Window Systems):
Explain meaning of `haiku' as a window system identifier.
(haiku-use-system-tooltips): Explain meaning of system
tooltips on
Haiku.
* doc/lispref/frames.texi (Multiple Terminals): Explain
meaning of haiku as a display type.
(Frame Layout): Clarify section for Haiku frames.
(Size Parameters): Explain limitations of fullwidth and
fullheight on Haiku.
(Management Parameters): Explain limitations of
inhibiting double buffering on builds with Cairo,
and the inability of frames with no-accept-focus to
receive keyboard input on Haiku.
(Font and Color Parameters): Explain the different font
backends available on Haiku.
(Raising and Lowering): Explain that lowering and
restacking frames doesn't work on Haiku.
(Child Frames): Explain oddities of child frame
visibility on Haiku.
* doc/lispref/os.texi (System Environment): Explain
meaning of haiku.
* etc/MACHINES: Add appropriate notices for Haiku.
* etc/NEWS: Document changes.
* etc/PROBLEMS: Document font spacing bug on Haiku.
* lib-src/Makefile.in: Build be-resources binary on
Haiku.
(CXX, CXXFLAGS, NON_CXX_FLAGS, ALL_CXXFLAGS)
(HAVE_BE_APP, HAIKU_LIBS, HAIKU_CFLAGS): New variables.
(DONT_INSTALL): Add be-resources binary if on Haiku.
(be-resources): New target.
* lib-src/be_resources: Add helper binary for setting
resources on the Emacs application.
* lib-src/emacsclient.c (decode_options): Set
alt_display to "be" on Haiku.
* lisp/cus-edit.el (custom-button, custom-button-mouse)
(custom-button-unraised, custom-button-pressed): Update
face definitions for Haiku.
* lisp/cus-start.el: Add haiku-debug-on-fatal-error and
haiku-use-system-tooltips.
* lisp/faces.el (face-valid-attribute-values): Clarify
attribute comment for Haiku.
(tool-bar): Add appropriate toolbar color for Haiku.
* lisp/frame.el (haiku-frame-geometry)
(haiku-mouse-absolute-pixel-position)
(haiku-set-mouse-absolute-pixel-position)
(haiku-frame-edges)
(haiku-frame-list-z-order): New function declarations.
(frame-geometry, frame-edges)
(mouse-absolute-pixel-position)
(set-mouse-absolute-pixel-position)
(frame-list-z-order): Call appropriate window system
functions on Haiku.
(display-mouse-p, display-graphic-p)
(display-images-p, display-pixel-height)
(display-pixel-width, display-mm-height)
(display-mm-width, display-backing-store)
(display-save-under, display-planes)
(display-color-cells, display-visual-class): Update type
tests for Haiku.
* lisp/international/mule-cmds.el
(set-coding-system-map): Also
prevent set-terminal-coding-system from appearing in the menu
bar on Haiku.
* lisp/loadup.el: Load Haiku-specific files when built
with Haiku, and don't rename newly built Emacs on Haiku as BFS
doesn't support hard links.
* lisp/menu-bar.el (menu-bar-open): Add for Haiku.
* lisp/mwheel.el (mouse-wheel-down-event): Expect
wheel-up on Haiku.
(mouse-wheel-up-event): Expect wheel-down on Haiku.
(mouse-wheel-left-event): Expect wheel-left on Haiku.
(mouse-wheel-right-event): Expect wheel-right on Haiku.
* lisp/net/browse-url.el
(browse-url--browser-defcustom-type):
Add option for WebPositive.
(browse-url-webpositive-program): New variable.
(browse-url-default-program): Search for WebPositive.
(browse-url-webpositive): New function.
* lisp/net/eww.el (eww-form-submit, eww-form-file)
(eww-form-checkbox, eww-form-select): Define faces
appropriately for Haiku.
* lisp/term/haiku-win.el: New file.
* lisp/tooltip.el (menu-or-popup-active-p): New function
declaration.
(tooltip-show-help): Don't use tooltips on Haiku when a
menu is active.
* lisp/version.el (haiku-get-version-string): New
function declaration.
(emacs-version): Add Haiku version string if
appropriate.
* src/Makefile.in: Also produce binary named "Emacs"
with Haiku resources set.
(CXX, HAIKU_OBJ, HAIKU_CXX_OBJ, HAIKU_LIBS)
(HAIKU_CFLAGS, HAVE_BE_APP, NON_CXX_FLAGS)
(ALL_CXX_FLAGS): New variables.
(.SUFFIXES): Add .cc.
(.cc.o): New target.
(base_obj): Add Haiku C objects.
(doc_obj, obj): Split objects that should scanned for
documentation into doc_obj.
(SOME_MACHINE_OBJECTS): Add appropriate Haiku C objects.
(all): Depend on Emacs and Emacs.pdmp on Haiku.
(LIBES): Add Haiku libraries.
(gl-stamp)
($(etc)/DOC): Scan doc_obj instead of obj
(temacs$(EXEEXT): Use C++ linker on Haiku.
(ctagsfiles3): New variable.
(TAGS): Scan C++ files.
* src/alloc.c (garbage_collect): Mark Haiku display.
* src/dispextern.h (HAVE_NATIVE_TRANSFORMS): Also enable
on Haiku.
(struct image): Add fields for Haiku transforms.
(RGB_PIXEL_COLOR): Define to unsigned long on Haiku as
well.
(sit_for): Also check USABLE_SIGPOLL.
(init_display_interactive): Set initial window system to
Haiku on Haiku builds.
* src/emacs.c (main): Define Haiku syms and init haiku
clipboard.
(shut_down_emacs): Quit BApplication on Haiku and
trigger debug
on aborts if haiku_debug_on_fatal_error.
(Vsystem_type): Update docstring.
* src/fileio.c (next-read-file-uses-dialog-p): Enable on
Haiku.
* src/filelock.c (WTMP_FILE): Only define if BOOT_TIME
is also defined.
* src/floatfns.c (double_integer_scale): Work around
Haiku libroot brain damage.
* src/font.c (syms_of_font): Define appropriate font
driver symbols for Haiku builds with various options.
* src/font.h: Also enable ftcrfont on Haiku builds with
Cairo.
(font_data_structures_may_be_ill_formed): Also enable on
Haiku builds that have Cairo.
* src/frame.c (Fframep): Update doc-string for Haiku
builds and return haiku if appropriate.
(syms_of_frame): New symbol `haiku'.
* src/frame.h (struct frame): Add output data for Haiku.
(FRAME_HAIKU_P): New macro.
(FRAME_WINDOW_P): Test for Haiku frames as well.
* src/ftcrfont.c (RED_FROM_ULONG, GREEN_FROM_ULONG)
(BLUE_FROM_ULONG): New macros.
(ftcrfont_draw): Add haiku specific code for Haiku
builds with Cairo.
* src/ftfont.c (ftfont_open): Set face.
(ftfont_has_char, ftfont_text_extents): Work around
crash.
(syms_of_ftfont): New symbol `mono'.
* src/ftfont.h (struct font_info): Enable Cairo-specific
fields for Cairo builds on Haiku.
* src/haiku_draw_support.cc:
* src/haiku_font_support.cc:
* src/haiku_io.c:
* src/haiku_select.cc:
* src/haiku_support.cc:
* src/haiku_support.h:
* src/haikufns.c:
* src/haikufont.c:
* src/haikugui.h:
* src/haikuimage.c:
* src/haikumenu.c:
* src/haikuselect.c:
* src/haikuselect.h:
* src/haikuterm.c:
* src/haikuterm.h: Add new files for Haiku windowing
support.
* src/haiku.c: Add new files for Haiku operating system
support.
* src/image.c: Implement image transforms and native XPM
support
on Haiku.
(GET_PIXEL, PUT_PIXEL, NO_PIXMAP)
(PIX_MASK_RETAIN, PIX_MASK_DRAW)
(RGB_TO_ULONG, RED_FROM_ULONG, GREEN_FROM_ULONG)
(BLUE_FROM_ULONG, RED16_FROM_ULONG, GREEN16_FROM_ULONG)
(BLUE16_FROM_ULONG): Define to appropriate values on
Haiku.
(image_create_bitmap_from_data): Add Haiku support.
(image_create_bitmap_from_file): Add TODO on Haiku.
(free_bitmap_record): Free bitmap on Haiku.
(image_size_in_bytes): Implement for Haiku bitmaps.
(image_set_transform): Implement on Haiku.
(image_create_x_image_and_pixmap_1): Implement on Haiku,
24-bit or 1-bit only.
(image_destroy_x_image, image_get_x_image): Use correct
img and pixmap values on Haiku.
(lookup_rgb_color): Use correct macro on Haiku.
(image_to_emacs_colors): Implement on Haiku.
(image_disable_image): Disable on Haiku.
(image_can_use_native_api): Test for translator presence
on Haiku.
(native_image_load): Use translator on Haiku.
(imagemagick_load_image): Add Haiku-specific quirks.
(Fimage_transforms_p): Allow rotate90 on Haiku.
(image_types): Enable native XPM support on Haiku.
(syms_of_image): Enable XPM images on Haiku.
* src/keyboard.c (kbd_buffer_get_event)
(handle_async_input, handle_input_available_signal)
(handle_user_signal, Fset_input_interrupt_mode)
(init_keyboard): Check for USABLE_SIGPOLL along with
USABLE_SIGIO.
* src/lisp.h (pD): Work around broken Haiku headers.
(HAVE_EXT_MENU_BAR): Define on Haiku.
(handle_input_available_signal): Enable if we just have
SIGPOLL as well.
* src/menu.c (have_boxes): Return true on Haiku.
(single_menu_item): Enable toolkit menus on Haiku.
(find_and_call_menu_selection): Also enable on Haiku.
* src/process.c (keyboard_bit_set): Enable with only
usable SIGPOLL.
(wait_reading_process_output): Test for SIGPOLL as well
as SIGIO availability.
* src/sound.c (sound_perror, vox_open)
(vox_configure, vox_close): Enable for usable SIGPOLL as
well.
* src/sysdep.c (sys_subshell): Enable for usable SIGPOLL.
(reset_sigio): Make conditional on F_SETOWN.
(request_sigio, unrequest_sigio)
(emacs_sigaction_init): Also handle SIGPOLLs.
(init_sys_modes): Disable TCXONC usage on Haiku, as it
doesn't have any ttys other than pseudo ttys, which don't
support C-s/C-q flow control, and causes compiler warnings.
(speeds): Disable high speeds if HAVE_TINY_SPEED_T.
* src/termhooks.h (enum output_method): Add output_haiku.
(struct terminal): Add Haiku display info.
(TERMINAL_FONT_CACHE): Enable for Haiku.
* src/terminal.c (Fterminal_live_p): Return `haiku' if
appropriate.
* src/verbose.mk.in (AM_V_CXX, AM_V_CXXLD): New logging
variables.
* src/xdisp.c (redisplay_internal)
(note_mouse_highlight): Return on Haiku if a popup is activated.
(display_menu_bar): Return on Haiku if frame is a Haiku
frame.
* src/xfaces.c (GCGraphicsExposures): Enable correctly on Haiku.
(x_create_gc): Enable dummy GC code on Haiku.
* src/xfns.c (x-server-version, x-file-dialog): Add
Haiku specifics to doc strings.
* src/xterm.c (syms_of_xterm): Add Haiku information to
doc string.
2021-11-20 21:30:08 +08:00
|
|
|
((executable-find browse-url-webpositive-program) 'browse-url-webpositive)
|
2007-10-29 13:56:39 +00:00
|
|
|
((executable-find browse-url-xterm-program) 'browse-url-text-xterm)
|
2022-07-07 13:43:53 +02:00
|
|
|
(t #'eww-browse-url))
|
2007-09-17 15:59:55 +00:00
|
|
|
url args))
|
2001-11-19 19:12:31 +00:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-default-browser 'browse-url-browser-kind
|
2022-07-07 13:43:53 +02:00
|
|
|
;; Well, most probably external if we ignore EWW.
|
2020-05-10 20:41:42 +02:00
|
|
|
'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2010-08-17 10:01:10 +02:00
|
|
|
(defun browse-url-can-use-xdg-open ()
|
2012-02-08 22:14:22 -05:00
|
|
|
"Return non-nil if the \"xdg-open\" program can be used.
|
2017-03-09 19:01:19 -08:00
|
|
|
xdg-open is a desktop utility that calls your preferred web browser."
|
|
|
|
;; The exact set of situations where xdg-open works is complicated,
|
|
|
|
;; and it would be a pain to duplicate xdg-open's situation-specific
|
|
|
|
;; code here, as the code is a moving target. So assume that
|
|
|
|
;; xdg-open will work if there is a graphical display; this should
|
|
|
|
;; be good enough for platforms Emacs is likely to be running on.
|
|
|
|
(and (or (getenv "DISPLAY") (getenv "WAYLAND_DISPLAY"))
|
|
|
|
(executable-find "xdg-open")))
|
2010-08-17 10:01:10 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
2021-03-08 10:11:22 -05:00
|
|
|
(defun browse-url-xdg-open (url &optional _ignored)
|
2012-02-08 22:14:22 -05:00
|
|
|
"Pass the specified URL to the \"xdg-open\" command.
|
|
|
|
xdg-open is a desktop utility that calls your preferred web browser.
|
|
|
|
The optional argument IGNORED is not used."
|
2010-08-17 10:01:10 +02:00
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
2011-06-22 18:44:53 +02:00
|
|
|
(call-process "xdg-open" nil 0 nil url))
|
2010-08-17 10:01:10 +02:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-xdg-open 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2001-11-19 19:12:31 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-mozilla (url &optional new-window)
|
|
|
|
"Ask the Mozilla WWW browser to load URL.
|
|
|
|
Default to the URL around or before point. The strings in variable
|
|
|
|
`browse-url-mozilla-arguments' are also passed to Mozilla.
|
|
|
|
|
|
|
|
When called interactively, if variable `browse-url-new-window-flag' is
|
|
|
|
non-nil, load the document in a new Mozilla window, otherwise use a
|
|
|
|
random existing one. A non-nil interactive prefix argument reverses
|
|
|
|
the effect of `browse-url-new-window-flag'.
|
|
|
|
|
2002-10-11 17:17:10 +00:00
|
|
|
If `browse-url-mozilla-new-window-is-tab' is non-nil, then whenever a
|
|
|
|
document would otherwise be loaded in a new window, it is loaded in a
|
|
|
|
new tab in an existing window instead.
|
|
|
|
|
2001-11-19 19:12:31 +00:00
|
|
|
When called non-interactively, optional second argument NEW-WINDOW is
|
|
|
|
used instead of `browse-url-new-window-flag'."
|
2022-07-10 12:15:48 +02:00
|
|
|
(declare (obsolete nil "29.1"))
|
2001-11-19 19:12:31 +00:00
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
2007-09-07 04:37:01 +00:00
|
|
|
(setq url (browse-url-encode-url url))
|
2001-11-19 19:12:31 +00:00
|
|
|
(let* ((process-environment (browse-url-process-environment))
|
2002-10-11 17:17:10 +00:00
|
|
|
(process
|
2021-03-08 10:11:22 -05:00
|
|
|
(apply #'start-process
|
2002-10-11 17:17:10 +00:00
|
|
|
(concat "mozilla " url) nil
|
|
|
|
browse-url-mozilla-program
|
|
|
|
(append
|
|
|
|
browse-url-mozilla-arguments
|
|
|
|
(list "-remote"
|
|
|
|
(concat "openURL("
|
|
|
|
url
|
|
|
|
(if (browse-url-maybe-new-window
|
|
|
|
new-window)
|
|
|
|
(if browse-url-mozilla-new-window-is-tab
|
2003-05-28 11:24:00 +00:00
|
|
|
",new-tab"
|
|
|
|
",new-window"))
|
2002-10-11 17:17:10 +00:00
|
|
|
")"))))))
|
2001-11-19 19:12:31 +00:00
|
|
|
(set-process-sentinel process
|
2021-05-18 19:05:29 -04:00
|
|
|
(lambda (process _change)
|
|
|
|
(browse-url-mozilla-sentinel process url)))))
|
2001-11-19 19:12:31 +00:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-mozilla 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2001-11-19 19:12:31 +00:00
|
|
|
(defun browse-url-mozilla-sentinel (process url)
|
|
|
|
"Handle a change to the process communicating with Mozilla."
|
2022-07-10 12:15:48 +02:00
|
|
|
(declare (obsolete nil "29.1"))
|
2001-11-19 19:12:31 +00:00
|
|
|
(or (eq (process-exit-status process) 0)
|
|
|
|
(let* ((process-environment (browse-url-process-environment)))
|
|
|
|
;; Mozilla is not running - start it
|
2004-04-27 14:03:10 +00:00
|
|
|
(message "Starting %s..." browse-url-mozilla-program)
|
2021-03-08 10:11:22 -05:00
|
|
|
(apply #'start-process (concat "mozilla " url) nil
|
2001-11-19 19:12:31 +00:00
|
|
|
browse-url-mozilla-program
|
|
|
|
(append browse-url-mozilla-startup-arguments (list url))))))
|
2005-06-18 10:36:11 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-firefox (url &optional new-window)
|
|
|
|
"Ask the Firefox WWW browser to load URL.
|
2015-02-24 18:02:11 -05:00
|
|
|
Defaults to the URL around or before point. Passes the strings
|
|
|
|
in the variable `browse-url-firefox-arguments' to Firefox.
|
2005-06-18 10:36:11 +00:00
|
|
|
|
2015-02-24 18:02:11 -05:00
|
|
|
Interactively, if the variable `browse-url-new-window-flag' is non-nil,
|
|
|
|
loads the document in a new Firefox window. A non-nil prefix argument
|
|
|
|
reverses the effect of `browse-url-new-window-flag'.
|
2005-06-18 10:36:11 +00:00
|
|
|
|
|
|
|
If `browse-url-firefox-new-window-is-tab' is non-nil, then
|
|
|
|
whenever a document would otherwise be loaded in a new window, it
|
|
|
|
is loaded in a new tab in an existing window instead.
|
|
|
|
|
2015-02-24 18:02:11 -05:00
|
|
|
Non-interactively, this uses the optional second argument NEW-WINDOW
|
2015-03-06 17:18:45 +01:00
|
|
|
instead of `browse-url-new-window-flag'."
|
2005-06-18 10:36:11 +00:00
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
2007-09-07 04:37:01 +00:00
|
|
|
(setq url (browse-url-encode-url url))
|
2015-02-24 18:02:11 -05:00
|
|
|
(let* ((process-environment (browse-url-process-environment)))
|
2021-03-08 10:11:22 -05:00
|
|
|
(apply #'start-process
|
2015-02-24 18:02:11 -05:00
|
|
|
(concat "firefox " url) nil
|
|
|
|
browse-url-firefox-program
|
|
|
|
(append
|
|
|
|
browse-url-firefox-arguments
|
2015-03-06 17:18:45 +01:00
|
|
|
(if (browse-url-maybe-new-window new-window)
|
|
|
|
(if browse-url-firefox-new-window-is-tab
|
|
|
|
'("-new-tab")
|
|
|
|
'("-new-window")))
|
2015-02-24 18:02:11 -05:00
|
|
|
(list url)))))
|
2001-11-19 19:12:31 +00:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-firefox 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2011-10-19 12:03:39 +03:00
|
|
|
;;;###autoload
|
2013-09-10 23:52:26 +02:00
|
|
|
(defun browse-url-chromium (url &optional _new-window)
|
2011-10-19 12:03:39 +03:00
|
|
|
"Ask the Chromium WWW browser to load URL.
|
|
|
|
Default to the URL around or before point. The strings in
|
|
|
|
variable `browse-url-chromium-arguments' are also passed to
|
2015-12-26 20:47:42 +02:00
|
|
|
Chromium.
|
|
|
|
The optional argument NEW-WINDOW is not used."
|
2011-10-19 12:03:39 +03:00
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
|
|
|
(setq url (browse-url-encode-url url))
|
|
|
|
(let* ((process-environment (browse-url-process-environment)))
|
2021-03-08 10:11:22 -05:00
|
|
|
(apply #'start-process
|
2011-10-19 12:03:39 +03:00
|
|
|
(concat "chromium " url) nil
|
|
|
|
browse-url-chromium-program
|
|
|
|
(append
|
|
|
|
browse-url-chromium-arguments
|
|
|
|
(list url)))))
|
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-chromium 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2016-01-24 14:37:38 -05:00
|
|
|
(defun browse-url-chrome (url &optional _new-window)
|
|
|
|
"Ask the Google Chrome WWW browser to load URL.
|
|
|
|
Default to the URL around or before point. The strings in
|
|
|
|
variable `browse-url-chrome-arguments' are also passed to
|
|
|
|
Google Chrome.
|
|
|
|
The optional argument NEW-WINDOW is not used."
|
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
|
|
|
(setq url (browse-url-encode-url url))
|
|
|
|
(let* ((process-environment (browse-url-process-environment)))
|
2021-03-08 10:11:22 -05:00
|
|
|
(apply #'start-process
|
2016-01-24 14:37:38 -05:00
|
|
|
(concat "google-chrome " url) nil
|
|
|
|
browse-url-chrome-program
|
|
|
|
(append
|
|
|
|
browse-url-chrome-arguments
|
|
|
|
(list url)))))
|
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-chrome 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2003-07-07 20:54:56 +00:00
|
|
|
(defun browse-url-epiphany (url &optional new-window)
|
2021-12-07 18:57:48 +01:00
|
|
|
"Ask the GNOME Web (Epiphany) WWW browser to load URL.
|
2003-07-07 20:54:56 +00:00
|
|
|
Default to the URL around or before point. The strings in variable
|
2021-12-07 18:57:48 +01:00
|
|
|
`browse-url-epiphany-arguments' are also passed to GNOME Web.
|
2003-07-07 20:54:56 +00:00
|
|
|
|
|
|
|
When called interactively, if variable `browse-url-new-window-flag' is
|
2021-12-07 18:57:48 +01:00
|
|
|
non-nil, load the document in a new GNOME Web window, otherwise use a
|
2003-07-07 20:54:56 +00:00
|
|
|
random existing one. A non-nil interactive prefix argument reverses
|
|
|
|
the effect of `browse-url-new-window-flag'.
|
|
|
|
|
2003-08-01 00:32:34 +00:00
|
|
|
If `browse-url-epiphany-new-window-is-tab' is non-nil, then whenever a
|
2003-07-07 20:54:56 +00:00
|
|
|
document would otherwise be loaded in a new window, it is loaded in a
|
|
|
|
new tab in an existing window instead.
|
|
|
|
|
|
|
|
When called non-interactively, optional second argument NEW-WINDOW is
|
|
|
|
used instead of `browse-url-new-window-flag'."
|
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
2007-09-07 04:37:01 +00:00
|
|
|
(setq url (browse-url-encode-url url))
|
2003-07-07 20:54:56 +00:00
|
|
|
(let* ((process-environment (browse-url-process-environment))
|
2021-03-08 10:11:22 -05:00
|
|
|
(process (apply #'start-process
|
2003-07-07 20:54:56 +00:00
|
|
|
(concat "epiphany " url)
|
|
|
|
nil
|
|
|
|
browse-url-epiphany-program
|
|
|
|
(append
|
|
|
|
browse-url-epiphany-arguments
|
|
|
|
(if (browse-url-maybe-new-window new-window)
|
|
|
|
(if browse-url-epiphany-new-window-is-tab
|
|
|
|
'("--new-tab")
|
|
|
|
'("--new-window" "--noraise"))
|
|
|
|
'("--existing"))
|
|
|
|
(list url)))))
|
|
|
|
(set-process-sentinel process
|
2021-05-18 19:05:29 -04:00
|
|
|
(lambda (process _change)
|
|
|
|
(browse-url-epiphany-sentinel process url)))))
|
2003-07-07 20:54:56 +00:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-epiphany 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2003-07-07 20:54:56 +00:00
|
|
|
(defun browse-url-epiphany-sentinel (process url)
|
2021-12-07 18:57:48 +01:00
|
|
|
"Handle a change to the process communicating with GNOME Web (Epiphany)."
|
2003-07-07 20:54:56 +00:00
|
|
|
(or (eq (process-exit-status process) 0)
|
|
|
|
(let* ((process-environment (browse-url-process-environment)))
|
2021-12-07 18:57:48 +01:00
|
|
|
;; GNOME Web is not running - start it
|
2004-04-27 14:03:10 +00:00
|
|
|
(message "Starting %s..." browse-url-epiphany-program)
|
2021-03-08 10:11:22 -05:00
|
|
|
(apply #'start-process (concat "epiphany " url) nil
|
2003-07-07 20:54:56 +00:00
|
|
|
browse-url-epiphany-program
|
|
|
|
(append browse-url-epiphany-startup-arguments (list url))))))
|
|
|
|
|
2007-10-26 22:24:14 +00:00
|
|
|
(defvar url-handler-regexp)
|
|
|
|
|
Add support for the Haiku operating system and its window system
* .gitignore: Add binaries specific to Haiku.
* Makefie.in (HAVE_BE_APP): New variable.
(install-arch-dep): Install Emacs and Emacs.pdmp when
using Haiku.
* configure.ac: Detect and configure for Haiku and
various related configurations.
(be-app, be-freetype, be-cairo): New options.
(HAVE_BE_APP, HAIKU_OBJ, HAIKU_CXX_OBJ)
(HAIKU_LIBS, HAIKU_CFLAGS): New variables.
(HAIKU, HAVE_TINY_SPEED_T): New define.
(emacs_config_features): Add BE_APP.
* doc/emacs/Makefile.in (EMACSSOURCES): Add Haiku
appendix.
* doc/emacs/emacs.texi: Add Haiku appendix to menus and
include it.
* doc/emacs/haiku.texi: New Haiku appendix.
* doc/lispref/display.texi (Defining Faces, Window Systems):
Explain meaning of `haiku' as a window system identifier.
(haiku-use-system-tooltips): Explain meaning of system
tooltips on
Haiku.
* doc/lispref/frames.texi (Multiple Terminals): Explain
meaning of haiku as a display type.
(Frame Layout): Clarify section for Haiku frames.
(Size Parameters): Explain limitations of fullwidth and
fullheight on Haiku.
(Management Parameters): Explain limitations of
inhibiting double buffering on builds with Cairo,
and the inability of frames with no-accept-focus to
receive keyboard input on Haiku.
(Font and Color Parameters): Explain the different font
backends available on Haiku.
(Raising and Lowering): Explain that lowering and
restacking frames doesn't work on Haiku.
(Child Frames): Explain oddities of child frame
visibility on Haiku.
* doc/lispref/os.texi (System Environment): Explain
meaning of haiku.
* etc/MACHINES: Add appropriate notices for Haiku.
* etc/NEWS: Document changes.
* etc/PROBLEMS: Document font spacing bug on Haiku.
* lib-src/Makefile.in: Build be-resources binary on
Haiku.
(CXX, CXXFLAGS, NON_CXX_FLAGS, ALL_CXXFLAGS)
(HAVE_BE_APP, HAIKU_LIBS, HAIKU_CFLAGS): New variables.
(DONT_INSTALL): Add be-resources binary if on Haiku.
(be-resources): New target.
* lib-src/be_resources: Add helper binary for setting
resources on the Emacs application.
* lib-src/emacsclient.c (decode_options): Set
alt_display to "be" on Haiku.
* lisp/cus-edit.el (custom-button, custom-button-mouse)
(custom-button-unraised, custom-button-pressed): Update
face definitions for Haiku.
* lisp/cus-start.el: Add haiku-debug-on-fatal-error and
haiku-use-system-tooltips.
* lisp/faces.el (face-valid-attribute-values): Clarify
attribute comment for Haiku.
(tool-bar): Add appropriate toolbar color for Haiku.
* lisp/frame.el (haiku-frame-geometry)
(haiku-mouse-absolute-pixel-position)
(haiku-set-mouse-absolute-pixel-position)
(haiku-frame-edges)
(haiku-frame-list-z-order): New function declarations.
(frame-geometry, frame-edges)
(mouse-absolute-pixel-position)
(set-mouse-absolute-pixel-position)
(frame-list-z-order): Call appropriate window system
functions on Haiku.
(display-mouse-p, display-graphic-p)
(display-images-p, display-pixel-height)
(display-pixel-width, display-mm-height)
(display-mm-width, display-backing-store)
(display-save-under, display-planes)
(display-color-cells, display-visual-class): Update type
tests for Haiku.
* lisp/international/mule-cmds.el
(set-coding-system-map): Also
prevent set-terminal-coding-system from appearing in the menu
bar on Haiku.
* lisp/loadup.el: Load Haiku-specific files when built
with Haiku, and don't rename newly built Emacs on Haiku as BFS
doesn't support hard links.
* lisp/menu-bar.el (menu-bar-open): Add for Haiku.
* lisp/mwheel.el (mouse-wheel-down-event): Expect
wheel-up on Haiku.
(mouse-wheel-up-event): Expect wheel-down on Haiku.
(mouse-wheel-left-event): Expect wheel-left on Haiku.
(mouse-wheel-right-event): Expect wheel-right on Haiku.
* lisp/net/browse-url.el
(browse-url--browser-defcustom-type):
Add option for WebPositive.
(browse-url-webpositive-program): New variable.
(browse-url-default-program): Search for WebPositive.
(browse-url-webpositive): New function.
* lisp/net/eww.el (eww-form-submit, eww-form-file)
(eww-form-checkbox, eww-form-select): Define faces
appropriately for Haiku.
* lisp/term/haiku-win.el: New file.
* lisp/tooltip.el (menu-or-popup-active-p): New function
declaration.
(tooltip-show-help): Don't use tooltips on Haiku when a
menu is active.
* lisp/version.el (haiku-get-version-string): New
function declaration.
(emacs-version): Add Haiku version string if
appropriate.
* src/Makefile.in: Also produce binary named "Emacs"
with Haiku resources set.
(CXX, HAIKU_OBJ, HAIKU_CXX_OBJ, HAIKU_LIBS)
(HAIKU_CFLAGS, HAVE_BE_APP, NON_CXX_FLAGS)
(ALL_CXX_FLAGS): New variables.
(.SUFFIXES): Add .cc.
(.cc.o): New target.
(base_obj): Add Haiku C objects.
(doc_obj, obj): Split objects that should scanned for
documentation into doc_obj.
(SOME_MACHINE_OBJECTS): Add appropriate Haiku C objects.
(all): Depend on Emacs and Emacs.pdmp on Haiku.
(LIBES): Add Haiku libraries.
(gl-stamp)
($(etc)/DOC): Scan doc_obj instead of obj
(temacs$(EXEEXT): Use C++ linker on Haiku.
(ctagsfiles3): New variable.
(TAGS): Scan C++ files.
* src/alloc.c (garbage_collect): Mark Haiku display.
* src/dispextern.h (HAVE_NATIVE_TRANSFORMS): Also enable
on Haiku.
(struct image): Add fields for Haiku transforms.
(RGB_PIXEL_COLOR): Define to unsigned long on Haiku as
well.
(sit_for): Also check USABLE_SIGPOLL.
(init_display_interactive): Set initial window system to
Haiku on Haiku builds.
* src/emacs.c (main): Define Haiku syms and init haiku
clipboard.
(shut_down_emacs): Quit BApplication on Haiku and
trigger debug
on aborts if haiku_debug_on_fatal_error.
(Vsystem_type): Update docstring.
* src/fileio.c (next-read-file-uses-dialog-p): Enable on
Haiku.
* src/filelock.c (WTMP_FILE): Only define if BOOT_TIME
is also defined.
* src/floatfns.c (double_integer_scale): Work around
Haiku libroot brain damage.
* src/font.c (syms_of_font): Define appropriate font
driver symbols for Haiku builds with various options.
* src/font.h: Also enable ftcrfont on Haiku builds with
Cairo.
(font_data_structures_may_be_ill_formed): Also enable on
Haiku builds that have Cairo.
* src/frame.c (Fframep): Update doc-string for Haiku
builds and return haiku if appropriate.
(syms_of_frame): New symbol `haiku'.
* src/frame.h (struct frame): Add output data for Haiku.
(FRAME_HAIKU_P): New macro.
(FRAME_WINDOW_P): Test for Haiku frames as well.
* src/ftcrfont.c (RED_FROM_ULONG, GREEN_FROM_ULONG)
(BLUE_FROM_ULONG): New macros.
(ftcrfont_draw): Add haiku specific code for Haiku
builds with Cairo.
* src/ftfont.c (ftfont_open): Set face.
(ftfont_has_char, ftfont_text_extents): Work around
crash.
(syms_of_ftfont): New symbol `mono'.
* src/ftfont.h (struct font_info): Enable Cairo-specific
fields for Cairo builds on Haiku.
* src/haiku_draw_support.cc:
* src/haiku_font_support.cc:
* src/haiku_io.c:
* src/haiku_select.cc:
* src/haiku_support.cc:
* src/haiku_support.h:
* src/haikufns.c:
* src/haikufont.c:
* src/haikugui.h:
* src/haikuimage.c:
* src/haikumenu.c:
* src/haikuselect.c:
* src/haikuselect.h:
* src/haikuterm.c:
* src/haikuterm.h: Add new files for Haiku windowing
support.
* src/haiku.c: Add new files for Haiku operating system
support.
* src/image.c: Implement image transforms and native XPM
support
on Haiku.
(GET_PIXEL, PUT_PIXEL, NO_PIXMAP)
(PIX_MASK_RETAIN, PIX_MASK_DRAW)
(RGB_TO_ULONG, RED_FROM_ULONG, GREEN_FROM_ULONG)
(BLUE_FROM_ULONG, RED16_FROM_ULONG, GREEN16_FROM_ULONG)
(BLUE16_FROM_ULONG): Define to appropriate values on
Haiku.
(image_create_bitmap_from_data): Add Haiku support.
(image_create_bitmap_from_file): Add TODO on Haiku.
(free_bitmap_record): Free bitmap on Haiku.
(image_size_in_bytes): Implement for Haiku bitmaps.
(image_set_transform): Implement on Haiku.
(image_create_x_image_and_pixmap_1): Implement on Haiku,
24-bit or 1-bit only.
(image_destroy_x_image, image_get_x_image): Use correct
img and pixmap values on Haiku.
(lookup_rgb_color): Use correct macro on Haiku.
(image_to_emacs_colors): Implement on Haiku.
(image_disable_image): Disable on Haiku.
(image_can_use_native_api): Test for translator presence
on Haiku.
(native_image_load): Use translator on Haiku.
(imagemagick_load_image): Add Haiku-specific quirks.
(Fimage_transforms_p): Allow rotate90 on Haiku.
(image_types): Enable native XPM support on Haiku.
(syms_of_image): Enable XPM images on Haiku.
* src/keyboard.c (kbd_buffer_get_event)
(handle_async_input, handle_input_available_signal)
(handle_user_signal, Fset_input_interrupt_mode)
(init_keyboard): Check for USABLE_SIGPOLL along with
USABLE_SIGIO.
* src/lisp.h (pD): Work around broken Haiku headers.
(HAVE_EXT_MENU_BAR): Define on Haiku.
(handle_input_available_signal): Enable if we just have
SIGPOLL as well.
* src/menu.c (have_boxes): Return true on Haiku.
(single_menu_item): Enable toolkit menus on Haiku.
(find_and_call_menu_selection): Also enable on Haiku.
* src/process.c (keyboard_bit_set): Enable with only
usable SIGPOLL.
(wait_reading_process_output): Test for SIGPOLL as well
as SIGIO availability.
* src/sound.c (sound_perror, vox_open)
(vox_configure, vox_close): Enable for usable SIGPOLL as
well.
* src/sysdep.c (sys_subshell): Enable for usable SIGPOLL.
(reset_sigio): Make conditional on F_SETOWN.
(request_sigio, unrequest_sigio)
(emacs_sigaction_init): Also handle SIGPOLLs.
(init_sys_modes): Disable TCXONC usage on Haiku, as it
doesn't have any ttys other than pseudo ttys, which don't
support C-s/C-q flow control, and causes compiler warnings.
(speeds): Disable high speeds if HAVE_TINY_SPEED_T.
* src/termhooks.h (enum output_method): Add output_haiku.
(struct terminal): Add Haiku display info.
(TERMINAL_FONT_CACHE): Enable for Haiku.
* src/terminal.c (Fterminal_live_p): Return `haiku' if
appropriate.
* src/verbose.mk.in (AM_V_CXX, AM_V_CXXLD): New logging
variables.
* src/xdisp.c (redisplay_internal)
(note_mouse_highlight): Return on Haiku if a popup is activated.
(display_menu_bar): Return on Haiku if frame is a Haiku
frame.
* src/xfaces.c (GCGraphicsExposures): Enable correctly on Haiku.
(x_create_gc): Enable dummy GC code on Haiku.
* src/xfns.c (x-server-version, x-file-dialog): Add
Haiku specifics to doc strings.
* src/xterm.c (syms_of_xterm): Add Haiku information to
doc string.
2021-11-20 21:30:08 +08:00
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-webpositive (url &optional _new-window)
|
|
|
|
"Ask the WebPositive WWW browser to load URL.
|
|
|
|
Default to the URL around or before point.
|
|
|
|
The optional argument NEW-WINDOW is not used."
|
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
|
|
|
(setq url (browse-url-encode-url url))
|
|
|
|
(let* ((process-environment (browse-url-process-environment)))
|
|
|
|
(start-process (concat "WebPositive " url) nil "WebPositive" url)))
|
|
|
|
|
|
|
|
(function-put 'browse-url-webpositive 'browse-url-browser-kind 'external)
|
|
|
|
|
2022-05-09 07:54:54 +00:00
|
|
|
(declare-function haiku-roster-launch "haikuselect.c")
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-default-haiku-browser (url &optional _new-window)
|
|
|
|
"Browse URL with the system default browser.
|
|
|
|
Default to the URL around or before point."
|
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
|
|
|
(setq url (browse-url-encode-url url))
|
|
|
|
(let* ((scheme (save-match-data
|
|
|
|
(if (string-match "\\(.+\\):/" url)
|
|
|
|
(match-string 1 url)
|
2023-10-25 12:49:19 +02:00
|
|
|
browse-url-default-scheme)))
|
2022-05-09 07:54:54 +00:00
|
|
|
(mime (concat "application/x-vnd.Be.URL." scheme)))
|
|
|
|
(haiku-roster-launch mime (vector url))))
|
|
|
|
|
|
|
|
(function-put 'browse-url-default-haiku-browser
|
|
|
|
'browse-url-browser-kind 'external)
|
|
|
|
|
2023-07-10 13:31:57 +08:00
|
|
|
(defcustom browse-url-android-share nil
|
|
|
|
"If non-nil, share URLs instead of opening them.
|
|
|
|
When non-nil, `browse-url-default-android-browser' will try to
|
|
|
|
share the URL being browsed through programs such as mail clients
|
|
|
|
and instant messengers instead of opening it in a web browser."
|
|
|
|
:type 'boolean
|
|
|
|
:version "30.1")
|
|
|
|
|
2024-02-15 14:23:43 +08:00
|
|
|
(declare-function android-browse-url "../term/android-win")
|
2023-01-24 17:31:16 +08:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-default-android-browser (url &optional _new-window)
|
|
|
|
"Browse URL with the system default browser.
|
2023-07-10 13:31:57 +08:00
|
|
|
If `browse-url-android-share' is non-nil, try to share URL using
|
|
|
|
an external program instead. Default to the URL around or before
|
|
|
|
point."
|
2023-01-24 17:31:16 +08:00
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
2023-07-10 13:31:57 +08:00
|
|
|
(unless browse-url-android-share
|
|
|
|
;; The URL shouldn't be encoded if it's being shared through
|
|
|
|
;; another program.
|
|
|
|
(setq url (browse-url-encode-url url)))
|
2023-01-24 17:31:16 +08:00
|
|
|
;; Make sure the URL starts with an appropriate scheme.
|
|
|
|
(unless (string-match "\\(.+\\):/" url)
|
2023-11-01 01:39:27 +01:00
|
|
|
(setq url (concat browse-url-default-scheme "://" url)))
|
2023-07-10 13:31:57 +08:00
|
|
|
(android-browse-url url browse-url-android-share))
|
2023-01-24 17:31:16 +08:00
|
|
|
|
|
|
|
(function-put 'browse-url-default-android-browser
|
|
|
|
'browse-url-browser-kind 'external)
|
|
|
|
|
2007-08-22 18:52:59 +00:00
|
|
|
;;;###autoload
|
2018-03-01 22:22:05 +01:00
|
|
|
(defun browse-url-emacs (url &optional same-window)
|
2018-03-19 11:17:20 +02:00
|
|
|
"Ask Emacs to load URL into a buffer and show it in another window.
|
|
|
|
Optional argument SAME-WINDOW non-nil means show the URL in the
|
|
|
|
currently selected window instead."
|
2007-08-22 18:52:59 +00:00
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
|
|
|
(require 'url-handlers)
|
2020-10-17 11:24:03 +02:00
|
|
|
(let ((parsed (url-generic-parse-url url))
|
|
|
|
(func (if same-window 'find-file 'find-file-other-window)))
|
2022-03-07 03:27:55 +01:00
|
|
|
(if (equal (url-type parsed) "file")
|
|
|
|
;; It's a file; just open it.
|
|
|
|
(let ((file (url-unhex-string (url-filename parsed))))
|
|
|
|
(when-let ((coding (browse-url--file-name-coding-system)))
|
|
|
|
(setq file (decode-coding-string file 'utf-8)))
|
2022-10-13 09:52:44 +02:00
|
|
|
;; The local-part of file: URLs on Windows is supposed to
|
|
|
|
;; start with an extra slash.
|
|
|
|
(when (eq system-type 'windows-nt)
|
|
|
|
(setq file (replace-regexp-in-string
|
|
|
|
"\\`/\\([a-z]:\\)" "\\1" file)))
|
2022-03-07 03:27:55 +01:00
|
|
|
(funcall func file))
|
2020-10-17 11:24:03 +02:00
|
|
|
(let ((file-name-handler-alist
|
|
|
|
(cons (cons url-handler-regexp 'url-file-handler)
|
|
|
|
file-name-handler-alist)))
|
|
|
|
(funcall func url)))))
|
2007-08-22 18:52:59 +00:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-emacs 'browse-url-browser-kind 'internal)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2000-10-07 18:05:28 +00:00
|
|
|
;;;###autoload
|
2000-10-07 17:58:33 +00:00
|
|
|
(defun browse-url-gnome-moz (url &optional new-window)
|
2021-12-07 18:27:41 +01:00
|
|
|
"Ask Mozilla to load URL via the GNOME program `gnome-moz-remote'.
|
2000-10-07 17:58:33 +00:00
|
|
|
Default to the URL around or before point. The strings in variable
|
|
|
|
`browse-url-gnome-moz-arguments' are also passed.
|
|
|
|
|
2001-04-18 12:48:36 +00:00
|
|
|
When called interactively, if variable `browse-url-new-window-flag' is
|
2000-10-07 17:58:33 +00:00
|
|
|
non-nil, load the document in a new browser window, otherwise use an
|
|
|
|
existing one. A non-nil interactive prefix argument reverses the
|
2001-04-18 12:48:36 +00:00
|
|
|
effect of `browse-url-new-window-flag'.
|
2000-10-07 17:58:33 +00:00
|
|
|
|
|
|
|
When called non-interactively, optional second argument NEW-WINDOW is
|
2001-04-18 12:48:36 +00:00
|
|
|
used instead of `browse-url-new-window-flag'."
|
browse-url: mark some of the more obsolete stuff as such
* lisp/net/browse-url.el (browse-url-browser-function)
(browse-url-default-browser):
Remove obsolete items from the explicit listing.
(browse-url-new-window-flag, browse-url-of-file-hook): Doc fixes.
(browse-url-netscape-program, browse-url-netscape-arguments)
(browse-url-netscape-startup-arguments)
(browse-url-galeon-program, browse-url-galeon-arguments)
(browse-url-galeon-startup-arguments)
(browse-url-gnome-moz-program, browse-url-gnome-moz-arguments)
(browse-url-galeon-new-window-is-tab)
(browse-url-netscape-new-window-is-tab)
(browse-url-mosaic-program, browse-url-mosaic-arguments)
(browse-url-mosaic-pidfile, browse-url-CCI-port)
(browse-url-CCI-host, browse-url-netscape-version)
(browse-url-netscape, browse-url-netscape-sentinel)
(browse-url-netscape-reload, browse-url-netscape-send)
(browse-url-galeon, browse-url-galeon-sentinel)
(browse-url-gnome-moz, browse-url-mosaic, browse-url-cci)
(browse-url-w3-gnudoit): Make obsolete.
* etc/NEWS: Mention this.
* doc/misc/idlwave.texi (HTML Help Browser Tips): Remove obsolete info.
* lisp/ffap.el (ffap-url-fetcher): Simplify default and doc.
* lisp/x-dnd.el: Comment update.
2015-03-24 23:26:48 -07:00
|
|
|
(declare (obsolete nil "25.1"))
|
2003-01-31 15:24:20 +00:00
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
2021-03-08 10:11:22 -05:00
|
|
|
(apply #'start-process (concat "gnome-moz-remote " url)
|
2000-10-07 17:58:33 +00:00
|
|
|
nil
|
2003-04-12 22:21:18 +00:00
|
|
|
browse-url-gnome-moz-program
|
2000-10-07 17:58:33 +00:00
|
|
|
(append
|
|
|
|
browse-url-gnome-moz-arguments
|
|
|
|
(if (browse-url-maybe-new-window new-window)
|
2007-09-17 15:59:55 +00:00
|
|
|
'("--newwin"))
|
2000-10-07 17:58:33 +00:00
|
|
|
(list "--raise" url))))
|
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-gnome-moz 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2015-03-17 05:27:23 +05:30
|
|
|
;; --- Conkeror ---
|
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-conkeror (url &optional new-window)
|
|
|
|
"Ask the Conkeror WWW browser to load URL.
|
2015-03-17 17:09:34 -07:00
|
|
|
Default to the URL around or before point. Also pass the strings
|
|
|
|
in the variable `browse-url-conkeror-arguments' to Conkeror.
|
2015-03-17 05:27:23 +05:30
|
|
|
|
2015-03-17 17:09:34 -07:00
|
|
|
When called interactively, if variable
|
|
|
|
`browse-url-new-window-flag' is non-nil, load the document in a
|
|
|
|
new Conkeror window, otherwise use a random existing one. A
|
|
|
|
non-nil interactive prefix argument reverses the effect of
|
|
|
|
`browse-url-new-window-flag'.
|
2015-03-17 05:27:23 +05:30
|
|
|
|
2015-03-17 17:09:34 -07:00
|
|
|
If variable `browse-url-conkeror-new-window-is-buffer' is
|
|
|
|
non-nil, then whenever a document would otherwise be loaded in a
|
|
|
|
new window, load it in a new buffer in an existing window instead.
|
2015-03-17 05:27:23 +05:30
|
|
|
|
2015-03-17 17:09:34 -07:00
|
|
|
When called non-interactively, use optional second argument
|
|
|
|
NEW-WINDOW instead of `browse-url-new-window-flag'."
|
2020-05-24 18:48:16 +02:00
|
|
|
(declare (obsolete nil "28.1"))
|
2015-03-17 05:27:23 +05:30
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
|
|
|
(setq url (browse-url-encode-url url))
|
|
|
|
(let* ((process-environment (browse-url-process-environment)))
|
2021-03-08 10:11:22 -05:00
|
|
|
(apply #'start-process (format "conkeror %s" url)
|
2015-03-17 05:27:23 +05:30
|
|
|
nil
|
|
|
|
browse-url-conkeror-program
|
|
|
|
(append
|
|
|
|
browse-url-conkeror-arguments
|
|
|
|
(list
|
|
|
|
"-e"
|
|
|
|
(format "load_url_in_new_%s('%s')"
|
|
|
|
(if (browse-url-maybe-new-window new-window)
|
|
|
|
(if browse-url-conkeror-new-window-is-buffer
|
|
|
|
"buffer"
|
|
|
|
"window")
|
|
|
|
"buffer")
|
|
|
|
url))))))
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-conkeror 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;; --- W3 ---
|
|
|
|
|
2007-11-29 04:26:50 +00:00
|
|
|
;; External.
|
|
|
|
(declare-function w3-fetch-other-window "ext:w3m" (&optional url))
|
|
|
|
(declare-function w3-fetch "ext:w3m" (&optional url target))
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-w3 (url &optional new-window)
|
|
|
|
"Ask the w3 WWW browser to load URL.
|
|
|
|
Default to the URL around or before point.
|
|
|
|
|
2001-04-18 12:48:36 +00:00
|
|
|
When called interactively, if variable `browse-url-new-window-flag' is
|
2000-03-20 13:12:14 +00:00
|
|
|
non-nil, load the document in a new window. A non-nil interactive
|
2001-04-18 12:48:36 +00:00
|
|
|
prefix argument reverses the effect of `browse-url-new-window-flag'.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
When called non-interactively, optional second argument NEW-WINDOW is
|
2001-04-18 12:48:36 +00:00
|
|
|
used instead of `browse-url-new-window-flag'."
|
2022-07-07 13:25:23 +02:00
|
|
|
(declare (obsolete nil "29.1"))
|
2000-03-20 13:12:14 +00:00
|
|
|
(interactive (browse-url-interactive-arg "W3 URL: "))
|
2007-09-17 15:59:55 +00:00
|
|
|
(require 'w3) ; w3-fetch-other-window not autoloaded
|
2000-03-22 23:06:18 +00:00
|
|
|
(if (browse-url-maybe-new-window new-window)
|
2000-03-20 13:12:14 +00:00
|
|
|
(w3-fetch-other-window url)
|
|
|
|
(w3-fetch url)))
|
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-w3 'browse-url-browser-kind 'internal)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;###autoload
|
2013-09-10 23:52:26 +02:00
|
|
|
(defun browse-url-w3-gnudoit (url &optional _new-window)
|
2023-09-02 02:42:07 +02:00
|
|
|
"Ask another Emacs running emacsclient to load the URL using the W3 browser.
|
2000-03-20 13:12:14 +00:00
|
|
|
The `browse-url-gnudoit-program' program is used with options given by
|
|
|
|
`browse-url-gnudoit-args'. Default to the URL around or before point."
|
browse-url: mark some of the more obsolete stuff as such
* lisp/net/browse-url.el (browse-url-browser-function)
(browse-url-default-browser):
Remove obsolete items from the explicit listing.
(browse-url-new-window-flag, browse-url-of-file-hook): Doc fixes.
(browse-url-netscape-program, browse-url-netscape-arguments)
(browse-url-netscape-startup-arguments)
(browse-url-galeon-program, browse-url-galeon-arguments)
(browse-url-galeon-startup-arguments)
(browse-url-gnome-moz-program, browse-url-gnome-moz-arguments)
(browse-url-galeon-new-window-is-tab)
(browse-url-netscape-new-window-is-tab)
(browse-url-mosaic-program, browse-url-mosaic-arguments)
(browse-url-mosaic-pidfile, browse-url-CCI-port)
(browse-url-CCI-host, browse-url-netscape-version)
(browse-url-netscape, browse-url-netscape-sentinel)
(browse-url-netscape-reload, browse-url-netscape-send)
(browse-url-galeon, browse-url-galeon-sentinel)
(browse-url-gnome-moz, browse-url-mosaic, browse-url-cci)
(browse-url-w3-gnudoit): Make obsolete.
* etc/NEWS: Mention this.
* doc/misc/idlwave.texi (HTML Help Browser Tips): Remove obsolete info.
* lisp/ffap.el (ffap-url-fetcher): Simplify default and doc.
* lisp/x-dnd.el: Comment update.
2015-03-24 23:26:48 -07:00
|
|
|
(declare (obsolete nil "25.1"))
|
2000-03-20 13:12:14 +00:00
|
|
|
(interactive (browse-url-interactive-arg "W3 URL: "))
|
2021-03-08 10:11:22 -05:00
|
|
|
(apply #'start-process (concat "gnudoit:" url) nil
|
2007-09-17 15:59:55 +00:00
|
|
|
browse-url-gnudoit-program
|
|
|
|
(append browse-url-gnudoit-args
|
|
|
|
(list (concat "(w3-fetch \"" url "\")")
|
|
|
|
"(raise-frame)"))))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-w3-gnudoit 'browse-url-browser-kind 'internal)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;; --- Lynx in an xterm ---
|
|
|
|
|
|
|
|
;;;###autoload
|
2013-09-10 23:52:26 +02:00
|
|
|
(defun browse-url-text-xterm (url &optional _new-window)
|
2000-03-20 13:12:14 +00:00
|
|
|
;; new-window ignored
|
2007-10-29 13:56:39 +00:00
|
|
|
"Ask a text browser to load URL.
|
2008-07-08 14:45:36 +00:00
|
|
|
URL defaults to the URL around or before point.
|
2007-10-29 13:56:39 +00:00
|
|
|
This runs the text browser specified by `browse-url-text-browser'.
|
2000-03-20 13:12:14 +00:00
|
|
|
in an Xterm window using the Xterm program named by `browse-url-xterm-program'
|
2015-12-26 20:47:42 +02:00
|
|
|
with possible additional arguments `browse-url-xterm-args'.
|
|
|
|
The optional argument NEW-WINDOW is not used."
|
2007-10-29 13:56:39 +00:00
|
|
|
(interactive (browse-url-interactive-arg "Text browser URL: "))
|
|
|
|
(apply #'start-process `(,(concat browse-url-text-browser url)
|
|
|
|
nil ,browse-url-xterm-program
|
2008-03-13 13:29:11 +00:00
|
|
|
,@browse-url-xterm-args "-e" ,browse-url-text-browser
|
2007-09-17 15:59:55 +00:00
|
|
|
,url)))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-text-xterm 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;; --- Lynx in an Emacs "term" window ---
|
|
|
|
|
2010-10-08 17:52:12 -07:00
|
|
|
(declare-function term-char-mode "term" ())
|
|
|
|
(declare-function term-send-down "term" ())
|
|
|
|
(declare-function term-send-string "term" (proc str))
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;###autoload
|
2007-10-29 13:56:39 +00:00
|
|
|
(defun browse-url-text-emacs (url &optional new-buffer)
|
|
|
|
"Ask a text browser to load URL.
|
2008-07-08 14:45:36 +00:00
|
|
|
URL defaults to the URL around or before point.
|
2007-10-29 13:56:39 +00:00
|
|
|
This runs the text browser specified by `browse-url-text-browser'.
|
|
|
|
With a prefix argument, it runs a new browser process in a new buffer.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2001-04-18 12:48:36 +00:00
|
|
|
When called interactively, if variable `browse-url-new-window-flag' is
|
2007-10-29 13:56:39 +00:00
|
|
|
non-nil, load the document in a new browser process in a new term window,
|
2000-03-20 13:12:14 +00:00
|
|
|
otherwise use any existing one. A non-nil interactive prefix argument
|
2001-04-18 12:48:36 +00:00
|
|
|
reverses the effect of `browse-url-new-window-flag'.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
When called non-interactively, optional second argument NEW-WINDOW is
|
2001-04-18 12:48:36 +00:00
|
|
|
used instead of `browse-url-new-window-flag'."
|
2007-10-29 13:56:39 +00:00
|
|
|
(interactive (browse-url-interactive-arg "Text browser URL: "))
|
2007-09-17 15:59:55 +00:00
|
|
|
(let* ((system-uses-terminfo t) ; Lynx uses terminfo
|
2000-03-20 13:12:14 +00:00
|
|
|
;; (term-term-name "vt100") ; ??
|
2007-10-29 13:56:39 +00:00
|
|
|
(buf (get-buffer "*text browser*"))
|
2000-03-20 13:12:14 +00:00
|
|
|
(proc (and buf (get-buffer-process buf)))
|
2007-10-29 13:56:39 +00:00
|
|
|
(n browse-url-text-input-attempts))
|
2010-10-08 17:52:12 -07:00
|
|
|
(require 'term)
|
2000-03-22 23:06:18 +00:00
|
|
|
(if (and (browse-url-maybe-new-window new-buffer) buf)
|
2015-03-17 17:09:34 -07:00
|
|
|
;; Rename away the OLD buffer. This isn't very polite, but
|
2000-03-20 13:12:14 +00:00
|
|
|
;; term insists on working in a buffer named *lynx* and would
|
|
|
|
;; choke on *lynx*<1>
|
|
|
|
(progn (set-buffer buf)
|
|
|
|
(rename-uniquely)))
|
2000-03-22 23:06:18 +00:00
|
|
|
(if (or (browse-url-maybe-new-window new-buffer)
|
2000-03-20 13:12:14 +00:00
|
|
|
(not buf)
|
|
|
|
(not proc)
|
|
|
|
(not (memq (process-status proc) '(run stop))))
|
2007-10-29 13:56:39 +00:00
|
|
|
;; start a new text browser
|
2000-03-20 13:12:14 +00:00
|
|
|
(progn
|
|
|
|
(setq buf
|
|
|
|
(apply #'make-term
|
2007-10-29 13:56:39 +00:00
|
|
|
`(,browse-url-text-browser
|
|
|
|
,browse-url-text-browser
|
|
|
|
nil ,@browse-url-text-emacs-args
|
2000-03-22 23:06:18 +00:00
|
|
|
,url)))
|
2000-03-20 13:12:14 +00:00
|
|
|
(switch-to-buffer buf)
|
|
|
|
(term-char-mode)
|
|
|
|
(set-process-sentinel
|
|
|
|
(get-buffer-process buf)
|
|
|
|
;; Don't leave around a dead one (especially because of its
|
|
|
|
;; munged keymap.)
|
2013-09-10 23:52:26 +02:00
|
|
|
(lambda (process _event)
|
2000-03-20 13:12:14 +00:00
|
|
|
(if (not (memq (process-status process) '(run stop)))
|
|
|
|
(let ((buf (process-buffer process)))
|
|
|
|
(if buf (kill-buffer buf)))))))
|
2007-10-29 13:56:39 +00:00
|
|
|
;; Send the url to the text browser in the old buffer
|
2000-03-20 13:12:14 +00:00
|
|
|
(let ((win (get-buffer-window buf t)))
|
|
|
|
(if win
|
|
|
|
(select-window win)
|
|
|
|
(switch-to-buffer buf)))
|
|
|
|
(if (eq (following-char) ?_)
|
2007-10-29 13:56:39 +00:00
|
|
|
(cond ((eq browse-url-text-input-field 'warn)
|
2001-07-16 12:23:00 +00:00
|
|
|
(error "Please move out of the input field first"))
|
2007-10-29 13:56:39 +00:00
|
|
|
((eq browse-url-text-input-field 'avoid)
|
2000-03-20 13:12:14 +00:00
|
|
|
(while (and (eq (following-char) ?_) (> n 0))
|
2007-09-17 15:59:55 +00:00
|
|
|
(term-send-down) ; down arrow
|
2007-10-29 13:56:39 +00:00
|
|
|
(sit-for browse-url-text-input-delay))
|
2000-03-20 13:12:14 +00:00
|
|
|
(if (eq (following-char) ?_)
|
2001-07-16 12:23:00 +00:00
|
|
|
(error "Cannot move out of the input field, sorry")))))
|
2007-09-17 15:59:55 +00:00
|
|
|
(term-send-string proc (concat "g" ; goto
|
2000-03-20 13:12:14 +00:00
|
|
|
"\C-u" ; kill default url
|
|
|
|
url
|
|
|
|
"\r")))))
|
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-text-emacs 'browse-url-browser-kind 'internal)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2022-07-11 05:14:57 -07:00
|
|
|
;; --- irc ---
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-irc (url &rest _)
|
|
|
|
"Call `url-irc' directly after parsing URL.
|
|
|
|
This function is a fit for options like `gnus-button-alist'."
|
|
|
|
(url-irc (url-generic-parse-url url)))
|
|
|
|
|
|
|
|
(function-put 'browse-url-irc 'browse-url-browser-kind 'internal)
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;; --- mailto ---
|
|
|
|
|
2021-10-22 17:07:56 +02:00
|
|
|
(autoload 'rfc6068-parse-mailto-url "rfc6068")
|
2004-03-07 19:59:15 +00:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun browse-url-mail (url &optional new-window)
|
2004-03-07 19:59:15 +00:00
|
|
|
"Open a new mail message buffer within Emacs for the RFC 2368 URL.
|
2000-03-20 13:12:14 +00:00
|
|
|
Default to using the mailto: URL around or before point as the
|
|
|
|
recipient's address. Supplying a non-nil interactive prefix argument
|
|
|
|
will cause the mail to be composed in another window rather than the
|
|
|
|
current one.
|
|
|
|
|
2001-04-18 12:48:36 +00:00
|
|
|
When called interactively, if variable `browse-url-new-window-flag' is
|
2000-03-20 13:12:14 +00:00
|
|
|
non-nil use `compose-mail-other-window', otherwise `compose-mail'. A
|
|
|
|
non-nil interactive prefix argument reverses the effect of
|
2001-04-18 12:48:36 +00:00
|
|
|
`browse-url-new-window-flag'.
|
2000-03-20 13:12:14 +00:00
|
|
|
|
|
|
|
When called non-interactively, optional second argument NEW-WINDOW is
|
2001-04-18 12:48:36 +00:00
|
|
|
used instead of `browse-url-new-window-flag'."
|
2000-03-20 13:12:14 +00:00
|
|
|
(interactive (browse-url-interactive-arg "Mailto URL: "))
|
|
|
|
(save-excursion
|
2021-08-30 01:56:10 +02:00
|
|
|
(let* ((alist (rfc6068-parse-mailto-url url))
|
2004-03-07 19:59:15 +00:00
|
|
|
(to (assoc "To" alist))
|
|
|
|
(subject (assoc "Subject" alist))
|
|
|
|
(body (assoc "Body" alist))
|
2010-11-10 00:02:44 +00:00
|
|
|
(rest (delq to (delq subject (delq body alist))))
|
2004-03-07 19:59:15 +00:00
|
|
|
(to (cdr to))
|
|
|
|
(subject (cdr subject))
|
|
|
|
(body (cdr body))
|
|
|
|
(mail-citation-hook (unless body mail-citation-hook)))
|
2000-03-22 23:06:18 +00:00
|
|
|
(if (browse-url-maybe-new-window new-window)
|
2004-03-07 19:59:15 +00:00
|
|
|
(compose-mail-other-window to subject rest nil
|
2010-11-10 00:02:44 +00:00
|
|
|
(list 'insert-buffer (current-buffer)))
|
2004-03-07 19:59:15 +00:00
|
|
|
(compose-mail to subject rest nil nil
|
2010-11-10 00:02:44 +00:00
|
|
|
(list 'insert-buffer (current-buffer))))
|
|
|
|
(when body
|
|
|
|
(goto-char (point-min))
|
|
|
|
(unless (or (search-forward (concat "\n" mail-header-separator "\n")
|
|
|
|
nil 'move)
|
|
|
|
(bolp))
|
|
|
|
(insert "\n"))
|
|
|
|
(goto-char (prog1
|
|
|
|
(point)
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 18:58:46 +02:00
|
|
|
(insert (string-replace "\r\n" "\n" body))
|
2010-11-10 00:02:44 +00:00
|
|
|
(unless (bolp)
|
|
|
|
(insert "\n"))))))))
|
2000-03-20 13:12:14 +00:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-mail 'browse-url-browser-kind 'internal)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2016-10-21 11:23:39 -04:00
|
|
|
;; --- man ---
|
|
|
|
|
|
|
|
(defvar manual-program)
|
|
|
|
|
|
|
|
(defun browse-url-man (url &optional _new-window)
|
|
|
|
"Open a man page."
|
|
|
|
(interactive (browse-url-interactive-arg "Man page URL: "))
|
|
|
|
(require 'man)
|
|
|
|
(setq url (replace-regexp-in-string "\\`man:" "" url))
|
|
|
|
(cond
|
|
|
|
((executable-find manual-program) (man url))
|
2020-05-07 13:02:13 +02:00
|
|
|
(t (woman (replace-regexp-in-string "([[:alnum:]]+)" "" url)))))
|
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-man 'browse-url-browser-kind 'internal)
|
2016-10-21 11:23:39 -04:00
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
;; --- Random browser ---
|
|
|
|
|
|
|
|
;;;###autoload
|
2013-09-10 23:52:26 +02:00
|
|
|
(defun browse-url-generic (url &optional _new-window)
|
2000-03-20 13:12:14 +00:00
|
|
|
;; new-window ignored
|
|
|
|
"Ask the WWW browser defined by `browse-url-generic-program' to load URL.
|
|
|
|
Default to the URL around or before point. A fresh copy of the
|
|
|
|
browser is started up in a new process with possible additional arguments
|
|
|
|
`browse-url-generic-args'. This is appropriate for browsers which
|
|
|
|
don't offer a form of remote control."
|
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
|
|
|
(if (not browse-url-generic-program)
|
2007-09-17 15:59:55 +00:00
|
|
|
(error "No browser defined (`browse-url-generic-program')"))
|
2021-03-08 10:11:22 -05:00
|
|
|
(apply #'call-process browse-url-generic-program nil
|
2004-04-02 14:33:08 +00:00
|
|
|
0 nil
|
2000-03-20 13:12:14 +00:00
|
|
|
(append browse-url-generic-args (list url))))
|
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-generic 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2001-05-18 11:27:38 +00:00
|
|
|
;;;###autoload
|
2013-09-10 23:52:26 +02:00
|
|
|
(defun browse-url-kde (url &optional _new-window)
|
2001-05-18 11:27:38 +00:00
|
|
|
"Ask the KDE WWW browser to load URL.
|
2015-12-26 20:47:42 +02:00
|
|
|
Default to the URL around or before point.
|
|
|
|
The optional argument NEW-WINDOW is not used."
|
2001-05-18 11:27:38 +00:00
|
|
|
(interactive (browse-url-interactive-arg "KDE URL: "))
|
|
|
|
(message "Sending URL to KDE...")
|
2003-04-12 22:21:18 +00:00
|
|
|
(apply #'start-process (concat "KDE " url) nil browse-url-kde-program
|
2007-09-17 15:59:55 +00:00
|
|
|
(append browse-url-kde-args (list url))))
|
2001-05-18 11:27:38 +00:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-kde 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2007-09-19 11:26:57 +00:00
|
|
|
(defun browse-url-elinks-new-window (url)
|
|
|
|
"Ask the Elinks WWW browser to load URL in a new window."
|
2008-07-08 14:45:36 +00:00
|
|
|
(let ((process-environment (browse-url-process-environment)))
|
2007-09-19 11:26:57 +00:00
|
|
|
(apply #'start-process
|
|
|
|
(append (list (concat "elinks:" url)
|
|
|
|
nil)
|
|
|
|
browse-url-elinks-wrapper
|
|
|
|
(list "elinks" url)))))
|
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-elinks-new-window 'browse-url-browser-kind
|
|
|
|
'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2007-09-07 04:37:01 +00:00
|
|
|
;;;###autoload
|
2007-09-19 11:26:57 +00:00
|
|
|
(defun browse-url-elinks (url &optional new-window)
|
2007-09-07 04:37:01 +00:00
|
|
|
"Ask the Elinks WWW browser to load URL.
|
|
|
|
Default to the URL around the point.
|
|
|
|
|
|
|
|
The document is loaded in a new tab of a running Elinks or, if
|
|
|
|
none yet running, a newly started instance.
|
|
|
|
|
|
|
|
The Elinks command will be prepended by the program+arguments
|
2007-09-19 11:26:57 +00:00
|
|
|
from `browse-url-elinks-wrapper'."
|
2007-09-07 04:37:01 +00:00
|
|
|
(interactive (browse-url-interactive-arg "URL: "))
|
|
|
|
(setq url (browse-url-encode-url url))
|
2007-09-19 11:26:57 +00:00
|
|
|
(if new-window
|
|
|
|
(browse-url-elinks-new-window url)
|
|
|
|
(let ((process-environment (browse-url-process-environment))
|
|
|
|
(elinks-ping-process (start-process "elinks-ping" nil
|
|
|
|
"elinks" "-remote" "ping()")))
|
|
|
|
(set-process-sentinel elinks-ping-process
|
2021-05-18 19:05:29 -04:00
|
|
|
(lambda (process _change)
|
|
|
|
(browse-url-elinks-sentinel process url))))))
|
2007-09-07 04:37:01 +00:00
|
|
|
|
2020-05-10 20:41:42 +02:00
|
|
|
(function-put 'browse-url-elinks 'browse-url-browser-kind 'external)
|
2020-05-07 13:02:13 +02:00
|
|
|
|
2007-09-07 04:37:01 +00:00
|
|
|
(defun browse-url-elinks-sentinel (process url)
|
|
|
|
"Determines if Elinks is running or a new one has to be started."
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 19:13:41 -04:00
|
|
|
;; Try to determine if an instance is running or if we have to
|
|
|
|
;; create a new one.
|
|
|
|
(pcase (process-exit-status process)
|
|
|
|
(5
|
|
|
|
;; No instance, start a new one.
|
|
|
|
(browse-url-elinks-new-window url))
|
|
|
|
(0
|
|
|
|
;; Found an instance, open URL in new tab.
|
|
|
|
(let ((process-environment (browse-url-process-environment)))
|
|
|
|
(start-process (concat "elinks:" url) nil
|
|
|
|
"elinks" "-remote"
|
|
|
|
(concat "openURL(\"" url "\",new-tab)"))))
|
|
|
|
(exit-status
|
|
|
|
(error "Unrecognized exit-code %d of process `elinks'"
|
|
|
|
exit-status))))
|
2007-09-07 04:37:01 +00:00
|
|
|
|
2019-07-28 15:55:31 +02:00
|
|
|
;;; Adding buttons to a buffer to call `browse-url' when you hit them.
|
|
|
|
|
2022-05-10 23:20:52 +02:00
|
|
|
(defvar-keymap browse-url-button-map
|
|
|
|
:doc "The keymap used for `browse-url' buttons."
|
|
|
|
"RET" #'browse-url-button-open
|
|
|
|
"<mouse-2>" #'browse-url-button-open
|
|
|
|
"w" #'browse-url-button-copy)
|
2019-07-28 15:55:31 +02:00
|
|
|
|
|
|
|
(defface browse-url-button
|
|
|
|
'((t :inherit link))
|
2021-09-14 08:43:18 +02:00
|
|
|
"Face for `browse-url' buttons (i.e., links)."
|
2019-07-28 15:55:31 +02:00
|
|
|
:version "27.1")
|
|
|
|
|
|
|
|
(defun browse-url-add-buttons ()
|
|
|
|
"Add clickable buttons to the text following point in the current buffer.
|
|
|
|
Everything that matches `browse-url-button-regexp' will be made
|
|
|
|
clickable and will use `browse-url' to open the URLs in question."
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
(save-excursion
|
|
|
|
(while (re-search-forward browse-url-button-regexp nil t)
|
|
|
|
(add-text-properties (match-beginning 0)
|
|
|
|
(match-end 0)
|
|
|
|
`(help-echo "Open the URL under point"
|
|
|
|
keymap ,browse-url-button-map
|
|
|
|
face browse-url-button
|
|
|
|
button t
|
2019-07-30 16:06:51 +02:00
|
|
|
category browse-url
|
2019-07-28 15:55:31 +02:00
|
|
|
browse-url-data ,(match-string 0)))))))
|
|
|
|
|
2021-08-25 12:29:22 +02:00
|
|
|
;;;###autoload
|
2019-07-28 15:55:31 +02:00
|
|
|
(defun browse-url-button-open (&optional external mouse-event)
|
|
|
|
"Follow the link under point using `browse-url'.
|
|
|
|
If EXTERNAL (the prefix if used interactively), open with the
|
|
|
|
external browser instead of the default one."
|
|
|
|
(interactive (list current-prefix-arg last-nonmenu-event))
|
|
|
|
(mouse-set-point mouse-event)
|
|
|
|
(let ((url (get-text-property (point) 'browse-url-data)))
|
|
|
|
(unless url
|
|
|
|
(error "No URL under point"))
|
|
|
|
(if external
|
2019-07-29 00:07:34 +02:00
|
|
|
(funcall browse-url-secondary-browser-function url)
|
2019-07-28 15:55:31 +02:00
|
|
|
(browse-url url))))
|
|
|
|
|
2021-06-02 23:02:45 +02:00
|
|
|
;;;###autoload
|
2019-07-30 16:06:00 +02:00
|
|
|
(defun browse-url-button-open-url (url)
|
|
|
|
"Open URL using `browse-url'.
|
|
|
|
If `current-prefix-arg' is non-nil, use
|
|
|
|
`browse-url-secondary-browser-function' instead."
|
|
|
|
(if current-prefix-arg
|
|
|
|
(funcall browse-url-secondary-browser-function url)
|
|
|
|
(browse-url url)))
|
|
|
|
|
2019-07-28 15:55:31 +02:00
|
|
|
(defun browse-url-button-copy ()
|
2019-08-02 16:39:53 +03:00
|
|
|
"Copy the URL under point."
|
2019-07-28 15:55:31 +02:00
|
|
|
(interactive)
|
|
|
|
(let ((url (get-text-property (point) 'browse-url-data)))
|
|
|
|
(unless url
|
|
|
|
(error "No URL under point"))
|
|
|
|
(kill-new url)
|
|
|
|
(message "Copied %s" url)))
|
|
|
|
|
2000-03-20 13:12:14 +00:00
|
|
|
(provide 'browse-url)
|
|
|
|
|
|
|
|
;;; browse-url.el ends here
|