Giter Site home page Giter Site logo

lalohao / emacs-nxswidgets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from veshboo/emacs

0.0 3.0 0.0 272.56 MB

Emacs xwidget webkit support for macOS X Cocoa

License: GNU General Public License v3.0

Emacs Lisp 63.67% Roff 17.17% Makefile 0.44% C 16.39% Perl 0.10% Awk 0.03% Shell 0.15% Python 0.04% NSIS 0.01% Batchfile 0.02% HTML 0.11% M4 0.67% GDB 0.05% PostScript 0.18% TeX 0.64% SRecode Template 0.05% Smalltalk 0.05% JavaScript 0.06% NewLisp 0.06% Ruby 0.11%

emacs-nxswidgets's Introduction

nsxwidget - NS Cocoa backend for Emacs xwidgets

This repo supports Emacs feature xwidgets on native macOS X Cocoa.

Though original Emacs xwidgets builds and works on macOS but must build and run with X window and GTK instead of macOS's own GUI framework, resulting unaligned styles and UX with surrounding desktop environment.

WARNING This software is EXPERIMENTAL and UNSTABLE, can causes lost of data you are working on with this.

For example, while I develop, once watched an abrupt termination of this program that is not resolved.

Screenshot

Reviewing pandoc generated html in emacs xwidget webkit for mac os x,

How to build

On quite recent macOS X system with Xcode and WebKit2

  • Git clone this repo and checkout master
git clone https://github.com/veshboo/emacs.git
git checkout master
  • Notable dependencies
brew install texinfo
brew install gnutls
brew install autoconf
brew install pkg-config
  • Environment variable for newly installed texinfo (makeinfo)
export PATH=/usr/local/opt/texinfo/bin:$PATH
export LDFLAGS=-L/usr/local/opt/texinfo/lib
  • then build Emacs
./autogen.sh
./configure --prefix=$HOME/works/emacs-devel --with-xwidgets
make install

For general build information, read INSTALL.REPO.

How to use

Your Emacs app built is located under prefix/nextstep/Emacs.app ... you can run it from command line

cd $HOME/works/emacs-devel/emacs
./nextstep/Emacs.app/Contents/MacOS/Emacs

or by double-clicking Emacs app icon under prefix/nextstep folder in Finder.

Brief xwidget webkit commands and key mappings

  • Commands

    • M-x xwidget-webkit-browse-url, enter a URL you want visit including "https://", "http://", "files:///" part

    • C-u M-x xwidget-webkit-browse-url, ... does same but using new session of webkit

  • Key mappings (apply when keyboard focus is not in HTML input text or textarea element, in general)

    • space, shift-space, up/down, left/right, delete: Scrolling

    • b, r, +/-: backward, reload, zoom in/out

    • C-x 2, C-x 3: Duplicate browsing same page in new horizontal or vertical split window (also using a new session)

    • C-g: Give up focus held in HTML input text or textarea element to Emacs

    • C-s, C-r: isearch integration

    • C-x r m, C-x r l: bookmark integration

Example customization using xwidget webkit

  • Use xwidget-webkit-browse-url as the browse-url
;; In ~/.emacs or ~/.emacs.d/init.el
(setq browse-url-browser-function 'xwidget-webkit-browse-url)
* Then, many packages supporting `browse-url` will work with xwidget webkit

* For example, try `C-c C-c p` if you are using `markdown-preview`.
  • search-web with xwidget webkit
(require 'search-web)
(global-set-key (kbd "C-c w") 'search-web)
(defun browse-url-default-browser (url &rest args)
  "Override `browse-url-default-browser' to use `xwidget-webkit' URL ARGS."
  (xwidget-webkit-browse-url url args))
  • Browse to a URL bookmark from *Bookmark List*
(defvar xwidget-webkit-bookmark-jump-new-session) ;; xwidget.el
(defvar xwidget-webkit-last-session-buffer) ;; xwidget.el
(add-hook 'pre-command-hook
          (lambda ()
            (if (eq this-command #'bookmark-bmenu-list)
                (if (not (eq major-mode 'xwidget-webkit-mode))
                    (setq xwidget-webkit-bookmark-jump-new-session t)
                  (setq xwidget-webkit-bookmark-jump-new-session nil)
                  (setq xwidget-webkit-last-session-buffer (current-buffer))))))
* `RET` on a URL bookmark will show the page in the window with
  current `*Bookmark List*`

* It will create a new `xwidget-webkit-mode` buffer if the
  previous buffer in the selected window is not a
  `xwidget-webkit-mode`.  Otherwise, it will browse in the
  previous `xwidget-webkit-mode` buffer.
  • Write elisp using lisp/xwidget.el to your task

emacs-nxswidgets's People

Contributors

acinnes avatar albinus avatar andreas-schwab avatar belanger avatar dgutov avatar dmantipov avatar drmirror avatar eggert avatar eli-zaretskii avatar holomorph avatar jave avatar jwiegley avatar larsmagne avatar lektu avatar leoliu avatar link0ff avatar loveshack avatar malabarba avatar mituharu avatar monnier avatar npostavs avatar paveljanik avatar rfrancoise avatar rgmorris avatar sam-s avatar snogglethorpe avatar tsdh avatar wohler avatar xfq avatar yamaoka avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.