Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yitang committed Jun 4, 2021
1 parent b2c0916 commit 39868d2
Show file tree
Hide file tree
Showing 14 changed files with 1,713 additions and 728 deletions.
31 changes: 24 additions & 7 deletions docs/completion_and_selection.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
========================
Completion and Selection
========================




Helm - Fuzzy Match
------------------



Helm and fuzzy match makes selection a lot easier. in

.. code-block:: scheme
.. code:: common-lisp
(require 'helm)
(require 'helm-config)
Expand Down Expand Up @@ -48,6 +50,18 @@ Helm and fuzzy match makes selection a lot easier. in
(add-to-list 'golden-ratio-inhibit-functions 'pl/helm-alive-p)
(helm-mode 1)
(defun yt/helm-copy-unmarked-to-buffer ()
(interactive)
(with-helm-buffer
(helm-mark-all)
(cl-loop for cand in (helm-marked-candidates)
do (with-helm-current-buffer
(insert cand "\n")))))
;; by default, Cc Ci copy marked to buffer.
(define-key helm-map (kbd "C-c C-i") 'helm-copy-unmmarked-to-buffer)
(setq helm-ff-guess-ffap-urls nil)
Multi-Cursor & Helm-swoop - Multiple Selection
-----------------------------------------------

Expand All @@ -59,11 +73,14 @@ the normal way to do that is via searching and replacing.
that is highlighted and then modify all of them at the same time.


.. code-block:: scheme
.. code:: common-lisp
(require 'multiple-cursors)
(global-set-key (kbd "C-S-<right>") 'mc/mark-next-like-this)
(global-set-key (kbd "C-S-<left>") 'mc/mark-previous-like-this)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
;; (global-set-key (kbd "C-S-<right>") 'mc/mark-next-like-this)
;; (global-set-key (kbd "C-S-<left>") 'mc/mark-previous-like-this)
;; (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
;; (global-set-key (kbd "C->") 'mc/mark-next-like-this)
;; (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
Expand All @@ -73,7 +90,7 @@ that is highlighted and then modify all of them at the same time.
I usually use ``multi-cursor`` with ``helm-swoop``, which allows me to search, and then narrow down all
the occurrences in a temporary buffer, and then start to edit.

.. code-block:: scheme
.. code:: common-lisp
(require 'helm-swoop)
;; Change the keybinds to whatever you like :)
Expand Down Expand Up @@ -106,7 +123,7 @@ jump directly to there places, just by pressing 4-5 keys. The places
can be a character, line, or word. Personally I found it is really
efficient to jump to a word when editing.

.. code-block:: scheme
.. code:: common-lisp
(global-set-key (kbd "C-c w") 'ace-jump-word-mode)
Expand All @@ -132,7 +149,7 @@ syntax around a word, I press ``C-=`` to select it, then insert quote or
forward slash, the whole word will be warped inside of quote or
forward flash.

.. code-block:: scheme
.. code:: common-lisp
(require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)
41 changes: 13 additions & 28 deletions docs/emacs_lisp_programming.rst
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
======================
Emacs Lisp Programming
======================



use org-struct mode for emacs-lisp.

.. code-block:: scheme
(add-hook 'emacs-lisp-mode-hook '(lambda ()
(turn-on-orgstruct)
(setq-local orgstruct-heading-prefix-regexp ";;;; ")))
(rep "a" 3) --> "aaa"

.. code-block:: scheme
(defun yt/lisp-rep (arg n)
(apply 'concat (make-list n arg)))

Org-Mode API
------------
Expand All @@ -27,20 +12,20 @@ Org-Mode API

Get the link to current headline as an external link.

.. code-block:: scheme
.. code:: common-lisp
(defun yt/org-get-heading-link ()
(interactive)
(let* ((file-name (file-truename buffer-file-name))
(headline (org-heading-components))
(level (nth 0 headline))
(title (nth 4 headline))
(link (concat file-name
"::"
"*" ;; (yt/lisp-rep "*" level)
title)))
(headline (org-heading-components))
(level (nth 0 headline))
(title (nth 4 headline))
(link (concat file-name
"::"
"*" ;; (yt/lisp-rep "*" level)
title)))
(kill-new (concat "[["
link
"]["
title
"]]"))))
link
"]["
(concat "headline: " title)
"]]"))))

0 comments on commit 39868d2

Please sign in to comment.