Skip to content

Likhon-baRoy/.emacs.d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Likhon’s GNU Emacs Configuration

GPLv3 Software

https://img.shields.io/badge/license-GPL_3-green.svg?style=flat&logo=appveyor https://badges.frapsoft.com/os/v1/open-source.png?v=103 https://img.shields.io/github/forks/Likhon-baRoy/.emacs.d.svg?style=flat https://img.shields.io/github/stars/Likhon-baRoy/.emacs.d.svg?style=flat https://img.shields.io/github/commit-activity/m/Likhon-baRoy/.emacs.d.svg?style=flat https://img.shields.io/tokei/lines/github/Likhon-baRoy/.emacs.d.svg?style=flat

https://img.shields.io/badge/arch-yes-success.svg?logo=archlinux&style=flat-square https://img.shields.io/badge/macos-yes-success.svg?logo=apple&style=flat-square https://img.shields.io/badge/windows-untested-important.svg?logo=windows&style=flat-square

An infinite number of monkeys typing into GNU Emacs would never make a good program.
——— Linus Torvalds

Table of Contents

About

Emacs changes how you think about programming.

Emacs is totally introspectable. You can always find out what code runs when I press this button?.

Emacs is an incremental programming environment. There’s no edit-compile-run cycle. There isn’t even an edit-run cycle. You can execute snippets of code and gradually turn them into a finished project. There’s no distinction between your editor and your interpreter.

Emacs is a mutable environment. You can set variables, tweak functions with advice, or redefine entire functions. Nothing is off-limits.

Emacs provides functionality without applications. Rather than separate applications, functionality is all integrated into your Emacs instance. Amazingly, this works. Ever wanted to use the same snippet tool for writing C++ classes as well as emails?

Emacs is full of incredible software concepts that haven’t hit the mainstream yet. For example:

  • Many platforms have a single item clipboard. Emacs has an infinite clipboard.
  • If you undo a change, and then continue editing, you can’t redo the original change. Emacs allows undoing to any historical state, even allowing tree-based exploration of history.
  • Emacs supports a reverse variable search: you can find variables with a given value.
  • You can perform structural editing of code, allowing you to make changes without breaking syntax. This works for lisps (paredit) and non-lisps (smartparens).
  • Many applications use a modal GUI: for example, you can’t do other edits during a find-and-replace operation. Emacs provides recursive editing that allow you to suspend what you’re currently doing, perform other edits, then continue the original task.

Emacs has a documentation culture. Emacs includes a usage manual, a lisp programming manual, pervasive docstrings and even an interactive tutorial.

Emacs has a broad ecosystem. If you want to edit code in a niche language, there’s probably an Emacs package for it.

Emacs doesn’t have a monopoly on good ideas, and there are other great tools out there. Nonetheless, we believe the Emacs learning curve pays off.

This beautifully written About EMACS section credits to Remacs.

About README

Welcome to the Emacs Of Dream. Wait no, I meant the Emacs Operating System.
This repository contains my personal configuration for GNU Emacs that I use on the daily and port around from system to system with me. This is an example of a fully custom Emacs configuration that you can use as inspiration when building your own!

Customization began with single-file ~/.emacs with few settings and some random snippets. Didn’t took long to become monster. It loved to cherry-picked 🍒 packages literally form anywhere, I was like why don’t you apt-get.

The configuration depends on init.el, my-lisp(dir) and early-init.el (sets up a few initial GUI settings), bootstraps use-package. and loads init.el, which is where the majority of the configuration magic happens.

This is an Emacs distribution that aims to enhance the default Emacs experience. It alters a lot of the default settings, bundles of additional packages and adds its own core library to the mix. The final product offers an easy to use Emacs configuration for Emacs newcomers and lots of additional power for Emacs power users.

It’s able to run on GNU/Linux, macOS and Windows. It is compatible ONLY with GNU Emacs 27.1 and Above. In general you’re advised to always run with the latest stable release - currently 28.2.

