From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "Göktuğ Kayaalp" <self@gkayaalp.com>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Gather a list of confusions beginner tend to have
Date: Thu, 10 Sep 2020 19:20:34 -0400 [thread overview]
Message-ID: <8620B5CD-CA92-46BF-80A8-DBE7052F4CA6@gmail.com> (raw)
In-Reply-To: <83lfhjkq0r.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1308 bytes --]
>
> I don't think this scales. Emacs has thousands of options, I'm
> guessing hundreds of them are important for the audience you have in
> mind. You will get a huge set of many options that people with
> "TL;DR" state of mind will never be able to review, let alone decide
> what is for them.
I think there are a few configurations that a beginner would want to change right after he starts Emacs, usually very basic settings. If you think it’s a good idea, I can go to reddit and ask what people missed when then started using Emacs for the first few minutes.
FWIW, here is a demo of the guide: https://youtu.be/0qMskTAR2aw
The demo inserts some configurations into ~/.emacs.d/init.el after completion.
>
> The grouping of the options must be based on some "themes" or similar,
> to be useful. The challenge is, of course, to come up with a useful
> list of such "themes", and then decide which options should each theme
> enable.
Others has described the out-of-the-box experience of doom Emacs, it seems to me that such job is better done by a “distribution” of Emacs than by vanilla Emacs. OTHO, vanilla Emacs could add a tiny guide like I proposed to more or less improve the life for those who started Emacs without reading any tutorial on the internet.
Yuan
[-- Attachment #2: beginner-guide.el --]
[-- Type: application/octet-stream, Size: 11363 bytes --]
;;; beginner-guide.el --- Beginner guide for Emacs -*- lexical-binding: t; -*-
;; Author: Yuan Fu <casouri@gmail.com>
;;; This file is NOT part of GNU Emacs
;;; Commentary:
;;
;;; Code:
;;
(require 'widget)
(eval-when-compile
(require 'wid-edit))
(defvar beginner-guide--config-intro
";; Below is the configuration generated by the beginner guide:\n"
"First line of the beginner guide configuration in init.el.")
(defvar beginner-guide--config-outro
";; The configuration generated by the beginner guide ends here.\n"
"Last line of the beginner guide configuration in init.el.")
(defun beginner-guide--write-config (form-list)
"Create ~/.emacs.d/init.el and write FORM-LIST into it."
(mkdir "~/.emacs.d" 'no-error)
(let ((init-file (expand-file-name "init.el" user-emacs-directory)))
(with-current-buffer (find-file-noselect init-file t)
(goto-char (point-min))
(when (search-forward beginner-guide--config-intro nil t)
(let ((beg (match-beginning 0)))
(when (search-forward beginner-guide--config-outro nil t)
(delete-region beg (point))
(save-buffer))))
(goto-char (point-max))
(insert "\n" beginner-guide--config-intro)
(dolist (form form-list)
(prin1 form (current-buffer))
(insert "\n"))
(insert beginner-guide--config-outro)
(save-buffer))))
(defvar beginner-guide--config nil
"An alist of configurations that the user set in each page.")
(defsubst beginner-guide--save-option (option value)
"Save OPTION’s VALUE in ‘beginner-guide--config’."
(setf (alist-get option beginner-guide--config) value))
;;; Pages
;;;; Theme
(defvar beginner-guide--c-demo
"int add (int x, int y)
{
return x + y;
}
int main(int arg, int* argv)
{
int x = 1;
int y = 2;
return add(x, y) - 3;
}
"
"Demo C code.")
(defun beginner-guide--theme-page ()
"Theme configuration page."
(let ((inhibit-read-only t))
(erase-buffer))
(remove-overlays)
(widget-insert "Set UI theme:\n\n")
;; Insert a C demo.
(widget-insert
(with-temp-buffer
(insert beginner-guide--c-demo)
(c-mode)
(font-lock-fontify-region (point-min) (point-max))
(buffer-string)))
(widget-insert "\n")
;; Insert theme selection menu.
(apply #'widget-create 'radio-button-choice
:follow-link t
:value "default"
;; Enable the theme when the user selects it.
:notify (lambda (widget &rest _)
(mapc #'disable-theme custom-enabled-themes)
(let ((theme (intern (widget-value widget))))
;; Load theme.
(unless (eq theme 'default)
(load-theme theme))
;; Set config.
(beginner-guide--save-option 'theme theme)))
(cons '(item "default")
(cl-loop for theme in (custom-available-themes)
collect `(item ,(symbol-name theme)))))
(use-local-map widget-keymap)
(widget-setup))
;;;; Keybinding
(defun beginner-guide--keybinding-page ()
"Keybinding page."
(widget-insert "Keybinding notation:
C (control) Ctrl
M (meta) Alt/Option
s (super) Windows/Command
S (shift) Shift
Set keybinding style for copy/paste:
We encourage you to learn the default binding, because the alternative
binding conflicts with many parts of Emacs and make the experience
worse in the long run.\n\n")
(widget-create 'radio-button-choice
:follow-link t
:value "default"
:notify (lambda (widget &rest _)
(beginner-guide--save-option
'keybinding (widget-value widget)))
'(item :value "default"
:format "%v\n\n%d\n"
:doc " M-w Copy
C-y Paste
C-w Cut
C-s Search
C-x C-s Save")
'(item :value "alternative"
:format "%v\n\n%d\n"
:doc " C-c Copy
C-v Paste
C-x Cut
C-f Search
C-s Save")))
;;;; UI features
(defun beginner-guide--ui-features-page ()
"UI features page."
(widget-insert "Set some UI options:\n\n")
(widget-create 'checkbox
:notify (lambda (widget &rest _)
(let ((val (widget-value widget)))
(global-display-line-numbers-mode
(if val 1 -1))
(beginner-guide--save-option
'line-number val)))
:value nil)
(widget-insert " Enable line numbers.\n")
(widget-create 'checkbox
:notify (lambda (widget &rest _)
(let ((val (widget-value widget)))
(setq-default cursor-type
(if val 'bar t))
(beginner-guide--save-option
'thin-cursor val)))
:value nil)
(widget-insert " Use thin cursor bar.\n")
(widget-create 'checkbox
:notify (lambda (widget &rest _)
(let ((val (widget-value widget)))
(tool-bar-mode (if val -1 1))
(beginner-guide--save-option
'disable-tool-bar val)))
:value nil)
(widget-insert " Disable tool bar.\n")
(widget-create 'checkbox
:notify (lambda (widget &rest _)
(let ((val (widget-value widget)))
(scroll-bar-mode (if val -1 1))
(beginner-guide--save-option
'disable-scroll-bar val)))
:value nil)
(widget-insert " Disable scroll bar.\n"))
;;;; Undo
(defun beginner-guide--undo-page ()
"Undo page."
(widget-insert
"Emacs has a powerful (but possibly unintuitive) undo system, where
undo operations themselves are recorded in the undo history, and redo
is done by undoing an previous undo operation.
Set undo style:\n\n")
(widget-create 'radio-button-choice
:value "default"
:follow-lint t
:notify (lambda (widget &rest _)
(beginner-guide--save-option
'undo-style (widget-value widget)))
'(item :value "default"
:format "%v\n\n%d\n"
:doc " C-/ Undo")
'(item :value "linear"
:format "%v\n\n%d\n"
:doc " C-/ Undo
C-? Redo")
'(item :value "alternative"
:format "linear with alternative binding\n\n%d"
:doc " C-z Undo
C-S-z Redo")))
;;;; Guide
(defun beginner-guide--with-boilerplate
(setup-fn &optional page-list finish-fn)
"Call page setup function, SETUP-FN, with Customize boilerplate.
PAGE-LIST is a list of setup function for pages to show in a series.
FINISH-FN is called when user clicks the finish button."
(let ((inhibit-read-only t))
(erase-buffer))
(remove-overlays)
(funcall setup-fn)
(widget-insert "\n\n")
(beginner-guide--insert-step-buttons setup-fn page-list finish-fn)
(use-local-map widget-keymap)
(widget-setup)
(goto-char (point-min)))
(defun beginner-guide--insert-step-buttons (page page-list finish-fn)
"Insert buttons that go to previous and next page of PAGE.
PAGE-LIST is a list of setup function for pages to show in a series.
Insert a Button that calls FINISH-FN at the last page."
(let* ((idx (seq-position page-list page))
(previous-page (if (eq idx 0) nil
(nth (1- idx) page-list)))
(next-page (nth (1+ idx) page-list)))
(widget-insert (format "%s/%s " (1+ idx) (length page-list)))
(when previous-page
(widget-create
'push-button
:notify (lambda (&rest _)
(beginner-guide--with-boilerplate
previous-page page-list finish-fn))
:value "Back"))
(widget-insert " ")
(if next-page
(widget-create
'push-button
:notify (lambda (&rest _)
(beginner-guide--with-boilerplate
next-page page-list finish-fn))
:value "Next")
(widget-create
'push-button
:notify (lambda (&rest _) (funcall finish-fn))
:value "Finish"))
(widget-insert "\n")))
(defun beginner-guide--generate-config (config-alist)
"Generate configuration code from CONFIG-ALIST."
(cl-loop for option in '(theme keybinding line-number thin-cursor
disable-tool-bar scroll-bar
undo-style)
append
(let ((value (alist-get option config-alist)))
(pcase (list option value)
(`(theme ,theme) (unless (eq theme 'default))
`((load-theme ',theme)))
('(keybinding "alternative")
'((global-set-key (kbd "C-c") #'kill-ring-save)
(global-set-key (kbd "C-v") #'yank)
(global-set-key (kbd "C-x") #'kill-region)
(global-set-key (kbd "C-f") #'isearch-forward)
(global-set-key (kbd "C-s") #'save-buffer)))
('(line-number t)
'((global-display-line-numbers-mode)))
('(thin-cursor t)
'((setq-default cursor-type 'bar)))
('(disable-tool-bar t)
'((tool-bar-mode -1)))
('(disable-scroll-bar t)
'((scroll-bar-mode -1)))
('(undo-style "linear")
'((global-set-key (kbd "C-/") #'undo-only)
(global-set-key (kbd "C-?") #'undo-redo)))
('(undo-style "alternative")
'((global-set-key (kbd "C-z") #'undo-only)
(global-set-key (kbd "C-S-z") #'undo-redo)))
))))
(defun beginner-guide ()
"Run the beginner guide."
(interactive)
(switch-to-buffer (get-buffer-create "*beginner guide*"))
(setq beginner-guide--config nil)
(let ((page-list '(beginner-guide--theme-page
beginner-guide--keybinding-page
beginner-guide--ui-features-page
beginner-guide--undo-page)))
(beginner-guide--with-boilerplate
(car page-list) page-list
(lambda ()
(kill-buffer)
(with-temp-file "~/tmp/init.el"
(let ((form-list (beginner-guide--generate-config
beginner-guide--config)))
(mapc #'eval form-list)
(beginner-guide--write-config form-list)))))))
(provide 'beginner-guide)
;;; beginner-guide.el ends here
[-- Attachment #3: Type: text/plain, Size: 2 bytes --]
next prev parent reply other threads:[~2020-09-10 23:20 UTC|newest]
Thread overview: 182+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 18:48 Gather a list of confusions beginner tend to have Göktuğ Kayaalp
2020-09-08 19:30 ` Yuan Fu
2020-09-08 21:30 ` Praharsh Suryadevara
2020-09-09 3:51 ` Richard Stallman
2020-09-09 14:18 ` Eli Zaretskii
2020-09-09 14:24 ` Göktuğ Kayaalp
2020-09-09 15:07 ` Stefan Kangas
2020-09-09 16:09 ` Göktuğ Kayaalp
2020-09-09 16:23 ` Praharsh Suryadevara
2020-09-09 16:06 ` Praharsh Suryadevara
2020-09-11 4:13 ` Richard Stallman
2020-09-11 4:13 ` Richard Stallman
2020-09-11 4:41 ` Praharsh Suryadevara
2020-09-09 7:57 ` tomas
2020-09-10 2:40 ` Richard Stallman
2020-09-10 3:32 ` Eli Zaretskii
2020-09-10 8:29 ` tomas
2020-09-10 9:08 ` Gregory Heytings via Emacs development discussions.
2020-09-10 9:34 ` Eli Zaretskii
2020-09-10 10:08 ` tomas
2020-09-10 9:30 ` Eli Zaretskii
2020-09-10 10:11 ` tomas
2020-09-11 4:18 ` Richard Stallman
2020-09-11 7:06 ` Eli Zaretskii
2020-09-11 13:47 ` Stefan Monnier
2020-09-12 3:22 ` Richard Stallman
2020-09-12 3:46 ` Emanuel Berg via Emacs development discussions.
2020-09-10 8:28 ` tomas
2020-09-09 14:01 ` Eli Zaretskii
2020-09-10 23:20 ` Yuan Fu [this message]
2020-09-11 0:20 ` Interactive guide for new users (was: Re: Gather a list of confusions beginner tend to have) Stefan Kangas
2020-09-11 8:15 ` Gregory Heytings via Emacs development discussions.
2020-09-11 9:47 ` Interactive guide for new users Phil Sainty
2020-09-11 14:04 ` Interactive guide for new users (was: Re: Gather a list of confusions beginner tend to have) Yuan Fu
2020-09-11 14:38 ` Gregory Heytings via Emacs development discussions.
2020-09-11 14:49 ` Eli Zaretskii
2020-09-11 15:20 ` Gregory Heytings via Emacs development discussions.
2020-09-11 15:28 ` Eli Zaretskii
2020-09-11 15:46 ` Gregory Heytings via Emacs development discussions.
2020-09-11 15:51 ` Eli Zaretskii
2020-09-11 16:00 ` Gregory Heytings via Emacs development discussions.
2020-09-11 17:03 ` Interactive guide for new users Robert Pluim
2020-09-11 17:23 ` Emanuel Berg via Emacs development discussions.
2020-09-11 17:36 ` Robert Pluim
2020-09-11 17:39 ` Emanuel Berg via Emacs development discussions.
2020-09-11 18:43 ` Interactive guide for new users (was: Re: Gather a list of confusions beginner tend to have) Eli Zaretskii
2020-09-11 19:48 ` Ergus
2020-09-12 6:02 ` Eli Zaretskii
2020-09-12 9:33 ` Ergus
2020-09-13 12:13 ` Interactive guide for new users Philip K.
2020-09-11 18:59 ` FW: Interactive guide for new users (was: Re: Gather a list of confusions beginner tend to have) Drew Adams
2020-09-11 17:47 ` Göktuğ Kayaalp
2020-09-11 17:53 ` Emanuel Berg via Emacs development discussions.
2020-09-11 18:04 ` Praharsh Suryadevara
2020-09-12 11:16 ` Interactive guide for new users Lars Ingebrigtsen
2020-09-12 14:26 ` Göktuğ Kayaalp
2020-09-12 14:55 ` Gregory Heytings via Emacs development discussions.
2020-09-12 15:10 ` Göktuğ Kayaalp
2020-09-12 15:18 ` Gregory Heytings via Emacs development discussions.
2020-09-13 18:12 ` Juri Linkov
2020-09-11 14:02 ` Interactive guide for new users (was: Re: Gather a list of confusions beginner tend to have) Yuan Fu
2020-09-12 9:31 ` Interactive guide for new users Gregory Heytings via Emacs development discussions.
2020-09-12 9:55 ` Eli Zaretskii
2020-09-12 10:35 ` Gregory Heytings via Emacs development discussions.
2020-09-12 10:52 ` Ergus
2020-09-12 10:58 ` Eli Zaretskii
2020-09-12 11:34 ` Dmitry Gutov
2020-09-12 12:00 ` Gregory Heytings via Emacs development discussions.
2020-09-12 12:21 ` Eli Zaretskii
2020-09-12 13:56 ` Gregory Heytings via Emacs development discussions.
2020-09-12 14:07 ` Eli Zaretskii
2020-09-12 12:54 ` Ergus
2020-09-12 12:16 ` Ergus
2020-09-12 12:34 ` Eli Zaretskii
2020-09-12 13:18 ` Ergus
2020-09-12 13:43 ` Eli Zaretskii
2020-09-12 14:17 ` Ergus
2020-09-12 14:36 ` Eli Zaretskii
2020-09-12 14:55 ` Ergus
2020-09-12 16:25 ` Ergus
2020-09-12 17:17 ` Eli Zaretskii
2020-09-12 17:21 ` Yuan Fu
2020-09-12 17:39 ` Eli Zaretskii
2020-09-12 18:36 ` Gregory Heytings via Emacs development discussions.
2020-09-12 20:05 ` Ergus
2020-09-13 0:01 ` Dmitry Gutov
2020-09-13 2:35 ` Ergus
2020-09-13 17:56 ` Dmitry Gutov
2020-09-13 22:10 ` Gregory Heytings via Emacs development discussions.
2020-09-14 11:20 ` Thibaut Verron
2020-09-14 23:42 ` E
2020-09-15 7:40 ` Ergus
2020-09-15 23:40 ` E
2020-09-15 12:10 ` Stephen Leake
2020-09-15 12:22 ` Thibaut Verron
2020-09-15 23:33 ` E
2020-09-13 18:01 ` Dmitry Gutov
2020-09-13 18:20 ` Tim Van den Langenbergh
2020-09-13 21:10 ` Ergus
2020-09-13 7:14 ` Gregory Heytings via Emacs development discussions.
2020-09-13 14:04 ` Eli Zaretskii
2020-09-13 16:38 ` John Yates
2020-09-13 16:51 ` Eli Zaretskii
2020-09-13 17:39 ` Dmitry Gutov
2020-09-14 12:41 ` John Yates
2020-09-14 15:28 ` Eli Zaretskii
2020-09-15 1:42 ` John Yates
2020-09-15 7:00 ` Göktuğ Kayaalp
2020-09-16 3:30 ` John Yates
2020-09-16 10:14 ` Göktuğ Kayaalp
2020-09-15 14:15 ` Eli Zaretskii
2020-09-14 22:28 ` Dmitry Gutov
2020-09-13 17:47 ` Dmitry Gutov
2020-09-14 14:17 ` Gregory Heytings via Emacs development discussions.
2020-09-26 9:16 ` Elias Mårtenson
2020-09-26 9:31 ` Eli Zaretskii
2020-09-26 14:38 ` Drew Adams
2020-09-26 15:13 ` Eli Zaretskii
2020-09-26 16:33 ` Drew Adams
2020-09-26 16:39 ` Andreas Schwab
2020-09-26 16:57 ` Drew Adams
2020-09-26 16:01 ` Jean Louis
2020-09-12 11:02 ` Göktuğ Kayaalp
2020-09-12 12:12 ` Gregory Heytings via Emacs development discussions.
2020-09-14 10:52 ` Robert Pluim
2020-09-19 15:20 ` Interactive guide for new users (was: Re: Gather a list of confusions beginner tend to have) Eduardo Mercovich
2020-09-19 17:02 ` Drew Adams
2020-09-21 14:50 ` Eduardo Mercovich
2020-09-21 16:07 ` Drew Adams
2020-09-21 21:40 ` Eduardo Mercovich
2020-09-21 23:03 ` Drew Adams
2020-09-22 3:40 ` Richard Stallman
2020-09-22 9:06 ` Interactive guide for new users Philip K.
2020-09-23 3:40 ` Richard Stallman
2020-09-23 12:49 ` Philip K.
2020-09-24 1:32 ` Richard Stallman
2020-09-26 3:13 ` Okam
2020-09-22 14:06 ` Stefan Monnier
2020-09-28 9:24 ` Po Lu
2020-09-29 3:29 ` Richard Stallman
2020-09-19 17:16 ` Philip K.
2020-09-19 17:25 ` Eli Zaretskii
2020-09-19 18:09 ` Eduardo Mercovich
2020-09-19 18:39 ` Eli Zaretskii
2020-09-19 21:43 ` Eduardo Mercovich
2020-09-20 5:52 ` Eli Zaretskii
2020-09-21 22:15 ` Eduardo Mercovich
2020-09-22 13:56 ` Eli Zaretskii
2020-09-23 12:54 ` Eduardo Mercovich
2020-09-23 13:28 ` Caio Henrique
2020-09-23 13:42 ` Eduardo Mercovich
2020-09-23 14:16 ` Stefan Kangas
2020-09-23 14:58 ` Eli Zaretskii
2020-09-23 23:14 ` Yuan Fu
2020-09-30 13:20 ` Eduardo Mercovich
2020-09-30 14:11 ` Eli Zaretskii
2020-09-19 17:53 ` Eduardo Mercovich
2020-09-20 9:26 ` Philip K.
2020-09-21 21:48 ` Eduardo Mercovich
2020-09-11 6:45 ` Gather a list of confusions beginner tend to have Eli Zaretskii
2020-09-11 8:51 ` Dmitry Gutov
2020-09-11 8:59 ` Emanuel Berg via Emacs development discussions.
2020-09-11 13:52 ` Yuan Fu
2020-09-11 14:01 ` Eli Zaretskii
2020-09-11 14:27 ` Stefan Monnier
2020-09-09 2:01 ` Nick Savage
2020-09-09 14:48 ` Göktuğ Kayaalp
2020-09-10 2:36 ` Richard Stallman
2020-09-10 10:07 ` Göktuğ Kayaalp
2020-09-10 17:28 ` Drew Adams
2020-09-10 21:17 ` Göktuğ Kayaalp
[not found] <<875z8ortot.fsf@gkayaalp.com>
[not found] ` <<D09D40C2-FF5C-4D1B-A030-C710297C1AE0@gmail.com>
[not found] ` <<83lfhjkq0r.fsf@gnu.org>
[not found] ` <<8620B5CD-CA92-46BF-80A8-DBE7052F4CA6@gmail.com>
[not found] ` <<CADwFkm=GQqZ2e07QuC582T-MNhi1Xo4OPsMTYbQHH9gD7h6QnA@mail.gmail.com>
[not found] ` <<alpine.NEB.2.22.394.2009120917260453.23267@sdf.lonestar.org>
[not found] ` <<83d02re2uk.fsf@gnu.org>
2020-09-12 16:25 ` Interactive guide for new users Drew Adams
2020-09-13 4:34 ` Ihor Radchenko
-- strict thread matches above, loose matches on Subject: below --
2020-09-08 20:10 Gather a list of confusions beginner tend to have Göktuğ Kayaalp
2020-09-08 17:28 Yuan Fu
2020-09-10 11:51 ` Jean Louis
2020-09-10 12:51 ` tomas
2020-09-15 7:11 ` Andreas Röhler
2020-09-15 8:21 ` Robert Pluim
2020-09-15 10:13 ` Andreas Röhler
2020-09-15 10:34 ` Robert Pluim
2020-09-15 11:22 ` Göktuğ Kayaalp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8620B5CD-CA92-46BF-80A8-DBE7052F4CA6@gmail.com \
--to=casouri@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=self@gkayaalp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.