All Projects → emacs-tw → Emacs 101 Beginner Survival Guide

emacs-tw / Emacs 101 Beginner Survival Guide

Emacs 101 新手求生指南 - 一本讓你學 Emacs 不再學得靠北靠母的美好的新手求生指南

Projects that are alternatives of or similar to Emacs 101 Beginner Survival Guide

Emacs Elisp Programming
Tutorial about programming Elisp and Emacs text editor customization.
Stars: ✭ 548 (+16.1%)
Mutual labels:  tutorial, emacs
Vim Practice
💘 Vim is awesome! Here is my practice and study log.
Stars: ✭ 452 (-4.24%)
Mutual labels:  tutorial, emacs
Emacs4developers
A document to help developers to use Emacs as a developer
Stars: ✭ 430 (-8.9%)
Mutual labels:  tutorial, emacs
Mostly Adequate Guide
Mostly adequate guide to FP (in javascript)
Stars: ✭ 21,330 (+4419.07%)
Mutual labels:  tutorial
Pytorch tutorial
PyTorch Tutorial (1.7)
Stars: ✭ 450 (-4.66%)
Mutual labels:  tutorial
Zh.javascript.info
现代 JavaScript 教程(The Modern JavaScript Tutorial)
Stars: ✭ 5,656 (+1098.31%)
Mutual labels:  tutorial
Rpg Tutorial
The Unity Project for the RPG Tutorial Series!
Stars: ✭ 466 (-1.27%)
Mutual labels:  tutorial
Frontmacs
Package-based, web-centric, customizable, awesome-by-default, acceptance-tested Emacs distribution
Stars: ✭ 445 (-5.72%)
Mutual labels:  emacs
Gamingtweaks
Windows 10 and (some) Linux Gaming Tweaks without myths
Stars: ✭ 463 (-1.91%)
Mutual labels:  tutorial
Helm Dash
Browse Dash docsets inside emacs
Stars: ✭ 455 (-3.6%)
Mutual labels:  emacs
Anki Editor
Emacs minor mode for making Anki cards with Org
Stars: ✭ 453 (-4.03%)
Mutual labels:  emacs
Phoenix Chat Example
💬 A Step-by-Step Beginners Tutorial for Building, Testing & Deploying a Chat app in Phoenix 1.5.5 🚀
Stars: ✭ 452 (-4.24%)
Mutual labels:  tutorial
Quelpa
Build and install your Emacs Lisp packages on-the-fly directly from source
Stars: ✭ 455 (-3.6%)
Mutual labels:  emacs
Spacemacs
A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
Stars: ✭ 21,906 (+4541.1%)
Mutual labels:  emacs
Vk raytracing tutorial khr
Ray tracing examples and tutorials using VK_KHR_ray_tracing
Stars: ✭ 461 (-2.33%)
Mutual labels:  tutorial
Deeplearningproject
An in-depth machine learning tutorial introducing readers to a whole machine learning pipeline from scratch.
Stars: ✭ 4,293 (+809.53%)
Mutual labels:  tutorial
Ue4 Tutorials
Collection of Unreal 4 Tutorials & Experiments.
Stars: ✭ 458 (-2.97%)
Mutual labels:  tutorial
Manim Tutorial Cn
manim中文入门教程
Stars: ✭ 448 (-5.08%)
Mutual labels:  tutorial
Filestash
🦄 A modern web client for SFTP, S3, FTP, WebDAV, Git, Minio, LDAP, CalDAV, CardDAV, Mysql, Backblaze, ...
Stars: ✭ 5,231 (+1008.26%)
Mutual labels:  emacs
Emacs Color Themes
A collection of custom themes for Emacs. All the themes are named after famous programmers.
Stars: ✭ 469 (-0.64%)
Mutual labels:  emacs
  • Emacs 101 新手求生指南 一本讓你學 Emacs 不再學得靠北靠母的美好的新手求生指南。

#+BEGIN_QUOTE ** 一些懺悔 這是寫完這本小書的三年後對於這本書的懺悔。

用了也六年的 Emacs、寫過十幾個 Emacs 外掛,我想現在的我應該有點資格說這些話。