Screenshots

Here are some demo…

A dashboard on startup can clean my mind.😌

../screenshots/ss-1.png

Center text in the frame, looks nice ;) and =flycheck= with BitMap-Arrow on the right-fringe 😎

../screenshots/ss-2.png

default Transparent mode 👍🏻

../screenshots/ss-3.png

File navigation with Speed-bar.

../screenshots/ss-4.png

feel the Org-mode :D

../screenshots/ss-5.png

Company-mode with yasnippet 🔥

../screenshots/ss-6.png

GitHub repo size

How to Use This Configuration

This repo is meant to be a companion to the Emacs From Scratch video series, serving as an example of a custom configuration build on top of vanilla Emacs. I give instructions below for how to set it up to try it out, but it isn’t meant to be used as your main configuration! My goal here is to provide a working configuration that you can take inspiration from (and copy from directly).

Just keep in mind that this repo isn’t set up to be used directly as your own configuration! Copy the code to your own dotfiles repository and have fun :)

Installation

http://ForTheBadge.com/images/badges/built-with-swag.svg

🧨 DISCLAIMER: 🐒 MAKE SURE YOU HAVE THE BACKUP ⚠ AUTHOR will not be responsible for the 🔥 harm 🔥 cause by using this configuration.

Oh! you wanna use my config! its super duper easy ! may be in future I’m still trying avoiding make the installer (literally don’t know how) and just trying to get by my work.

  1. Install GNU Emacs.
  2. Move ~/.emacs or ~/.emacs.d, if you already have it.
  3. Clone this repo to HOME or ~/ path using git and update all the submodules.
    Run this snippets on your terminal:
cd ~
git clone https://github.com/Likhon-baRoy/.emacs.d.git
cd.emacs.d
  1. Ensure a stable connection to Melpa Packages, then open Emacs.
  2. Enter y when prompted with Auto-update packages now?, wait for all packages to install. (Ignore the warnings on the first launch.)
  3. In your favorite browser, Ctrl-f Prerequisite through this README and follow the Prerequisite instructions.
  4. Restart Emacs and Start using your Dream Emacs! 🎉

Why this Config?

There is absolutely no reason for you to use this config, it would be like first time 🏊 swimmer, who mostly likely drown with unnecessary amount of effort. Although I’m great at underwater so to say some what athletic underachievers.

Time 🕥 and time 🕝 again I learned elisp just to forget with endless pondering and compromises, without ✍ jotting things down, it would have been impossible to configure. May be this started for maintenance, now its more of rants taking over the configuration! 😎

If you ask, would I have started with other’s config? I would definitely say YES. But you should understand all-in-one package 📦 or distribution is like bringing gun 🔫 to the fist 👊 fight. You might end up using less than 5 % of the bloat. And if you want to change or fix something it big 😫 pain to pealing layers after layers to find the actual root cause. Yet you might want to try these first

And there configurations too.

Troubleshooting

While troubleshooting I go though these procedure (may not be in same ordering)

  • hate myself when it happens
  • REMOVE the damn plugin and GET BACK TO WORK
  • throw ERROR MSG at google and try catching relevant pages
  • may be waste few hrs with random trials
  • set debug variable
    (setq debug-on-error 1)
    (setq debug-on-quit t)  ;; C-g
        

Further Updates

I will be updating My-EMACS from time to time, it is best to git pull once a while to stay up to date.

Please also execute git submodule update --recursive --remote to sync with all the submodules.

Contribution

If you spotted a bug or you have any suggestions, please fill in an issue. If you have something to fix, feel free to create a pull request.

Special Thanks

Everyone starts somewhere, and I started here. My heart whelming Thanks 🙏🏽 to you guy’s 💜, who put all their effort always makes Emacs go one-step further.

And many other people from the Internet World. Awesome Emacs has a good list of packages and themes to check out.

