Emacsist RSS --- If never, make it ever: C-h C-h

Emacs is my Window Manager

5666

这里 查看更多 Emacs 相关推荐文章最新 Emacs 圈的动态. 欢迎关注微信公众账号: Emacsist

Hick 叽喳:

    看看深度 Emacs 用户是怎么 Living in Emacs 的

Most companies that employ me, hand me a “work laptop” as I enter the building. Of course, I do not install personal software and keep a clear division between my “work like” and my “real life.”

Hick 叽喳:

     几次尝试过用 VirtualBox 和 VMware 搭建自己的虚拟工作环境, 尤其是之前经常需要在 PC/thinkpad/Mac air 之间切换. 一个很好的 VM 虚拟机也是我理想的状态, 不过由于想在 VM 中想调整显示器分辨率失败, 驱动没能搞定 又没法安于终端使用 Emacs, 最终放弃 linux 环境的 Emacs 后试点成功的是 Vagrant + Docker 这种解决方案---虽然 Vagrant 也是基于 VirtualbBox  等, 控制方式还是有比较大的改善---至少对我来说是.

However, I also don’t like to carry two computers just to jot down personal notes. My remedy is to install a virtualization system and create a “personal” virtual machine. (Building cloud software as my day job means I usually have a few VMs running all the time.)

Since I want this VM to have minimal impact on my work, I base it on a “Server” version of Ubuntu. however, I like some graphical features, so my most minimal after market installation approach is: (1)

sudo apt-get install -y xinit

Since most of what I do is org-mode work, the next step is:

sudo apt-get install -y emacs

I have played with a lot of window managers, and while some claim to be unobtrusive and minimal(2), I really just want Emacs in full-screen mode (utilizing all screen estate possible).(3)

To accomplish this, I create an .xinitrc file that contains only:

exec emacs

That’s right, folks, Emacs is my window manager. I add the following to my Emacs init.el script:

(set-frame-parameter nil 'fullscreen 'fullboth)

And now I can split the screen into windows, launch programs– even edit files– all without fondling the mouse, and since Emacs is in its graphical mode, I can use my favorite fonts, decorate the fringe, etc.

new-window-manager-1.png

If I need a program that doesn’t run well within Emacs, I can call xterm (or any other application) with M-! xterm.

Web Browsing

Unlike the previous century, this century has been defined by web applications. Most of my web efforts are looking up code documentation and other technical resources, and this is good using a text-oriented browser like w3m or eww embedded within Emacs.

Hick 叽喳:

    什么时候能把 chrome 嵌入 Emacs 作为一个子窗口就一统天下了, 嘿嘿,  deepin Emacs 一直没能剥离出一个大众版本, 只能用 deepin linux 体验这种感觉.

Whenever a page doesn’t render well (can you say JavaScript), I can hit the & key to bring up a web browser.(4). You can kick off a graphical browser to a specific URL by binding a function that calls this:

(start-process "" nil "xdg-open" "http://mail.google.com")

Keep in mind, running X window applications without a real window manager will overlay Emacs, which is only an option if the window is temporary. When closed, you are back to Emacs:

new-window-manager-3.png

Hick 叽喳:

    关掉就回 Emacs , 还是轻度 web 用户, 我已经是重度  web 用户了.

Update:Since I wrote this section, a number of people have mentioned some light-weight window managers. If you need to use a browser, but still want Emacs to utilize every possible pixel, the best seems to be Ratpoison(5)(with DWM a close second).

Hick 叽喳:

    这里有兴趣的可以试试提到的轻量级的窗口管理器 Ratpoison .

Other Applications

I realize that running shells inside Emacs isn’t for everyone, but currently using Emacs as my entire Linux desktop works pretty well. Especially since I can split the frame into a series of windows running:

Hick 叽喳:

    twitter 等也在 Emacs 里玩感觉挺不容易,  这方面估计 w3m 比 eww 是要强... 

I use a function to start my favorite time-sinks…er, applications, at one time:

(defun setup-windows ()
  "Organize a series of windows for ultimate distraction."
  (interactive)
  (delete-other-windows)

  ;; Start with the Stack Overflow interface
  (sx-tab-frontpage t nil)

  ;; Put IRC on the other side
  (split-window-horizontally)
  (other-window 1)
  (circe-connect-all)

  ;; My RSS Feed goes on top:
  (split-window-vertically)
  (elfeed)

  ;; And start up the Twitter interface above that:
  (other-window 2)
  (split-window-vertically)
  (twit)

  (window-configuration-to-register ?w))

The last line insert this “current” configuration in a register, so after stomping and stirring my windows, I return to this organization with C-x r j w.

Perhaps another screenshot of these results are in order:

new-window-manager-2.png

Footnotes:

1

Since I use my virtual machine primarily to take notes, you’ll need to install ispell (or one of the variants):

apt-get install -y ispell

In order to install the VirtualBox extensions, do:

sudo apt-get install -y build-essential
sudo mount /dev/cdrom /mnt
sudo /mnt/VBoxLinuxAdditions.run

2

I always grin when I read the change log in the release notes of any window manager project. It begins by complaining that all other window managers are bloated, and that this one will be small and efficient.

As you follow the history of the project, the complaints that it needs to do launching menus, iconify windows with translucent images, docks and panels, and soon the project is just as big as the competition.

Not that there is anything wrong with that… Writing a window manager is a lot of fun.

3

While taking notes at a conference, a person sitting behind me asked me after the session what window manager I was using. I said this was just a normal Mac, but running Emacs in a full-screen mode with a coupleorg-mode files, an embedded w3m browser, and an Emacs-based twitter client.

4

By the way, to have EWW use Chromium, add this to your init file:

(setq shr-external-browser "chromium-browser")

5

Along with having the best name, the Ratpoison window manager is minimal and mouse-less (and even has a nice Info page), but its default escape key, Control-t is the transpose key in Emacs. To get around this and call Emacs’ transpose function, type C-t t. This is okay when swapping two letters, but now swapping lines isC-x C-t t. Acceptable if I’m swapping only two lines, but I’m often swapping multiple lines–and now it is painful.

To make Ratpoison completely palatable with Emacs, make it use a Command key sequence (like the uselessCommand-t or whatever that Windows key is on other keyboard). To do this, simply add the following to your ~/.ratpoisonrc file:

escape s-t
原文出处: Howard Abrams
原文地址: http://www.howardism.org/index.html#sec-7
原文时间: 2015-01-17 16:00
本文地址: http://emacsist.com/10104
整理时间: 2015-04-10 22:42

本文由 Hick 整理,转载请保留以上信息;
COPYLEFTThe articles on this site come from Internet, thanks to all the original authors.
      If anything about COPYRIGHT, or LEFT, please contact Emacsist at gmail dot com .