不瞞各位說,我自己用 Emacs 的機會越來越少了。原因無他,就是 Emacs 在寫程式這點確實比不上 VSCode 了,跳到 VSCode 三個月後,我的日常工作裡 Emacs 只拿來做寫程式以外的任務(Magit, serial-term 之類的),而且完全不會懷念用 Emacs 寫程式,轉換的陣痛期也出乎意料的小 -- VSCode 的優勢實在太多了,感謝上帝讚美拯救蒼生的微軟。

在你決定學習 Emacs 之前,就讓我幹譙一下 Emacs,目前在 Emacs 裡面搞過 C++, Python, JavaScript, TypeScript 的自動補全與重構(其實搞過的開發環境不只這幾種語言,但這幾種語言我都有寫了一定的時間比較理解),都很難搞,而且最終弄出來的效果也都沒有 Qt Creator / PyCharm / VSCode 好(大概差了八九六四個光年吧),不是常常罷工、甚至根本卡頓到不堪用。就算只是想寫個 web,vue, scss, pug / jade 和 stylus 這幾個需要的 major-mode 我都直接自幹要不然也 hack 過,現有的都超難用要不然就是 bug 滿天飛,搞了兩三年發現用 VSCode 隨便滑鼠點一點裝好 plugins 還不用動設定的開發環境都比目前Emacs上各式現有package與自己土炮出來的好用太多...

就算以上都順利裝好、TypeScript 支援就是沒 VSCode 強大(lsp-mode 是完全跑不起來,eglot-mode 則是極度卡頓、一直把你的按鍵輸入吃掉挑戰你的 EQ 底線)、C/C++ 支援就是沒有 QtCreator 或 VisualStudio 那樣的行雲流水(更別說現在有 clang 語意分析加持的 QtCreator 跟那好用到爆的 UI 搭配)。你可能會說這些本來就不是編輯器該做的事情、Emacs 不是 IDE...但畢竟我是要工作寫程式不是在玩遊戲啊,工作效率才是最重要的,我根本不想管 Emacs 定位是編輯器還是 IDE。