Prerequisites

User Information

Please update this file your personal info.

(setq user-full-name       "Your Name"
      user-login-name      "Login_Name"
      user-real-login-name "Real_Login_Name"
      user-mail-address    "likhonhere007@gmail.com")

Install Packages

Also this project relies on the following list of applications:

User Guidance

📝 Note: (for beginners) I’ll be using Ctrl as C, Alt as M, Shift as S, Space as SPC and BackSpace as BS.

After installation process is done. Whenever you open a files within Emacs, the whole file will be opened in folding mode. Which you’ll obviously won’t see until you find the shortcut key-binding. There is a default feature for this which called hs-minor-mode I just change some default key-bindings for more useful.

check this out:

C-c h (hide-all)
C-c s (show-all)
S-BS  (hide-block)
C-BS  (show-block)
C-TAB (toggle-hiding) - fold the current section.
S-TAB (hide-level) - fold the sub sections of the current section.

Custom Configurations

Here is my some personal changes for Emacs which comes default with this configuration.

Custom key bindings

;;; this is confusion
(global-unset-key (kbd "C-z")) ; unbind (suspend-frame)

;; normal undo and redo
(global-set-key (kbd "C-z") 'undo-only)
(global-set-key (kbd "C-S-z") 'undo-tree-redo)
;; ;;; Shell
(global-set-key (kbd "C-!")   'eshell-here) ; see this function in `shell.el'

(global-set-key "\C-w" 'backward-kill-word)

;; I use `C-h' for backspace in Emacs and move `help-command' elsewhere:
(global-set-key "\^h" 'backward-delete-char)
(define-key isearch-mode-map "\C-h" 'isearch-delete-char)
(global-set-key (kbd "C-S-H") 'kill-whole-line)

;; long lines go-off the side of the screen instead of hosing up the ascii art
(global-set-key "\C-x\C-l" 'toggle-truncate-lines)
;; Rename File
(global-set-key (kbd "C-S-R") 'rename-file)
;; Delete current file
(global-set-key "\C-cD" 'Delete-current-file)
;; kill selected region
(global-set-key "\C-x\C-k" 'kill-region)
(global-set-key "\C-c\C-k" 'kill-region)
;; Duplicate a whole line
(global-set-key "\C-c\C-d" "\C-a\C- \C-n\M-w\C-y")
;; Buffer
(global-set-key "\M-n"  'next-buffer)
(global-set-key "\M-p"  'previous-buffer)
;; Window
(global-set-key "\M-o"  'other-window) ; use with `ace-window'
(global-set-key (kbd "C-.") #'other-window)
(global-set-key (kbd "C-,") #'prev-window)
;; auto-complete
(global-set-key "\M-TAB"  'company-complete-common-or-cycle)

Custom functions

;; Unfill paragraph
;; Might be good. For instance for canceling all of the paragraph quickly or for commenting it away.
(defun unfill-paragraph ()
  "Convert a multi-line paragraph into a single line of text."
  (interactive)
  (let ((fill-column (point-max)))
    (fill-paragraph nil)))
;; Handy key definition
(define-key global-map "\M-Q" 'unfill-paragraph)
  • Now now, how much you like transparency? With this config this method comes default.
    you can toggle on / off transparency using C-c t keystrokes.
;;________________________________________________________________
;;    Transparent Emacs
;;________________________________________________________________
(set-frame-parameter (selected-frame) 'alpha '(85 . 50))
(add-to-list 'default-frame-alist '(alpha . (85 . 50)))
;; (set-frame-parameter (selected-frame) 'alpha '(<active> . <inactive>))
;; (set-frame-parameter (selected-frame) 'alpha <both>)

;; Use the following snippet after you’ve set the alpha as above to assign a toggle to “C-c t”:
(defun toggle-transparency ()
  "Crave for transparency!"
  (interactive)
  (let ((alpha (frame-parameter nil 'alpha)))
    (set-frame-parameter
     nil 'alpha
     (if (eql (cond ((numberp alpha) alpha)
                    ((numberp (cdr alpha)) (cdr alpha))
                    ;; Also handle undocumented (<active> <inactive>) form.
                    ((numberp (cadr alpha)) (cadr alpha)))
              100)
         '(85 . 50) '(100 . 100)))))
(global-set-key (kbd "C-c t") 'toggle-transparency)

Optional

Setup Bangla Language Environment

Writing in Bangla using company-wordfreq.

Requirements

Settings

You can put this configuration code to you init.el file or make an extra separate file and put it in ~/.emacs.d/my-lisp/ directory then Emacs will autoload this file from there.

set your keyboard default layout to Probhat key-layout.

(setq default-input-method "bengali-probhat")
(set-fontset-font "fontset-default" 'bengali (font-spec :family "Kalpurush" :size 16))

Install the following package for auto suggestions of Bangla word.

(use-package company-wordfreq
  :delight " 𝛄")

We need to the set up the following in the local buffer. This can be done by invoking an interactive function as below.

(defun remove-quail-show-guidance ()
  nil)
(defun remove-quail-completion ()
  (quail-select-current))
(defun bn-company-wordfreq ()
  (interactive)
  (advice-add 'quail-show-guidance :override #'remove-quail-show-guidance)
  (advice-add 'quail-completion :override #'remove-quail-completion)
  (setq ispell-local-dictionary "bengali_439")
  (setq-local company-backends '(company-wordfreq))
  (setq-local company-transformers nil))

And let’s hook them into Text buffer-mode.

(add-hook 'text-mode-hook (lambda ()
                            (setq-local company-backends '(company-wordfreq))
                            (setq-local company-transformers nil)))

for more information visit this link here: Typing Bangla in emacs

Workflow

  • Change the input-method using C-\
  • Enable company-wordfreq and other changes for a nice experience using M-x bn-company-wordfreq

Now you can enjoy your Bangla/Bengali lang workflow :D

Recommendations

Here are some general recommendations on Emacs usage that you might find helpful:

Replace CapsLock with CTRL

Most people don’t use the CapsLock key (unless you like YELLING ON THE INTERNET) so you can use this simple fix to replace it with the CTRL to make your Emacs life easier. Doing this will prevent you from having to bend your pinky down all day long to hit all those fabled Emacs keybindings, allowing you to keep your hands on the home row of the keyboard.

Here’s how to do it across all 3 major operating systems:

Linux X11 There are many ways to accomplish this in Linux, but the easiest (and most repeatable) I’ve found is to use xmodmap. First, create a file named .Xmodmap in your home folder and populate it like so:

clear lock
clear control
keycode 66 = Control_L
add control = Control_L
add Lock = Control_R

This replaces CapsLock with control and also replaces the Ctrl key on the right side with CapsLock just in case you ever need to use it. Most login systems (GDM, KDM, etc) will load this file when you log in so you might not need to do anything extra for it to take effect, just log out and log back in again. If that doesn’t seem to work, you can add this line to one of your startup files (.xinitrc, .profile, window manager configuration, etc):

xmodmap ~/.Xmodmap

This beautifully written Replace CapsLock with CTRL section credits to Emacs From Scratch

Ask Me Anything!

💬 Ask a question          📖 Read questions

I get questions by email, occasionally. This way anyone can read the answer!

https://img.shields.io/badge/Ask%20me-anything-1abc9c.svg

Anything means anything. Personal questions. Money. Work. Life. Code. Cooking. Traveling. Sports. Teaching. Pokémon. Whatever. 😂

📜 License

This project is open source software licensed under the GNU General Public Licence version 3.

Copyright © 2022-present, Likhon Baroy <likhonhere007@gmail.com>.

Releases

No releases published

Sponsor this project

Packages

No packages published