5 Commits

Author SHA1 Message Date
e3fdaa7f67 chore(release): 0.1.1 2023-04-23 12:06:23 +01:00
387f732f45 docs(readme): remove last commit time badge
This package is not likely to receive frequent updates, once fully
stable. So how long ago the last commit was does not indicate project
health.
2023-04-23 12:02:35 +01:00
7619fc6d91 fix(autoload): do not autoload advice-add calls
There's no need for yank and yank-pop to be adviced via an autoload, as
it means simply having the package installed will apply the advices.

Without autoloads on the advices, things still work as on first use of
yank-indent-mode or global-yank-indent-mode the advices will be applied.
2023-04-23 11:57:29 +01:00
e5daa2d525 chore(custom): remove needless :group property from defcustoms
Groups are tracked on a per-file basis with the
custom-current-group-alist variable, which is set by defgroup, and used
by defcustom to set the group property if it is not provided.
2023-04-23 11:55:03 +01:00
81ffe1ff28 docs(readme): add status badges and a bespoke yank-indent logo 2023-04-19 00:11:08 +01:00
4 changed files with 29 additions and 17 deletions

View File

@@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.1.1](https://github.com/jimeh/yank-indent/compare/v0.1.0...v0.1.1) (2023-04-23)
### Bug Fixes
* **autoload:** do not autoload advice-add calls ([7619fc6](https://github.com/jimeh/yank-indent/commit/7619fc6d910a93697eb74236344632c161d0dcd5))
## 0.1.0 (2023-04-18)

View File

@@ -1,5 +1,5 @@
<h1 align="center">
<img width="72px" src="https://github.com/emacs-mirror/emacs/raw/emacs-28.2/etc/images/icons/hicolor/scalable/apps/emacs.svg" alt="Logo"><br />
<img width="128px" src="https://raw.githubusercontent.com/jimeh/yank-indent/main/img/yank-indent.svg" alt="Logo"><br />
yank-indent
</h1>
@@ -9,7 +9,20 @@
</strong>
</p>
---
<p align="center">
<a href="https://github.com/jimeh/yank-indent/releases">
<img src="https://img.shields.io/github/v/tag/jimeh/yank-indent?label=release" alt="GitHub tag (latest SemVer)">
</a>
<a href="https://github.com/jimeh/yank-indent/issues">
<img src="https://img.shields.io/github/issues-raw/jimeh/yank-indent.svg?style=flat&logo=github&logoColor=white" alt="GitHub issues">
</a>
<a href="https://github.com/jimeh/yank-indent/pulls">
<img src="https://img.shields.io/github/issues-pr-raw/jimeh/yank-indent.svg?style=flat&logo=github&logoColor=white" alt="GitHub pull requests">
</a>
<a href="https://github.com/jimeh/yank-indent/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/jimeh/yank-indent.svg?style=flat" alt="License Status">
</a>
</p>
Do you often find yourself fixing the indentation of a code snippet right after
pasting it somewhere? Never again! yank-indent is the answer.

1
img/yank-indent.svg Normal file
View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 500 500" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"><g><path id="shadow" d="M220.4,29.01l39.112,-1.643c6.068,-13.723 -12.369,-30.63 -1.738,-24.626c1.849,1.044 37.535,30.776 38.854,33.759l17.321,2.536l100.598,-3.818c7.935,7.828 19.232,18.835 23.365,23.393c3.636,4.009 5.853,9.329 5.853,15.163l-0,403.641c-0,12.465 -10.12,22.585 -22.585,22.585l-303.18,-0c-5.892,-0 -11.26,-2.261 -15.283,-5.962c-4.488,-4.128 -15.062,-15.105 -24.195,-24.287l16.893,-395.977c-0,-12.465 10.12,-22.585 22.585,-22.585l102.4,-22.179Z" style="fill-opacity:0.08;"/><path id="clipboard" d="M421.585,51.594c0,-12.465 -10.12,-22.584 -22.585,-22.584l-303.18,-0c-12.465,-0 -22.585,10.119 -22.585,22.584l0,403.642c0,12.464 10.12,22.584 22.585,22.584l303.18,0c12.465,0 22.585,-10.12 22.585,-22.584l0,-403.642Z" style="fill:url(#_Linear1);"/><path id="paper-shadow" serif:id="paper shadow" d="M405.929,460.86l-290.944,-0l-13.047,-13.047l13.047,-351.348c-0,-13.467 10.934,-24.401 24.401,-24.401l245.747,-6.475c7.023,6.523 9.752,9.448 14.206,14.204c4.087,4.364 6.59,10.228 6.59,16.672l0,364.395Z" style="fill-opacity:0.08;"/><rect id="paper" x="101.938" y="100.767" width="290.944" height="347.046" style="fill:#fff;"/><path d="M327.648,59.017l40.833,0c13.467,0 24.401,10.934 24.401,24.402l0,17.348l-290.944,0l0,-17.348c0,-13.468 10.934,-24.402 24.401,-24.402l40.833,0l0,-19.595c0,-4.534 3.681,-8.214 8.214,-8.214l144.048,-0c4.534,-0 8.214,3.68 8.214,8.214l0,19.595Z" style="fill:#54575f;"/><path d="M219.823,30.314l7.072,-15.994c8.442,-19.093 32.588,-19.093 41.03,0l7.072,15.994l27.311,0c3.185,0 5.77,2.586 5.77,5.77l-0,27.529c-0,3.184 -2.585,5.77 -5.77,5.77l-109.796,-0c-3.184,-0 -5.77,-2.586 -5.77,-5.77l0,-27.529c0,-3.184 2.586,-5.77 5.77,-5.77l27.311,0Zm27.587,-25.936c-5.357,0 -9.706,4.349 -9.706,9.707c-0,5.357 4.349,9.706 9.706,9.706c5.357,-0 9.707,-4.349 9.707,-9.706c-0,-5.358 -4.35,-9.707 -9.707,-9.707Z" style="fill:#e9e9e9;"/><path d="M313.949,32.513c0,-3.601 -2.923,-6.524 -6.523,-6.524l-120.031,0c-3.601,0 -6.524,2.923 -6.524,6.524c0,3.6 2.923,6.523 6.524,6.523l120.031,0c3.6,0 6.523,-2.923 6.523,-6.523Z" style="fill:url(#_Linear2);"/><g><path d="M133.903,280.813l15.656,0l-0,127.679l-15.656,0l-0,-127.679Z" style="fill:#aaded6;"/><path d="M177.14,349.653l178.778,-0c2.759,-0 5,-2.241 5,-5c-0,-2.76 -2.241,-5 -5,-5l-178.79,-0l41.615,-41.458c1.955,-1.948 1.961,-5.116 0.014,-7.071c-1.948,-1.955 -5.116,-1.961 -7.071,-0.013l-50.19,50c-0.942,0.938 -1.472,2.214 -1.471,3.544c0,1.33 0.53,2.605 1.473,3.542l50.261,50c1.956,1.947 5.125,1.938 7.071,-0.018c1.946,-1.956 1.938,-5.125 -0.019,-7.071l-41.671,-41.455Z" style="fill:#8e90a6;"/></g><g><path d="M345.261,140.088l15.657,-0l-0,127.678l-15.657,0l0,-127.678Z" style="fill:#aaded6;"/><path d="M317.677,208.927l-178.777,0c-2.76,0 -5,-2.24 -5,-5c0,-2.76 2.24,-5 5,-5l178.79,0l-41.616,-41.458c-1.955,-1.947 -1.961,-5.116 -0.013,-7.071c1.947,-1.955 5.116,-1.961 7.071,-0.013l50.19,50c0.942,0.938 1.472,2.214 1.471,3.544c-0,1.33 -0.531,2.605 -1.474,3.543l-50.26,50c-1.957,1.946 -5.125,1.938 -7.071,-0.019c-1.946,-1.956 -1.938,-5.124 0.018,-7.071l41.671,-41.455Z" style="fill:#8e90a6;"/></g></g><defs><linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-7.21743e-14,448.811,-448.811,-7.21743e-14,247.41,29.0095)"><stop offset="0" style="stop-color:#f1c58f;stop-opacity:1"/><stop offset="1" style="stop-color:#f0c48f;stop-opacity:1"/></linearGradient><linearGradient id="_Linear2" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(6.22035e-16,13.0468,-10.1586,7.98888e-16,255.029,25.9893)"><stop offset="0" style="stop-color:#f2f2f2;stop-opacity:1"/><stop offset="0.14" style="stop-color:#ededed;stop-opacity:1"/><stop offset="0.2" style="stop-color:#e2e3e3;stop-opacity:1"/><stop offset="0.25" style="stop-color:#d8d9d9;stop-opacity:1"/><stop offset="0.7" style="stop-color:#a6a7a7;stop-opacity:1"/><stop offset="0.87" style="stop-color:#9e9f9f;stop-opacity:1"/><stop offset="1" style="stop-color:#7f7f7f;stop-opacity:1"/></linearGradient></defs></svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -52,8 +52,7 @@ If the yanked region contains more characters than the value
specified by `yank-indent-threshold', the automatic indentation
will not occur. This helps prevent performance issues when
working with large blocks of text."
:type 'number
:group 'yank-indent)
:type 'number)
(defcustom yank-indent-derived-modes '(prog-mode tex-mode)
"Derived major modes where `yank-indent-mode' should be enabled.
@@ -64,8 +63,7 @@ listed in this variable. This is useful when you want to enable
`yank-indent-mode' for all modes that inherit from a specific
mode, such as `prog-mode' for programming modes or `text-mode'
for text editing modes."
:type '(repeat symbol)
:group 'yank-indent)
:type '(repeat symbol))
(defcustom yank-indent-exact-modes '()
"Major modes where `yank-indent-mode' should be enabled.
@@ -77,8 +75,7 @@ will not be activated in modes derived from those listed here.
Use this variable to list specific modes where you want
`yank-indent-mode' to be enabled without affecting their derived
modes."
:type '(repeat symbol)
:group 'yank-indent)
:type '(repeat symbol))
(defcustom yank-indent-excluded-modes '(cmake-ts-mode
coffee-mode
@@ -103,8 +100,7 @@ modes. This list takes precedence over
`yank-indent-derived-modes' and `yank-indent-exact-modes'. Use
this variable to exclude specific modes and their derived modes
from having `yank-indent-mode' enabled."
:type '(repeat symbol)
:group 'yank-indent)
:type '(repeat symbol))
(defun yank-indent--should-enable-p ()
"Return non-nil if current mode should be indented."
@@ -121,8 +117,7 @@ When enabled, this mode indents the yanked region according to
the current mode's indentation rules, provided that the region
size is less than or equal to `yank-indent-threshold' and no
prefix argument is given during yanking."
:lighter " YI"
:group 'yank-indent)
:lighter " YI")
(defun yank-indent--enable ()
"Enable `yank-indent-mode' if the current buffer meets the criteria."
@@ -132,8 +127,7 @@ prefix argument is given during yanking."
;;;###autoload
(define-globalized-minor-mode global-yank-indent-mode
yank-indent-mode
yank-indent--enable
:group 'yank-indent)
yank-indent--enable)
(defun yank-indent--after-yank-advice (&optional _)
"Conditionally indent the region (yanked text) after yanking.
@@ -156,10 +150,7 @@ functions."
(if (<= (- end beg) yank-indent-threshold)
(indent-region beg end)))))
;;;###autoload
(advice-add #'yank :after #'yank-indent--after-yank-advice)
;;;###autoload
(advice-add #'yank-pop :after #'yank-indent--after-yank-advice)
(provide 'yank-indent)