就算只是編輯器好了,舉個實際例子:我常常在寫 pug/jade,但現有的 jade-mode 和 pug-mode 都充滿缺陷到讓人訝異(因為在這之前我沒有寫過這類型的 major-mode, 後來頭洗下去研究才發現這兩個 mode 的作者根本連 syntax-table / =modify-syntax-entry= 的參數意義都理解得一塌糊塗),因為實在受不了所以花費了幾個禮拜寫了 [[https://github.com/kuanyui/yajade-mode.el#known-bugs][yajade-mode]] (同時也寫了 [[https://github.com/kuanyui/cakecrumbs.el][cakecrumbs.el]] 來輔助),沒寫不知道,一寫才發現原來 Emacs 對 syntax 的支援是如此...簡陋,以至於後來發現除非你真的像 =js2-mode= 那樣自己寫 lexer / parser 自己上色,否則 pug/jade 的支援就是無解。

後來試試 VSCode,一裝好,哇好流暢的自動補全啊(Company 實在有夠慢),哇code 不用外掛就可以折疊耶、哇 TypeScript 補全超聰明還會自動 import 耶、哇寫 Vue 時編輯器可以直接理解 <script> 裡面的 TypeScript 語意耶,媽呀找Reference的UI也太方便了吧......

#+BEGIN_QUOTE 因為這是屬於很細節的東西,有興趣的人再讀這塊。要為一個程式語言寫 major-mode,除了自己自幹 lexer / parser 自己上色外,Emacs 內建提供兩條路:

  1. syntax-table,C 實做,只能作到最簡單最基礎的文法支援,例如一個 symbol 可以包含哪些字元、左右括號分別是哪些字元、標示註解用的開頭與結尾的字元(限制各 2 字元)、quote 成對匹配(而且 quote 成對匹配只能多行,所以你就會明白為什麼 js-mode 的 string 為何完全不理會 string 中間有斷行)、quote 內的 escape 字元等等),讀一下文件就會明白,這些支援完全是為了 Common Lisp / Emacs Lisp 的語法打造。
  2. font-lock,ELisp 實做,可以餵 Regexp 讓 Emacs「讀懂」比較複雜的 syntax,補足 syntax-table 做不到的範圍。理論上也可以餵 callback function 來作到 regular language 做不到的事情,但實際上,這 callback 設計得非常難寫(可能是為了效率考量,他不是要你傳 position 進去,而是 font-lock 打算自己吃 last matched data...。但耗費的時間越多,對 Emacs 的效能問題越提不起興趣去理解...對不起這點是我我能力不足),即使寫出來了,syntax highlight 還是一下要動一下不動(不管哪種語言 Emacs 經常遇到 syntax highlight 上色錯誤可能大多都是這些問題)。 #+END_QUOTE

當然 Emacs 是自由軟體,我也很想打造更多好東西讓 Emacs 更加好用,讓我開發時更輕鬆愉快,但發現...付出的時間龐大不說,而且 VSCode 一裝好、很多預設值就做得比你搞老半天做得還好上幾個光年了。不信的話,可以看看 [[https://github.com/kuanyui/.emacs.d][我的 Emacs 設定檔]] ,看我花費了多少時間給各種語言寫一堆 hack 僅僅只是讓他做出例如啟動 LSP client 這樣的基本任務,但一試用 VSCode 後發現預設值就做得超好(而且不少是現有的Emacs理論上無解的東西,像 mmm-mode, 你要在Emacs裡愉快的寫Vue + TypeScript基本上不可能。),我根本是在浪費自己的生命。

好啦不想再抱怨了,總之我在這裡已經把我用了這麼多年的心得講在前面了,是否要繼續學下去你自行決定。

-- ono hiroko 2018/12 #+END_QUOTE

** 前言 你在 Google 搜尋「Emacs 入門 教學」,可以找到不少結果,但仔細一看會發現他們幾乎全是一些快速鍵的 cheat sheets,頂多再加一點基本設定檔(可能再順便靠北一下「按鍵好難按,還是 Vim 好用」或嘲笑一下 Lisp 的括號數量後、順便扯一下編輯器大戰中已經被玩了二三十年的各種爛梗),等到你背完基本快速鍵、學會基本操作後就發現你被放生了,不知道接下來該怎麼繼續下去。更別說 100 個人寫出 100 篇「Emacs 入門教學」但都只寫了開頭,就好像每天都下定決心要唸書,結果每天都從課本第一頁開始看。不知道為什麼大家那麼愛寫那種虎頭蛇尾的東西。

說難聽點我個人認為那種教學根本沒什麼屁用(當然也很有可能是該作者自己寫完該篇教學嚐嚐鮮後,就再也沒用過 Emacs,然後你也跟著再也沒用過 Emacs...)。只教你背快速鍵的 Emacs 教學,就好像你去讀一本號稱超強大的 Rails 自學教科書,讀了才發現它只是一昧叫你把 best practice 的 code 抄一百遍,至於為什麼,「初學者不用知道,抄一百遍當你的手指肌肉反射性記住 code 後自然就懂了」。這真是蠢斃了。

這本篇幅精簡的 Emacs 101 是從概念而不是肌肉著手,盡可能清楚地講解初學 Emacs 時幾乎都會遇到的一些問題,等你透徹了解基礎概念後,也能夠自己知道接下來該怎麼做。所以,這本 Emacs 101 也不會去講解各個知名外掛該如何使用,一是沒有必要(因為有了基礎概念這些你自己看一看他們的 README 就會用了);二是這些外掛變動很快,花費時間精力寫完教學沒多久很快也會步入網路上那些長滿了蜘蛛網、沒人要看的 Emacs 教學的後塵。

因此, 如果你要貢獻這本 Emacs 101,也請不要專門開個篇章探究某個特定外掛怎麼用。 但歡迎把這類文章寫在自己的 Blog,然後把文章連結放入[[file:附錄 Z-推薦連結.org][本書的附錄 Z]]中,至於更新的責任就交給各篇文章作者了。

最後離題小小聲的說一下:我是這本書的原作者 ono hiroko,如果你喜歡這個作品,也許我們可以交個朋友(害羞):

  • Blog: [[https://kuanyui.github.io][東北角的小徑]]

  • Twitter: [[https://twitter.com/azazabc123]]

    -- [[https://github.com/kuanyui][ono hiroko (@kuanyui)]] [[file:pic/author.jpg]]

  • 授權 本書 Emacs 101 採用 CC-0 授權釋出,屬公有領域。請自行取用並不要拿來做壞事。

歡迎任何人丟 pull request 來參與撰寫、修正。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].