Compare commits

..

No commits in common. "c740b8ae80843a5894f2b39fd57396163637652e" and "eccc95a5f784d72112a2652365d42eccef9adaa7" have entirely different histories.

27 changed files with 866 additions and 49 deletions

6
.gitmodules vendored
View file

@ -0,0 +1,6 @@
[submodule "external-packages/nerd-icons-dired"]
path = external-packages/nerd-icons-dired
url = https://github.com/rainstormstudio/nerd-icons-dired.git
[submodule "external-packages/ligature.el"]
path = external-packages/ligature.el
url = https://github.com/mickeynp/ligature.el.git

1
banners/1row.txt Normal file
View file

@ -0,0 +1 @@
[- |\/| /\ ( _\~

14
banners/3d_diagonal.txt Normal file
View file

@ -0,0 +1,14 @@
____
,---,. ,' , `. ,---, ,----.. .--.--.
,' .' | ,-+-,.' _ | ' .' \ / / \ / / '.
,---.' | ,-+-. ; , || / ; '. | : :| : /`. /
| | .' ,--.'|' | ;|: : \ . | ;. /; | |--`
: : |-,| | ,', | ':: | /\ \ . ; /--` | : ;_
: | ;/|| | / | | ||| : ' ;. : ; | ; \ \ `.
| : .'' | : | : |,| | ;/ \ \| : | `----. \
| | |-,; . | ; |--' ' : | \ \ ,'. | '___ __ \ \ |
' : ;/|| : | | , | | ' '--' ' ; : .'| / /`--' /
| | \| : ' |/ | : : ' | '/ :'--'. /
| : .'; | |`-' | | ,' | : / `--'---'
| | ,' | ;/ `--'' \ \ .'
`----' '---' `---`

21
banners/alpha.txt Normal file
View file

@ -0,0 +1,21 @@
_____ _____ _____ _____ _____
/\ \ /\ \ /\ \ /\ \ /\ \
/::\ \ /::\____\ /::\ \ /::\ \ /::\ \
/::::\ \ /::::| | /::::\ \ /::::\ \ /::::\ \
/::::::\ \ /:::::| | /::::::\ \ /::::::\ \ /::::::\ \
/:::/\:::\ \ /::::::| | /:::/\:::\ \ /:::/\:::\ \ /:::/\:::\ \
/:::/__\:::\ \ /:::/|::| | /:::/__\:::\ \ /:::/ \:::\ \ /:::/__\:::\ \
/::::\ \:::\ \ /:::/ |::| | /::::\ \:::\ \ /:::/ \:::\ \ \:::\ \:::\ \
/::::::\ \:::\ \ /:::/ |::|___|______ /::::::\ \:::\ \ /:::/ / \:::\ \ ___\:::\ \:::\ \
/:::/\:::\ \:::\ \ /:::/ |::::::::\ \ /:::/\:::\ \:::\ \ /:::/ / \:::\ \ /\ \:::\ \:::\ \
/:::/__\:::\ \:::\____\/:::/ |:::::::::\____\/:::/ \:::\ \:::\____\/:::/____/ \:::\____\/::\ \:::\ \:::\____\
\:::\ \:::\ \::/ /\::/ / ~~~~~/:::/ /\::/ \:::\ /:::/ /\:::\ \ \::/ /\:::\ \:::\ \::/ /
\:::\ \:::\ \/____/ \/____/ /:::/ / \/____/ \:::\/:::/ / \:::\ \ \/____/ \:::\ \:::\ \/____/
\:::\ \:::\ \ /:::/ / \::::::/ / \:::\ \ \:::\ \:::\ \
\:::\ \:::\____\ /:::/ / \::::/ / \:::\ \ \:::\ \:::\____\
\:::\ \::/ / /:::/ / /:::/ / \:::\ \ \:::\ /:::/ /
\:::\ \/____/ /:::/ / /:::/ / \:::\ \ \:::\/:::/ /
\:::\ \ /:::/ / /:::/ / \:::\ \ \::::::/ /
\:::\____\ /:::/ / /:::/ / \:::\____\ \::::/ /
\::/ / \::/ / \::/ / \::/ / \::/ /
\/____/ \/____/ \/____/ \/____/ \/____/

6
banners/ansi_shadow.txt Normal file
View file

@ -0,0 +1,6 @@
███████╗███╗ ███╗ █████╗ ██████╗███████╗
██╔════╝████╗ ████║██╔══██╗██╔════╝██╔════╝
█████╗ ██╔████╔██║███████║██║ ███████╗
██╔══╝ ██║╚██╔╝██║██╔══██║██║ ╚════██║
███████╗██║ ╚═╝ ██║██║ ██║╚██████╗███████║
╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚══════╝

BIN
banners/barbiemacs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

1
banners/binary.txt Normal file
View file

@ -0,0 +1 @@
01000101 01001101 01000001 01000011 01010011

10
banners/bloody.txt Normal file
View file

@ -0,0 +1,10 @@
▓█████ ███▄ ▄███▓ ▄▄▄ ▄████▄ ██████
▓█ ▀ ▓██▒▀█▀ ██▒▒████▄ ▒██▀ ▀█ ▒██ ▒
▒███ ▓██ ▓██░▒██ ▀█▄ ▒▓█ ▄ ░ ▓██▄
▒▓█ ▄ ▒██ ▒██ ░██▄▄▄▄██ ▒▓▓▄ ▄██▒ ▒ ██▒
░▒████▒▒██▒ ░██▒ ▓█ ▓██▒▒ ▓███▀ ░▒██████▒▒
░░ ▒░ ░░ ▒░ ░ ░ ▒▒ ▓▒█░░ ░▒ ▒ ░▒ ▒▓▒ ▒ ░
░ ░ ░░ ░ ░ ▒ ▒▒ ░ ░ ▒ ░ ░▒ ░ ░
░ ░ ░ ░ ▒ ░ ░ ░ ░
░ ░ ░ ░ ░░ ░ ░

19
banners/doom.txt Normal file
View file

@ -0,0 +1,19 @@
================= =============== =============== ======== ========
\\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //
||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||
|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||
||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||
|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\ . . . . ||
||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\_ . .|. .||
|| . _|| || || || || ||_ . || || . _|| || || || |\ `-_/| . ||
||_-' || .|/ || || \|. || `-_|| ||_-' || .|/ || || | \ / |-_.||
|| ||_-' || || `-_|| || || ||_-' || || | \ / | `||
|| `' || || `' || || `' || || | \ / | ||
|| .===' `===. .==='.`===. .===' /==. | \/ | ||
|| .==' \_|-_ `===. .===' _|_ `===. .===' _-|/ `== \/ | ||
|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \/ | ||
|| .==' _-' '-__\._-' '-_./__-' `' |. /| | ||
||.==' _-' `' | /==.||
==' _-' E M A C S \/ `==
\ _-' `-_ /
`'' ``'

11
banners/electronic.txt Normal file
View file

@ -0,0 +1,11 @@
▄▄▄▄▄▄▄▄▄▄▄ ▄▄ ▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░░▌ ▐░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░█▀▀▀▀▀▀▀▀▀ ▐░▌░▌ ▐░▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀
▐░▌ ▐░▌▐░▌ ▐░▌▐░▌▐░▌ ▐░▌▐░▌ ▐░▌
▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░█▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌ ▐░░░░░░░░░░░▌
▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▀ ▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▀▀▀▀▀▀▀▀▀█░▌
▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌
▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄█░▌
▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀

1
banners/morse.txt Normal file
View file

@ -0,0 +1 @@
. -- .- -.-. ...

1
banners/octal.txt Normal file
View file

@ -0,0 +1 @@
105 115 101 103 123

6
banners/peaks_slant.txt Normal file
View file

@ -0,0 +1,6 @@
_/\/\/\/\/\/\__/\/\______/\/\______/\/\________/\/\/\/\/\____/\/\/\/\/\_
_/\____________/\/\/\__/\/\/\____/\/\/\/\____/\/\__________/\/\_________
_/\/\/\/\/\____/\/\/\/\/\/\/\__/\/\____/\/\__/\/\____________/\/\/\/\___
_/\/\__________/\/\__/\__/\/\__/\/\/\/\/\/\__/\/\__________________/\/\_
_/\/\/\/\/\/\__/\/\______/\/\__/\/\____/\/\____/\/\/\/\/\__/\/\/\/\/\___
________________________________________________________________________

7
banners/relief.txt Normal file
View file

@ -0,0 +1,7 @@
_______________________________________________________
/~~~~~~~~\_/~~\__/~~\__/~~~~~~\___/~~~~~~\___/~~~~~~\__
/~~\_______/~~~\/~~~\_/~~\__/~~\_/~~\__/~~\_/~~\_______
/~~~~~~\___/~~~~~~~~\_/~~~~~~~~\_/~~\________/~~~~~~\__
/~~\_______/~~\__/~~\_/~~\__/~~\_/~~\__/~~\_______/~~\_
/~~~~~~~~\_/~~\__/~~\_/~~\__/~~\__/~~~~~~\___/~~~~~~\__
_______________________________________________________

1
banners/rot13.txt Normal file
View file

@ -0,0 +1 @@
RZNPF

6
banners/runic.txt Normal file
View file

@ -0,0 +1,6 @@
|\ /| |\ /| |\ | /
| \ / | | \/ | | \ | /
| \/ | | /\ | |\ | /____
| | |/ \| | \ |\ /
| | | | | | \ /
| | | | | | \ /

6
banners/star_wars.txt Normal file
View file

@ -0,0 +1,6 @@
_______ .___ ___. ___ ______ _______.
| ____|| \/ | / \ / | / |
| |__ | \ / | / ^ \ | ,----' | (----`
| __| | |\/| | / /_\ \ | | \ \
| |____ | | | | / _____ \ | `----.----) |
|_______||__| |__| /__/ \__\ \______|_______/

7
banners/the_edge.txt Normal file
View file

@ -0,0 +1,7 @@
▄███▄ █▀▄▀█ ██ ▄█▄ ▄▄▄▄▄
█▀ ▀ █ █ █ █ █ █▀ ▀▄ █ ▀▄
██▄▄ █ ▄ █ █▄▄█ █ ▀ ▄ ▀▀▀▀▄
█▄ ▄▀ █ █ █ █ █▄ ▄▀ ▀▄▄▄▄▀
▀███▀ █ █ ▀███▀
▀ █

7
banners/this.txt Normal file
View file

@ -0,0 +1,7 @@
▄▀▀█▄▄▄▄ ▄▀▀▄ ▄▀▄ ▄▀▀█▄ ▄▀▄▄▄▄ ▄▀▀▀▀▄
▐ ▄▀ ▐ █ █ ▀ █ ▐ ▄▀ ▀▄ █ █ ▌ █ █ ▐
█▄▄▄▄▄ ▐ █ █ █▄▄▄█ ▐ █ ▀▄
█ ▌ █ █ ▄▀ █ █ ▀▄ █
▄▀▄▄▄▄ ▄▀ ▄▀ █ ▄▀ ▄▀▄▄▄▄▀ █▀▀▀
█ ▐ █ █ ▐ ▐ █ ▐ ▐
▐ ▐ ▐ ▐

6
banners/ticks.txt Normal file
View file

@ -0,0 +1,6 @@
_/\/\/\/\/\/\__/\/\______/\/\______/\/\________/\/\/\/\/\____/\/\/\/\/\_
_/\____________/\/\/\__/\/\/\____/\/\/\/\____/\/\__________/\/\_________
_/\/\/\/\/\____/\/\/\/\/\/\/\__/\/\____/\/\__/\/\____________/\/\/\/\___
_/\/\__________/\/\__/\__/\/\__/\/\/\/\/\/\__/\/\__________________/\/\_
_/\/\/\/\/\/\__/\/\______/\/\__/\/\____/\/\____/\/\/\/\/\__/\/\/\/\/\___
________________________________________________________________________

View file

@ -0,0 +1,6 @@
_/\/\/\/\/\/\__/\/\______/\/\______/\/\________/\/\/\/\/\____/\/\/\/\/\_
_/\____________/\/\/\__/\/\/\____/\/\/\/\____/\/\__________/\/\_________
_/\/\/\/\/\____/\/\/\/\/\/\/\__/\/\____/\/\__/\/\____________/\/\/\/\___
_/\/\__________/\/\__/\__/\/\__/\/\/\/\/\/\__/\/\__________________/\/\_
_/\/\/\/\/\/\__/\/\______/\/\__/\/\____/\/\____/\/\/\/\/\__/\/\/\/\/\___
________________________________________________________________________

0
diary Normal file
View file

@ -0,0 +1 @@
Subproject commit 6ac1634612dbd42f7eb81ecaf022bd239aabb954

@ -0,0 +1 @@
Subproject commit c1c73488630cc1d19ce1677359f614122ae4c1b9

View file

@ -0,0 +1,669 @@
;;; sr-speedbar.el --- Same frame speedbar
;; Author: Sebastian Rose <sebastian_rose@gmx.de>
;; Maintainer: Sebastian Rose <sebastian_rose@gmx.de>
;; Peter Lunicks <plunix@users.sourceforge.net>
;; Copyright (C) 2008, 2009, Sebastian Rose, all rights reserved.
;; Copyright (C) 2008, 2009, Andy Stewart, all rights reserved.
;; Copyright (C) 2009, Peter Lunicks, all rights reversed.
;; Created: 2008
;; Version: 20210922
;; X-Original-Version: 0.1.10
;; Last-Updated: 2021-09-22
;; URL: http://www.emacswiki.org/emacs/download/sr-speedbar.el
;; Keywords: speedbar, sr-speedbar.el
;; Compatibility: GNU Emacs 22 ~ GNU Emacs 25
;;
;; Features required by this library:
;;
;; `speedbar' `advice' `cl-lib'
;;
;;; This file is NOT part of GNU Emacs
;;; License
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;; Commentary:
;;
;; The sr-speedbar.el was created just because I could not believe what I
;; read on http://www.emacswiki.org/cgi-bin/wiki/Speedbar. They wrote there
;; that it is not possible to show the speedbar in the same frame. But, as
;; we all know, ecb had this already. So I started as some kind of joke :)
;; But when I found it useful and use it all the time.
;;
;; Now you type windows key with 's' (`s-s' in Emacs) will show the speedbar
;; in an extra window, same frame. You can customize the initial width of the
;; speedbar window.
;;
;; Below are commands you can use:
;;
;; `sr-speedbar-open' Open `sr-speedbar' window.
;; `sr-speedbar-close' Close `sr-speedbar' window.
;; `sr-speedbar-toggle' Toggle `sr-speedbar' window.
;; `sr-speedbar-select-window' Select `sr-speedbar' window.
;; `sr-speedbar-refresh-turn-on' Turn on refresh speedbar content.
;; `sr-speedbar-refresh-turn-off' Turn off refresh speedbar content.
;; `sr-speedbar-refresh-toggle' Toggle refresh speedbar content.
;;
;; Enjoy! ;)
;;
;;; Installation:
;;
;; Copy sr-speedbar.el to your load-path and add to your ~/.emacs
;;
;; (require 'sr-speedbar)
;; (global-set-key (kbd "s-s") 'sr-speedbar-toggle)
;;
;; ... or any key binding you like.
;;
;;; Customize:
;;
;; M-x customize-group RET sr-speedbar RET
;;; Change log:
;; * 04 July 2022:
;; * Doerthous <doerthous@gmail.com>
;; * Add support that allows speedbar window split from `selected-window'
;; or `frame-root-window'.
;; * define `sr-speedbar-use-frame-root-window'.
;;
;; * 22 Sep 2021:
;; * Vasilij Schneidermann <mail@vasilij.de>
;; * Fix cl deprecation warning
;;
;; * 07 Jan 2021:
;; * Jacob First <jacob.first@member.fsf.org>
;; * Fix inconsistent window selection when opening speedbar on the right side vs. on the left.
;;
;; * 16 Jun 2020:
;; * Bo Yao <icerove@gmail.com> (submitted by him on 16 Jul 2018 to the Emacs Orphanage mirror version at GitHub)
;; * Always open file in most recently selected window (the one before switching to
;; sr-speedbar).
;;
;; * 25 Oct 2016:
;; * Hong Xu <hong@topbug.net>
;; * Fix compilation warning when `helm-alive-p' is not defined.
;;
;; * 04 Aug 2015:
;; * Tamas Levai <levait@tmit.bme.hu>:
;; * fix compilation warnings
;;
;; * 15 Sep 2014:
;; * Tu, Do Hoang <tuhdo1710@gmail.com>
;; * define `sr-speedbar-handle-other-window-advice' and `ad-advised-definition-p'
;; before defining `sr-speedbar-skip-other-window-p'. Othewise, `sr-speedbar'
;; fails to load at this stage.
;;
;; * Do not used advised `pop-to-buffer' when helm window is
;; alive. Otherwise another horizontal buffer is created inside
;; Helm buffer.
;;
;; * Uwe Koloska <kolewu@koloro.de>
;; * define `ad-advised-definition-p' only if it's not defined
;; fixes an error on Emacs 24.3 where `macrop' ist still named
;; `ad-macro-p'
;;
;; * 03 Aug 2014:
;; * Reuben Thomas <rrt@sc3d.org>:
;; * Reduce to a single width preference, and make it work properly on
;; startup.
;; * Miscellaneous tidying of documentation and comments.
;; * Remove version constant; should be using the package header, and it
;; was already way out of date.
;;
;; * 08 Jun 2014:
;; * Gregor Zattler:
;; * test if symbol `ad-advised-definition-p' is defined,
;; since Christian Brassats version test failed on emacs
;; 23.3.91.1
;;
;; * 05 May 2014:
;; * Christian Brassat:
;; * `ad-advised-definition-p' is not supported since Emacs 24.4.
;;
;; * 09 Mar 2013:
;; * Tharre:
;; * Remove Emacs 21 compatibility code as it fails to compile on Emacs 24.
;;
;; * 20 July 2009:
;; * Peter Lunicks:
;; * Add new option `sr-speedbar-right-side' to control which
;; side of the frame the speedbar appears on.
;;
;; * 18 Feb 2009:
;; * Andy Stewart:
;; * Fix bug between ECB and `sr-speedbar-close'.
;;
;; * 29 Jan 2009:
;; * Andy Stewart:
;; * Fix doc.
;;
;; * 13 Jan 2009:
;; * Andy Stewart:
;; * Use `emacs-major-version' instead comment for Emacs 21 compatibility.
;; * Rewrite advice for `pop-to-buffer' to avoid `pop-to-buffer' not effect
;; when have many dedicated window in current frame.
;; * Rewrite advice for `delete-other-windows' to avoid use common variable
;; `delete-protected-window-list' and use `window-dedicated-p' instead.
;; Remove variable `delete-protected-window-list' and function
;; `sr-speedbar-dedicated-match-protected-window-p'.
;;
;; * 04 Jan 2009:
;; * Andy Stewart:
;; * Add new option `sr-speedbar-auto-refresh' control refresh content.
;; * Add new functions:
;; `sr-speedbar-refresh-turn-on',
;; `sr-speedbar-refresh-turn-off',
;; `sr-speedbar-refresh-toggle'.
;; * Fix doc.
;;
;; * 30 Dec 2008:
;; * Andy Stewart:
;; * Rewrite advice for `delete-other-windows' for fix the bug
;; with window configuration save and revert.
;; * Rewrite advice for `delete-window', now just remember window
;; width before deleted, and can use `delete-window' do same effect
;; as command `sr-speedbar-close'.
;; * Add new option `sr-speedbar-max-width'.
;; Remember window width before hide, except larger than value of
;; `sr-speedbar-max-width'.
;; * Add new variable `delete-protected-window-list', for protected
;; special window don't deleted.
;; This variable is common for any extension that use dedicated
;; window.
;; * Fix doc.
;;
;; * 29 Dec 2008:
;; * Andy Stewart:
;; * Pick-up and refactory code that use `buffer-live-p' or `window-live-p',
;; and replace with `sr-speedbar-buffer-exist-p' and
;; `sr-speedbar-window-exist-p'.
;; * Rename some function with prefix `sr-speedbar-' to avoid
;; conflict with other functions.
;; * Pick-up the code that handle advice for `other-window',
;; and replace with function `sr-speedbar-handle-other-window-advice'.
;; * Clean up code, make more clear.
;;
;; * 21 Dec 2008:
;; * Andy Stewart:
;; * Fix the bug `sr-speedbar-open' and `sr-speedbar-close'.
;; * Fix doc.
;;
;; * 20 Dec 2008
;; * Andy Stewart:
;; * Fix `ad-advised-definition-p' error.
;; * Fix doc.
;;
;; * 17 Dec 2008
;; * Andy Stewart:
;; * Add new option `sr-speedbar-skip-other-window-p' and new advice
;; for `other-window', make user skip select `sr-speedbar' window
;; when use command `other-window'.
;; * Fix the name of advice, make more clear.
;; * Fix the bug `sr-speedbar-select-window' when no live window exist.
;; * Fix doc.
;;
;; * 16 Dec 2008:
;; * Andy Stewart:
;; * Fix the bug of `sr-speedbar-refresh', use `default-directory'
;; get refresh directory instead through function in `dired'.
;; * Fix `window-live-p' bug, check window valid value before use
;; `window-live-p' test `sr-speedbar-window'.
;; * Fix `buffer-live-p' bug, check buffer valid value before use
;; `buffer-live-p' test `speedbar-buffer'.
;; * Add advice `pop-to-buffer' to make function `display-buffer'
;; can pop-up window when just have two windows (one is `sr-speedbar'
;; window) in current frame.
;; * Add group `sr-speedbar'.
;; More better customize interface through `customize-group'.
;;
;; * 28 Sep 2008:
;; * Andy Stewart:
;; * Fix a bug, when `sr-speedbar-toggle' many times, window width
;; will increment automatically.
;; * Use around advices replace, make code simple.
;; * Use `sr-speedbar-open' replace `sr-speedbar-no-separate-frame'.
;; * Clean up code.
;;
;; * 28 Sep 2008:
;; * Sebastian:
;; * set `sr-speedbar-delete-windows' to nil to avoid
;; the removal of other windows.
;;
;; * 26 Jun 2008:
;; * Sebastian:
;; * Added Andy Stewart's patch to refresh the speedbar's contents.
;; Thanks for this one!
;;
;; * Init:
;; * Sebastian:
;; * Added some lines to get it working:
;; * splitting the window and remember it,
;; * changing the way speedbar finds a file.
;; * File view of speedbar is now working all right.
;; * C-x 1 in other window deletes speedbar-window, just calling
;; M-x sr-speedbar-no-separate-frame again is fine now.
;; * Toggle speedbar works, width is save when toggling.
;; * Recalculate speedbar width if window-width - speedbar-width <= 0
;; * Speedbar window is now dedicated to speedbar-buffer.
;;
;;; Acknowledgements:
;;
;; All emacsers ... :)
;;
;;; Bug
;;
;;
;;; TODO
;;
;;
;;
;;; Require
(require 'speedbar)
(require 'advice)
(require 'cl-lib)
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; User Customization ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defgroup sr-speedbar nil
"Same frame speedbar."
:group 'speedbar)
(defcustom sr-speedbar-default-width 40
"Initial width of `sr-speedbar-window' under window system."
:type 'integer
:group 'sr-speedbar)
(defcustom sr-speedbar-max-width 50
"The max width limit that window allowed.
Default, if hide `sr-speedbar' window will remember
window width, except the window width larger than
this value."
:type 'integer
:group 'sr-speedbar)
(defcustom sr-speedbar-auto-refresh t
"Automatically refresh speedbar content when changed directory.
Default is t."
:type 'boolean
:set (lambda (symbol value)
(set symbol value))
:group 'sr-speedbar)
(defcustom sr-speedbar-right-side t
"Show the speedbar to the right side of the current window.
If nil, the speedbar will appear on the left.
Default is t."
:type 'boolean
:set (lambda (symbol value)
(set symbol value))
:group 'sr-speedbar)
(defcustom sr-speedbar-delete-windows nil
"Allow the speedbar to delete other windows before showing up.
If nil, speedbar will not touch your window configuration.
Otherwise `delete-other-windows' will be called before showing
the speedbar.
Default is nil."
:type 'boolean
:group 'sr-speedbar)
(defcustom sr-speedbar-use-frame-root-window nil
"Open speedbar based on selected window or frame root window.
If nil, the speedbar window will split from `selected-window'.
Otherwise `frame-root-window'.
Default is nil."
:type 'boolean
:set (lambda (symbol value)
(set symbol value))
:group 'sr-speedbar)
(if (not (fboundp 'ad-advised-definition-p))
(defun ad-advised-definition-p (definition)
"Return non-nil if DEFINITION was generated from advice information."
(if (or (ad-lambda-p definition)
(macrop definition)
(ad-compiled-p definition))
(let ((docstring (ad-docstring definition)))
(and (stringp docstring)
(get-text-property 0 'dynamic-docstring-function docstring))))))
(defun sr-speedbar-handle-other-window-advice (activate)
"Handle advice for function `other-window'.
If ACTIVATE is `non-nil' enable advice `sr-speedbar-other-window-advice'.
Otherwise disable it."
(if activate
(ad-enable-advice 'other-window 'after 'sr-speedbar-other-window-advice)
(ad-disable-advice 'other-window 'after 'sr-speedbar-other-window-advice))
(ad-activate 'other-window))
(defcustom sr-speedbar-skip-other-window-p nil
"Whether skip `sr-speedbar' window with `other-window'.
Default, can use `other-window' select window in cyclic
ordering of windows. But sometimes we don't want select
`sr-speedbar' window use `other-window'.
Just want make `sr-speedbar' window as a view sidebar.
So please turn on this option if you want skip
`sr-speedbar' window with `other-window'.
Default is nil."
:type 'boolean
:set (lambda (symbol value)
(set symbol value)
(if (fboundp 'ad-advised-definition-p)
(when (ad-advised-definition-p 'other-window)
(sr-speedbar-handle-other-window-advice value))
(when (ad-is-advised 'other-window)
(sr-speedbar-handle-other-window-advice value))))
:group 'sr-speedbar)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Constant ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst sr-speedbar-buffer-name "*SPEEDBAR*"
"The buffer name of sr-speedbar.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar sr-speedbar-width sr-speedbar-default-width
"Initial width of speedbar-window.")
(defvar sr-speedbar-window nil
"Speedbar window.")
(defvar sr-speedbar-last-refresh-dictionary nil
"The last refresh dictionary record of 'sr-speedbar-refresh'.")
(eval-when-compile
(defvar ecb-activated-window-configuration nil)
(defun ecb-activate ())
(defun ecb-deactivate ()))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Interactive functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;###autoload
(defun sr-speedbar-toggle ()
"Toggle sr-speedbar window.
Toggle visibility of sr-speedbar by resizing
the `sr-speedbar-window' to a minimal width
or the last width when visible.
Use this function to create or toggle visibility
of a speedbar-window. It will be created if necessary."
(interactive)
(if (sr-speedbar-exist-p)
(sr-speedbar-close)
(sr-speedbar-open)))
;;;###autoload
(defun sr-speedbar-open ()
"Create `sr-speedbar' window."
(interactive)
(if (not (sr-speedbar-exist-p))
(let ((current-window (selected-window)))
;; Ensure only one window is there
;; when `sr-speedbar-delete-windows' is non-nil
(if sr-speedbar-delete-windows
(delete-other-windows))
;; Whether activate `other-window' advice
;; to skip `sr-speedbar' window when use `other-window'.
(sr-speedbar-handle-other-window-advice sr-speedbar-skip-other-window-p)
;; Switch buffer
(if (sr-speedbar-buffer-exist-p speedbar-buffer)
(unless (sr-speedbar-window-exist-p sr-speedbar-window)
(sr-speedbar-get-window))
(if (<= (sr-speedbar-current-window-take-width) sr-speedbar-width)
(setq sr-speedbar-width sr-speedbar-default-width))
(sr-speedbar-get-window) ;get `sr-speedbar' window that split current window
(setq speedbar-buffer (get-buffer-create sr-speedbar-buffer-name)
speedbar-frame (selected-frame)
dframe-attached-frame (selected-frame)
speedbar-select-frame-method 'attached
speedbar-verbosity-level 0 ;don't say anything, i don't like ... :)
speedbar-last-selected-file nil)
(set-buffer speedbar-buffer)
(buffer-disable-undo speedbar-buffer) ;make disable in speedbar buffer, otherwise will occur `undo-outer-limit' error
(speedbar-mode)
(speedbar-reconfigure-keymaps)
(speedbar-update-contents)
(speedbar-set-timer 1)
;; Add speedbar hook.
(add-hook 'speedbar-before-visiting-file-hook 'sr-speedbar-before-visiting-file-hook t)
(add-hook 'speedbar-before-visiting-tag-hook 'sr-speedbar-before-visiting-tag-hook t)
(add-hook 'speedbar-visiting-file-hook 'sr-speedbar-visiting-file-hook t)
(add-hook 'speedbar-visiting-tag-hook 'sr-speedbar-visiting-tag-hook t)
;; Add `kill-buffer-hook'.
(add-hook 'kill-buffer-hook 'sr-speedbar-kill-buffer-hook) ;add `kill-buffer-hook'
;; Auto refresh speedbar content
;; if option `sr-speedbar-auto-refresh' is non-nil
(sr-speedbar-handle-auto-refresh sr-speedbar-auto-refresh))
(set-window-buffer sr-speedbar-window (get-buffer sr-speedbar-buffer-name))
(set-window-dedicated-p sr-speedbar-window t) ;make `sr-speedbar-window' dedicated to speedbar-buffer.
(select-window current-window))
(message "`sr-speedbar' window has exist.")))
(defun sr-speedbar-close ()
"Close `sr-speedbar' window and save window width."
(interactive)
(if (sr-speedbar-exist-p)
(let ((current-window (selected-window)))
;; Remember window width.
(sr-speedbar-select-window)
(sr-speedbar-remember-window-width)
;; Close window.
(if (and (require 'ecb nil t)
ecb-activated-window-configuration)
;; Toggle ECB window when ECB window activated.
(progn
(ecb-deactivate)
(ecb-activate))
;; Otherwise delete dedicated window.
(delete-window sr-speedbar-window)
(if (sr-speedbar-window-exist-p current-window)
(select-window current-window))))
(message "`sr-speedbar' window is not exist.")))
(defun sr-speedbar-select-window ()
"Force the windows that contain `sr-speedbar'."
(interactive)
(if (sr-speedbar-exist-p)
(select-window sr-speedbar-window)
(message "`sr-speedbar' window is not exist.")))
(defun sr-speedbar-refresh-turn-on ()
"Turn on refresh content automatically."
(interactive)
(setq sr-speedbar-auto-refresh t)
(sr-speedbar-handle-auto-refresh sr-speedbar-auto-refresh t))
(defun sr-speedbar-refresh-turn-off ()
"Turn off refresh content automatically."
(interactive)
(setq sr-speedbar-auto-refresh nil)
(sr-speedbar-handle-auto-refresh sr-speedbar-auto-refresh t))
(defun sr-speedbar-refresh-toggle ()
"Toggle refresh content status."
(interactive)
(setq sr-speedbar-auto-refresh (not sr-speedbar-auto-refresh))
(sr-speedbar-handle-auto-refresh sr-speedbar-auto-refresh t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; utilise functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun sr-speedbar-exist-p ()
"Return `non-nil' if `sr-speedbar' is exist.
Otherwise return nil."
(and (sr-speedbar-buffer-exist-p speedbar-buffer)
(sr-speedbar-window-exist-p sr-speedbar-window)))
(defun sr-speedbar-window-p ()
"Return `non-nil' if current window is `sr-speedbar' window.
Otherwise return nil."
(equal sr-speedbar-buffer-name (buffer-name (window-buffer))))
(defun sr-speedbar-remember-window-width ()
"Remember window width."
(let ((win-width (sr-speedbar-current-window-take-width)))
(if (and (sr-speedbar-window-p)
(> win-width 1)
(<= win-width sr-speedbar-max-width))
(setq sr-speedbar-width win-width))))
(defun sr-speedbar-get-window ()
"Get `sr-speedbar' window."
(setq sr-speedbar-window
(split-window (if sr-speedbar-use-frame-root-window
(frame-root-window)
(selected-window))
(- sr-speedbar-width)
(if sr-speedbar-right-side 'right 'left))))
(defun sr-speedbar-before-visiting-file-hook ()
"Function that hook `speedbar-before-visiting-file-hook'."
(select-window (get-mru-window)))
(defun sr-speedbar-before-visiting-tag-hook ()
"Function that hook `speedbar-before-visiting-tag-hook'."
(select-window (get-mru-window)))
(defun sr-speedbar-visiting-file-hook ()
"Function that hook `speedbar-visiting-file-hook'."
(select-window (get-mru-window)))
(defun sr-speedbar-visiting-tag-hook ()
"Function that hook `speedbar-visiting-tag-hook'."
(select-window (get-mru-window)))
(defun sr-speedbar-kill-buffer-hook ()
"Function that hook `kill-buffer-hook'."
(when (eq (current-buffer) speedbar-buffer)
(setq speedbar-frame nil
dframe-attached-frame nil
speedbar-buffer nil)
(speedbar-set-timer nil)
(remove-hook 'speedbar-before-visiting-file-hook 'sr-speedbar-before-visiting-file-hook)
(remove-hook 'speedbar-before-visiting-tag-hook 'sr-speedbar-before-visiting-tag-hook)
(remove-hook 'speedbar-visiting-file-hook 'sr-speedbar-visiting-file-hook)
(remove-hook 'speedbar-visiting-tag-hook 'sr-speedbar-visiting-tag-hook)))
(defun sr-speedbar-refresh ()
"Refresh the context of speedbar."
(when (and (not (equal default-directory sr-speedbar-last-refresh-dictionary)) ;if directory is change
(not (sr-speedbar-window-p))) ;and is not in speedbar buffer
(setq sr-speedbar-last-refresh-dictionary default-directory)
(speedbar-refresh)))
(defun sr-speedbar-handle-auto-refresh (activate &optional echo-show)
"Automatically refresh speedbar content when changed directory.
Do nothing if option ACTIVATE is nil.
Will display message if ECHO-SHOW is non-nil."
(if activate
(progn
(add-hook 'speedbar-timer-hook 'sr-speedbar-refresh)
(if echo-show (message "Turn on speedbar content refresh automatically.")))
(remove-hook 'speedbar-timer-hook 'sr-speedbar-refresh)
(if echo-show (message "Turn off speedbar content refresh automatically."))))
(defun sr-speedbar-current-window-take-width (&optional window)
"Return the width that WINDOW take up.
If WINDOW is nil, get current window."
(let ((edges (window-edges window)))
(- (nth 2 edges) (nth 0 edges))))
(defun sr-speedbar-window-dedicated-only-one-p ()
"Only have one non-dedicated window."
(interactive)
(let ((window-number 0)
(dedicated-window-number 0))
(walk-windows
(lambda (w)
(with-selected-window w
(cl-incf window-number)
(if (window-dedicated-p w)
(cl-incf dedicated-window-number)))))
(if (and (> dedicated-window-number 0)
(= (- window-number dedicated-window-number) 1))
t nil)))
(defun sr-speedbar-window-exist-p (window)
"Return `non-nil' if WINDOW is exist.
Otherwise return nil."
(and window (window-live-p window)))
(defun sr-speedbar-buffer-exist-p (buffer)
"Return `non-nil' if BUFFER is exist.
Otherwise return nil."
(and buffer (buffer-live-p buffer)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Advices ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defadvice delete-other-windows (around sr-speedbar-delete-other-window-advice activate)
"This advice to make `sr-speedbar' window can't deleted by command `delete-other-windows'."
(let ((sr-speedbar-active-p (sr-speedbar-window-exist-p sr-speedbar-window)))
(if sr-speedbar-active-p
(let ((current-window (selected-window)))
(dolist (win (window-list))
(when (and (window-live-p win)
(not (eq current-window win))
(not (window-dedicated-p win)))
(delete-window win))))
ad-do-it)))
(defadvice delete-window (before sr-speedbar-delete-window-advice activate)
"This advice to remember `sr-speedbar' window width before deleted.
Use `delete-window' delete `sr-speedbar' window have same effect as `sr-speedbar-close'."
;; Remember window width before deleted.
(sr-speedbar-remember-window-width))
(defadvice pop-to-buffer (before sr-speedbar-pop-to-buffer-advice activate)
"This advice is to fix `pop-to-buffer' problem with dedicated window.
Default, function `display-buffer' can't display buffer in select window
if current window is `dedicated'.
So function `display-buffer' conflict with `sr-speedbar' window, because
`sr-speedbar' window is `dedicated' window.
That is to say, when current frame just have one `non-dedicated' window,
any functions that use `display-buffer' can't split windows
to display buffer, even option `pop-up-windows' is enable.
And the example function that can occur above problem is `pop-to-buffer'."
(when (and pop-up-windows ;`pop-up-windows' is enable
(sr-speedbar-window-dedicated-only-one-p) ;just have one `non-dedicated' window
(sr-speedbar-window-exist-p sr-speedbar-window)
(not (sr-speedbar-window-p)) ;not in `sr-speedbar' window
(not (bound-and-true-p helm-alive-p)))
(split-window-vertically)
(windmove-down)))
(defadvice other-window (after sr-speedbar-other-window-advice)
"Default, can use `other-window' select window in cyclic ordering of windows.
But sometimes we don't want select `sr-speedbar' window use `other-window'.
Just want make `sr-speedbar' window as a view sidebar.
This advice can make `other-window' skip `sr-speedbar' window."
(let ((count (or (ad-get-arg 0) 1)))
(when (and (sr-speedbar-window-exist-p sr-speedbar-window)
(eq sr-speedbar-window (selected-window)))
(other-window count))))
(provide 'sr-speedbar)
;;; sr-speedbar.el ends here

54
init.el
View file

@ -10,7 +10,6 @@
(package-initialize)) (package-initialize))
(use-package delight (use-package delight
:if (package-installed-p 'delight)
:demand t) :demand t)
(setq user-full-name "Evie Litherland-Smith" (setq user-full-name "Evie Litherland-Smith"
@ -48,23 +47,19 @@
(scroll-bar-mode -1) (scroll-bar-mode -1)
(use-package nerd-icons (use-package nerd-icons
:if (package-installed-p 'nerd-icons)
:demand t) :demand t)
(use-package nerd-icons-dired (use-package nerd-icons-dired
:if (package-installed-p 'nerd-icons-dired)
:after (nerd-icons dired) :after (nerd-icons dired)
:commands nerd-icons-dired-mode :commands nerd-icons-dired-mode
:hook (dired-mode . (lambda () (nerd-icons-dired-mode +1)))) :hook (dired-mode . (lambda () (nerd-icons-dired-mode +1))))
(use-package nerd-icons-ibuffer (use-package nerd-icons-ibuffer
:if (package-installed-p 'nerd-icons-ibuffer)
:after nerd-icons :after nerd-icons
:commands nerd-icons-ibuffer-mode :commands nerd-icons-ibuffer-mode
:hook (ibuffer-mode . (lambda () (nerd-icons-ibuffer-mode +1)))) :hook (ibuffer-mode . (lambda () (nerd-icons-ibuffer-mode +1))))
(use-package nerd-icons-corfu (use-package nerd-icons-corfu
:if (package-installed-p 'nerd-icons-corfu)
:after nerd-icons) :after nerd-icons)
(setopt mode-line-compact 'long) (setopt mode-line-compact 'long)
@ -137,7 +132,6 @@
(window-parameters . ((no-delete-other-windows . t)))))) (window-parameters . ((no-delete-other-windows . t))))))
(use-package khalel (use-package khalel
:if (package-installed-p 'khalel)
:after (appt org) :after (appt org)
:commands (khalel-run-vdirsyncer khalel-import-events khalel-add-capture-template) :commands (khalel-run-vdirsyncer khalel-import-events khalel-add-capture-template)
:custom :custom
@ -163,16 +157,15 @@
(message-auto-save-directory nil) (message-auto-save-directory nil)
(message-kill-buffer-on-exit t)) (message-kill-buffer-on-exit t))
(setq mail-user-agent 'mu4e-user-agent
read-mail-command 'mu4e)
(use-package mu4e (use-package mu4e
:if (package-installed-p 'mu4e)
:bind :bind
(("C-c m" . mu4e) (("C-c m" . mu4e)
:map mu4e-view-mode-map :map mu4e-view-mode-map
("o n" . mu4e-org-store-and-capture)) ("o n" . mu4e-org-store-and-capture))
:hook ((mu4e-main-mode mu4e-headers-mode) . (lambda () (visual-line-mode -1))) :hook ((mu4e-main-mode mu4e-headers-mode) . (lambda () (visual-line-mode -1)))
:init
(setq mail-user-agent 'mu4e-user-agent
read-mail-command 'mu4e)
:custom :custom
(mu4e-read-option-use-builtin nil) (mu4e-read-option-use-builtin nil)
(mu4e-completing-read-function #'completing-read) (mu4e-completing-read-function #'completing-read)
@ -562,7 +555,6 @@
tab-mark))) tab-mark)))
(use-package diff-hl (use-package diff-hl
:if (package-installed-p 'diff-hl)
:functions (diff-hl-magit-pre-refresh :functions (diff-hl-magit-pre-refresh
diff-hl-magit-post-refresh diff-hl-magit-post-refresh
global-diff-hl-mode) global-diff-hl-mode)
@ -693,7 +685,6 @@
(khalel-add-capture-template)) (khalel-add-capture-template))
(use-package org-roam (use-package org-roam
:if (package-installed-p 'org-roam)
:after org :after org
:defines org-roam-directory :defines org-roam-directory
:functions org-roam-db-autosync-mode :functions org-roam-db-autosync-mode
@ -732,7 +723,6 @@
;; :target (file+datetree "journal.org" week))))) ;; :target (file+datetree "journal.org" week)))))
(use-package org-journal (use-package org-journal
:if (package-installed-p 'org-journal)
:after org :after org
:demand :demand
:bind ("C-c n d" . org-journal-new-entry) :bind ("C-c n d" . org-journal-new-entry)
@ -809,7 +799,6 @@
(org-icalendar-combined-description "Emacs org-mode combined export")) (org-icalendar-combined-description "Emacs org-mode combined export"))
(use-package org-noter (use-package org-noter
:if (package-installed-p 'org-noter)
:after (org doc-view citar) :after (org doc-view citar)
:commands org-noter :commands org-noter
:custom :custom
@ -824,7 +813,6 @@
(org-noter-prefer-root-as-file-level nil)) (org-noter-prefer-root-as-file-level nil))
(use-package citar (use-package citar
:if (package-installed-p 'citar)
:defines (citar-bibliography :defines (citar-bibliography
citar-indicators) citar-indicators)
:functions (citar-indicator-create :functions (citar-indicator-create
@ -897,7 +885,6 @@
(setq org-preview-latex-default-process 'dvisvgm) (setq org-preview-latex-default-process 'dvisvgm)
(use-package vertico (use-package vertico
:if (package-installed-p 'vertico)
:functions vertico-mode :functions vertico-mode
:custom :custom
(vertico-cycle t) (vertico-cycle t)
@ -907,7 +894,6 @@
(require 'vertico-directory)) (require 'vertico-directory))
(use-package marginalia (use-package marginalia
:if (package-installed-p 'marginalia)
:functions marginalia-mode :functions marginalia-mode
:custom :custom
(marginalia-annotators '(marginalia-annotators-heavy (marginalia-annotators '(marginalia-annotators-heavy
@ -918,7 +904,6 @@
:config (marginalia-mode +1)) :config (marginalia-mode +1))
(use-package orderless (use-package orderless
:if (package-installed-p 'orderless)
:custom :custom
(completion-styles '(orderless basic)) (completion-styles '(orderless basic))
(completion-category-defaults nil) (completion-category-defaults nil)
@ -927,7 +912,6 @@
(eglot-capf (styles orderless))))) (eglot-capf (styles orderless)))))
(use-package corfu (use-package corfu
:if (package-installed-p 'corfu)
:defines (corfu-map :defines (corfu-map
corfu-mode-map corfu-mode-map
corfu-margin-formatters) corfu-margin-formatters)
@ -979,12 +963,10 @@
(corfu-popupinfo-delay 0.3)) (corfu-popupinfo-delay 0.3))
(use-package corfu-terminal (use-package corfu-terminal
:if (package-installed-p 'corfu-terminal)
:after corfu :after corfu
:functions corfu-terminal-mode) :functions corfu-terminal-mode)
(use-package cape (use-package cape
:if (package-installed-p 'cape)
:after corfu :after corfu
:functions (cape-emoji :functions (cape-emoji
cape-file cape-file
@ -998,7 +980,6 @@
(cape-dabbrev-min-length (+ corfu-auto-prefix 1))) (cape-dabbrev-min-length (+ corfu-auto-prefix 1)))
(use-package consult (use-package consult
:if (package-installed-p 'consult)
:functions (consult-org-heading :functions (consult-org-heading
consult-history) consult-history)
:bind (("<remap> <imenu>" . consult-imenu) :bind (("<remap> <imenu>" . consult-imenu)
@ -1016,12 +997,10 @@
("<remap> <comint-history-isearch-backward-regexp>" . consult-history))) ("<remap> <comint-history-isearch-backward-regexp>" . consult-history)))
(use-package consult-eglot (use-package consult-eglot
:if (package-installed-p 'consult-eglot)
:after (consult eglot) :after (consult eglot)
:bind (("C-c c s" . consult-eglot-symbols))) :bind (("C-c c s" . consult-eglot-symbols)))
(use-package tempel (use-package tempel
:if (package-installed-p 'tempel)
:defines tempel-path :defines tempel-path
:functions (tempel-expand :functions (tempel-expand
tempel-abbrev-mode) tempel-abbrev-mode)
@ -1032,7 +1011,6 @@
(tempel-trigger-prefix "+")) (tempel-trigger-prefix "+"))
(use-package tempel-collection (use-package tempel-collection
:if (package-installed-p 'tempel-collection)
:after tempel) :after tempel)
(require 'tramp) (require 'tramp)
@ -1056,11 +1034,9 @@
))) )))
(use-package rainbow-delimiters (use-package rainbow-delimiters
:if (package-installed-p 'rainbow-delimiters)
:hook (prog-mode)) :hook (prog-mode))
(use-package envrc (use-package envrc
:if (package-installed-p 'envrc)
:hook (after-init . envrc-global-mode) :hook (after-init . envrc-global-mode)
:custom :custom
(envrc-show-summary-in-minibuffer t)) (envrc-show-summary-in-minibuffer t))
@ -1076,7 +1052,6 @@
(treesit-font-lock-level 3)) (treesit-font-lock-level 3))
(use-package treesit-auto (use-package treesit-auto
:if (package-installed-p 'treesit-auto)
:after treesit :after treesit
:functions (treesit-auto-add-to-auto-mode-alist :functions (treesit-auto-add-to-auto-mode-alist
global-treesit-auto-mode) global-treesit-auto-mode)
@ -1138,7 +1113,6 @@
) )
(use-package apheleia (use-package apheleia
:if (package-installed-p 'apheleia)
:delight apheleia-mode :delight apheleia-mode
:defines (apheleia-formatters :defines (apheleia-formatters
apheleia-mode-alist) apheleia-mode-alist)
@ -1155,28 +1129,26 @@
:hook ((prog-mode yaml-ts-mode) . (lambda () (flymake-mode +1)))) :hook ((prog-mode yaml-ts-mode) . (lambda () (flymake-mode +1))))
(use-package flymake-shellcheck (use-package flymake-shellcheck
:if (package-installed-p 'flymake-shellcheck) :disabled t
:functions flymake-shellcheck-load :functions flymake-shellcheck-load
:after flymake :after flymake
:hook (sh-mode . (lambda () (if (executable-find "shellcheck" t) :hook (sh-mode . (lambda () (if (executable-find "shellcheck" t)
(flymake-shellcheck-load))))) (flymake-shellcheck-load)))))
(use-package flymake-yamllint (use-package flymake-yamllint
:if (package-installed-p 'flymake-yamllint)
:functions flymake-yamllint-setup :functions flymake-yamllint-setup
:after flymake :after flymake
:hook (yaml-ts-mode . (lambda () (if (executable-find "yamllint" t) :hook (yaml-ts-mode . (lambda () (if (executable-find "yamllint" t)
(flymake-yamllint-setup))))) (flymake-yamllint-setup)))))
(use-package flymake-clippy (use-package flymake-clippy
:if (package-installed-p 'flymake-clippy) :disabled t
:functions flymake-clippy-setup-backend :functions flymake-clippy-setup-backend
:after flymake :after flymake
:hook (rust-mode . (lambda () (if (executable-find "clippy" t) :hook (rust-mode . (lambda () (if (executable-find "clippy" t)
(flymake-clippy-setup-backend))))) (flymake-clippy-setup-backend)))))
(use-package flymake-eslint (use-package flymake-eslint
:if (package-installed-p 'flymake-eslint)
:functions flymake-eslint-enable :functions flymake-eslint-enable
:after flymake :after flymake
:hook ((js-base-mode typescript-ts-base-mode) . (lambda () (if (executable-find "eslint" t) :hook ((js-base-mode typescript-ts-base-mode) . (lambda () (if (executable-find "eslint" t)
@ -1207,7 +1179,6 @@
)) ))
(use-package magit (use-package magit
:if (package-installed-p 'magit)
:bind (("C-c g" . magit-status) :bind (("C-c g" . magit-status)
:map project-prefix-map :map project-prefix-map
("m" . magit-project-status)) ("m" . magit-project-status))
@ -1228,11 +1199,9 @@
("\\`\\(?:gitea:\\|gt:\\)\\([^:]+\\)\\'" "git.xenia.me.uk" "gitea.user")))) ("\\`\\(?:gitea:\\|gt:\\)\\([^:]+\\)\\'" "git.xenia.me.uk" "gitea.user"))))
(use-package forge (use-package forge
:if (package-installed-p 'forge)
:after magit) :after magit)
(use-package nix-mode (use-package nix-mode
:if (package-installed-p 'nix-mode)
:mode "\\.nix\\'" :mode "\\.nix\\'"
:functions nix-prettify-global-mode :functions nix-prettify-global-mode
:config :config
@ -1243,7 +1212,6 @@
(nix-prettify-global-mode +1)) (nix-prettify-global-mode +1))
(use-package lua-mode (use-package lua-mode
:if (package-installed-p 'lua-mode)
:mode "\\.lua\\'") :mode "\\.lua\\'")
(defun my/enable-fill-column (col) (defun my/enable-fill-column (col)
@ -1276,11 +1244,9 @@
(setq python-ts-mode-hook python-mode-hook)) (setq python-ts-mode-hook python-mode-hook))
(use-package python-docstring (use-package python-docstring
:if (package-installed-p 'python-docstring)
:hook python-base-mode) :hook python-base-mode)
(use-package python-pytest (use-package python-pytest
:if (package-installed-p 'python-pytest)
:defer t) :defer t)
(use-package files (use-package files
@ -1299,11 +1265,9 @@
(doc-view-scale-internally t)) (doc-view-scale-internally t))
(use-package auctex (use-package auctex
:if (package-installed-p 'auctex)
:defer t) :defer t)
(use-package markdown-mode (use-package markdown-mode
:if (package-installed-p 'markdown-mode)
:custom :custom
(markdown-enable-math t) (markdown-enable-math t)
(markdown-enable-html t) (markdown-enable-html t)
@ -1315,7 +1279,6 @@
(set-face-attribute 'markdown-comment-face nil :inherit 'variable-pitch)) (set-face-attribute 'markdown-comment-face nil :inherit 'variable-pitch))
(use-package pandoc-mode (use-package pandoc-mode
:if (package-installed-p 'pandoc-mode)
:after (markdown-mode) :after (markdown-mode)
:hook (markdown-mode . conditionally-turn-on-pandoc)) :hook (markdown-mode . conditionally-turn-on-pandoc))
@ -1330,18 +1293,11 @@
(eww-browse-url-new-window-is-tab nil)) (eww-browse-url-new-window-is-tab nil))
(use-package scad-mode (use-package scad-mode
:if (package-installed-p 'scad-mode)
:defer t) :defer t)
;; Scratch buffer shortcut ;; Scratch buffer shortcut
(keymap-global-set "C-c w x" #'scratch-buffer) (keymap-global-set "C-c w x" #'scratch-buffer)
(defun my/open-init-file ()
"Open `user-init-file'."
(interactive)
(find-file user-init-file))
(keymap-global-set "C-c w i" #'my/open-init-file)
;; Org shortcuts ;; Org shortcuts
(defun my/open-org-directory () (defun my/open-org-directory ()
"Open base `org-mode' directory in Dired." "Open base `org-mode' directory in Dired."

47
lib/ics2org.el Normal file
View file

@ -0,0 +1,47 @@
;;; ics2org.el -- ics2org -*- lexical-binding: t -*-
;;; Commentary:
;;; Inspired by / adapted from `fosdem-ics-to-org-list', from
;;; https://geeksocket.in/posts/elisp-ics-org-mode-list/
;;; Original Code:
;;; (defun fosdem-ics-to-org-list ()
;;; "Iterate over the VEVENT entries and create an Org list"
;;; (interactive)
;;; (let (talks-list)
;;; (setq talks-list
;;; (concat
;;; "* FOSDEM talks [/]\n"
;;; (cl-loop while (re-search-forward "BEGIN:VEVENT" nil t) concat
;;; (let (start-time end-time summary url duration duration-minutes)
;;; (re-search-forward "DTSTART:\\(.*\\)")
;;; (setq start-time (match-string 1))
;;; (re-search-forward "DTEND:\\(.*\\)")
;;; (setq end-time (match-string 1))
;;; (re-search-forward "SUMMARY:\\(.*\\)")
;;; (setq summary (match-string 1))
;;; (re-search-forward "URL:\\(.*\\)")
;;; (setq url (match-string 1))
;;; (setq duration (time-subtract
;;; (parse-iso8601-time-string end-time)
;;; (parse-iso8601-time-string start-time)))
;;; (setq duration-minutes (/ duration 60))
;;; (format "- [ ] [[%s][%s]] (%sm)\n" url summary duration-minutes)))))
;;; (with-current-buffer (generate-new-buffer "FOSDEM")
;;; (insert talks-list)
;;; (org-mode)
;;; (org-update-statistics-cookies (point)))))
;;; Code:
(defun ics2org (filename)
"Convert ICS file `FILENAME' to Org event format and insert at point."
(interactive)
(if (not (file-exists-p filename))
(error "File %s not found" filename))
(require 'gnus-icalendar)
(find-file filename)
(with-current-buffer "*scratch*"
(let ((event (gnus-icalendar-event-from-buffer (find-buffer-visiting filename))))
(insert (format "* %s\n\n" (gnus-icalendar--format-summary-line (gnus-icalendar-event:summary event)
(gnus-icalendar-event:location event))))))
)
(provide 'ics2org)
;;; ics2org.el ends here