Giter Site home page Giter Site logo

.emacs.d's Introduction

modi .emacs.d

My emacs setup is tested to work only with emacs 25.1 and newer versions. If you are on older versions, I would recommend that you upgrade to the latest available stable version.

On the other hand, I keep my emacs updated to the /latest Development version/. So my config will definitely work with that if you too are doing the same.

Using my emacs setup

You can start using my emacs setup by following these steps:

  1. Download the latest update script for this config
    curl -o force_update_emacsd.sh https://raw.githubusercontent.com/kaushalmodi/.emacs.d/master/force_update_emacsd.sh
    chmod 744 force_update_emacsd.sh
        

    This script git clones my config and all sub-modules that I rely on (mine + others).

  2. Run the script (review it first if you like) using below if you want to download this config to your ~/.emacs.d/ directory.
    ./force_update_emacsd.sh ~/.emacs.d
        

    If the download location you specify already exists, a backup of it is created first.

  3. Edit the =user-emacs-directory= var in the just downloaded =init.el= if needed BEFORE starting emacs using this config.

    If you ran ./force_update_emacsd.sh ~/.emacs.d in Step 2 above, you will not need to change that variable. But if you did ./force_update_emacsd.sh <MY-EMACSD-DIR>, you will need to change the value of user-emacs-directory in <MY-EMACSD-DIR>/init.el to <MY-EMACSD-DIR>.

  4. Start emacs as usual if you did not change the download location in Step 2. If you DID change the download location to <MY-EMACSD-DIR>, you will need to do \emacs -Q -l <MY-EMACSD-DIR>/init.el.

That’s it!

The first start will take a couple of minutes as it auto-installs all packages in the my-packages list defined in the init.el.

Few notes

  • Few setup files have setup done as per my personal tastes and needs:
    • setup-files/setup-misc.el
    • setup-files/setup-mode-line.el
    • setup-files/setup-registers.el
  • If you want to change the default theme, font size, etc, you would want to edit setup-files/setup-visual.el
  • Any of the variables or global minor modes set in my config can be overridden in setup-personal.el which you need to create in the directory pointed by the variable user-personal-directory.
  • You can also choose to override certain variables in the very beginning of the init.el by customizing the variables in a setup-var-overrides.el file placed in user-personal-directory. You can refer to an example of this file here. During the first time setup, copy the setup-var-overrides-EXAMPLE.el file to setup-var-overrides.el in the same directory.
  • setup-editing.el has interesting elisp snippets that I created + borrowed over time for functions related to general editing.

Key points

  • Use of my minor mode modi-mode to enable my custom key-bindings. Doing so allows me to force override my bindings in all major and minor modes. If I ever need to try out the default emacs bindings, I can simply disable modi-mode by doing M-x modi-mode. It is enabled globally by default.
  • Use of use-package in load all packages for faster load times.
  • Use of bind-keys allows me to review my custom bindings in a single buffer by doing M-x describe-personal-keybindings.
  • Certain packages will be loaded only if you have the associated applications installed.
    • rg
    • ctags
    • global (gtags)
    • git
    • matlab
    • aspell or hunspell
    • ps2pdf
    • xelatex
    • ag

Feedback

I am looking forward to suggestions, corrections.

Thanks!

.emacs.d's People

Contributors

hhnr avatar kaushalmodi avatar peterwvj avatar yuravg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

.emacs.d's Issues

Create a major-mode for "log files"

Couple of basic features I have in mind:

  • Navigate to next error/warning
  • Highlight error/warning/user entered string
  • jump directly to file+linenum corresponding to error/warning
  • expand/collapse errors/warnings

modi/eww-im-feeling-lucky can be improved

;; I'm-feeling-lucky
(defun eww-im-feeling-lucky (search-term)
"Google I'm feeling lucky."
(interactive (list (smart/read-from-minibuffer "Google Search Term (I'm Feeling Lucky!)")))
;; Keep on burying the current buffer if it turns out to be an eww buffer.
(while (string-match "^eww$\|^eww<[[:digit:]]+>$" (buffer-name))
(bury-buffer))
;; Start a new eww search.
(eww search-term)
(sleep-for 0.1)
;; https://stackoverflow.com/questions/16877882/how-to-access-google-search-im-feeling-lucky-functionality-using-api
(eww-browse-url (concat (eww-current-url) "&btnI")))

find the current instance block

I had one more usecase in addition to modi/verilog-jump-to-header-dwim & modi/verilog-jump-to-header-dwim-fwd

I want to know the current instance block in which the cursor is placed. I wrapped your function with jump-to-register to do this.
Does any of your functions do this native ?

(defun modi/find-curr-verilog-inst (fwd)
  "Display the module instantiation header above the current point."
  (interactive "P")
  ;;  https://github.com/atykhonov/iregister.el/blob/master/iregister.el
  (point-to-register 140)
  (if (modi/verilog-find-module-instance fwd)
      (if fwd
          (re-search-forward modi/verilog-module-instance-re nil :noerror)
        (re-search-backward modi/verilog-module-instance-re nil :noerror))
    (if fwd
        (re-search-forward modi/verilog-header-re nil :noerror)
      (re-search-backward modi/verilog-header-re nil :noerror)))
  (setq myStr (thing-at-point 'line))
  (message myStr)
  (jump-to-register 140)

)

The register I used is a fixed register. This needs to be modified.

tcsh init script: unknown file attribute: i

Hello,

I am trying to install your nice Emacs setup, but I stumble against an issue, perhaps due to tcsh syntax?

$ source git_force_update.csh ~/.emacs.d
git_force_update.csh:7: unknown file attribute: i

I am currently on OS X 10.10.5 and my tcsh version is

$ tcsh --version
tcsh 6.19.00 (Astron) 2015-05-21 (unknown-unknown-bsd44) options wide,nls,dl,al,kan,sm,rh,color,filec

select-enable-primary broke yanking on Windows

Yank don't work with active region when select-enable-primary is enabled on Windows.
Possible fix is: setup-misc.el

;; after mouse selection in X11, you can paste by 'yank' in emacs"
(if (not (eq system-type 'windows-nt))
    (>=e "25.0"
        (setq select-enable-primary t)  ; if emacs 25.0 or newer
      (setq x-select-enable-primary t))) ; if older

Emacs startup problem in daemon mode when nlinum/linum configured to be enabled globally

Hello,

I am sorry to raise this here.

I am trying to use the fix recommended by you here: http://debbugs.gnu.org/cgi/bugreport.cgi?msg=43;att=1;bug=18616

But, for some reason, nothing happens when I start emacs in daemon mode with that code snippet in my init.el. I am using GNU Emacs 24.4.1

Just want to check if the relevant code snippet is still valid.

Thanks again and Sorry for the bother,

This is the code snippet of what I tried:

(if (daemonp)
    (add-hook 'emacs-startup-hook
              (lambda ()
                (message ">> Daemon mode")
                ;; It is mandatory to load linum AFTER the frames are set up
                ;; Else, I get "*ERROR*: Invalid face: linum"
                (require 'nlinum)
                (global-nlinum-mode)
                ;;                 (nlinum-mode 1)
                ;;                 (add-hook 'find-file-hook 'nlinum-mode)
                ))
  (progn
    (message ">> Non daemon mode")
    (require 'nlinum)
    (global-nlinum-mode)
    ))

Improve quite emacs without saving desktop command

Right now "C-x M-c" quits emacs without forcing the user to save desktop. But it still asks the user if they want to save the desktop.

"C-x M-c" should just quit emacs without prompting the user to save the desktop.

Error modi/temporary-file-directory

Hi,
I don't have variable 'USER':

(defvar modi/temporary-file-directory (let* ((dir (file-name-as-directory (expand-file-name (getenv "USER") temporary-file-directory)))) (make-directory dir :parents) dir) "User-specific temporary directory name.")

probably on this emacs start ends with error(Windows OS):

Debugger entered--Lisp error: (wrong-type-argument stringp nil) expand-file-name(nil "c:/Users/MYNAME~1/AppData/Local/Temp/")Debugger entered--Lisp error: (wrong-type-argument stringp nil) expand-file-name(nil "c:/Users/MYNAME~1/AppData/Local/Temp/")

Use a regular org comment instead of #+HEADER to mark images needing pdf2png conversion

Your modi/org-include-img-from-pdf function seems awesome. However, I cannot get it work for me. My 'convert' is available in exec-path, and something like this works for me:

    #+BEGIN_SRC sh
    convert ./foo.pdf  ./foo.png
    #+END_SRC
    [[./foo.png]] 

Also I can invoke modi/org-include-img-from-pdf by M-x, just nothing happens after running the function. Would you advise how to solve this? Thank you very much!

projectile is adding .git folders to the list of known projects

Projectile was working fine for as long as I remember, but I think one of the recent updates might have been causing a bug. Projectile adds .git folder as another known project whenever I invoke magit on a projectile project. Here is a screenshot :-

enter image description here

Here is the link to my projectile config.


EDIT: I figured out the cause of the issue. It's this code snippet :-

;; Git projects should be marked as projects in top-down fashion,
  ;; so that each git submodule can be a projectile project.
  (setq projectile-project-root-files-bottom-up
  	(delete ".git" projectile-project-root-files-bottom-up))
  (add-to-list 'projectile-project-root-files ".git")

  (setq projectile-project-root-files-functions
  	'(projectile-root-local
  	  projectile-root-top-down ; First look for projects in top-down order
  	  projectile-root-bottom-up)) ; Then in bottom-up order

looks like the new update to projectile is causing the probelm. What's going on here? Does the same thing happen to your config?

`shell-command-on-region` doesn't seem to work

In emacs -Q session, if I do the following in the scratch buffer

C-x h M-| wc 

It gives the word count of the selected region: 3 30 145.

But if I do the same in my emacs session, the scratch buffer content gets replaced with 1 0 1!

Prevent the frame from jumping around when doing `C-x C-f`

When I do C-x m f, the frame is aligned properly in the position as set in the function full-screen-center. But when I do C-x C-f, the frame moves around. I then need to position the frame using the mouse. After the mouse-based frame adjustment, the frame doesn't jump around any more on doing C-x C-f.

Dedicated repo for eless?

Hey, I just saw your blog post about eless, and it looks very cool! What do you think about putting it in a separate repo? :)

my fork don't work :)

Why do you load 'cl-lib' only if emacs < 25 ?
init.el:

(>=e "25.0"
    nil
  (require 'cl)
  (require 'cl-lib))

Issues setting up emacs (version < 27)

NOTE: Some of the issues below may not be directly related to this emacs repo, but I wanted to document all the issues I faced when installing/setting up emacs on my Raspberry Pi.

Steps:

  1. Installed emacs using sudo apt install emacs. This installed version 26.1
  2. Ran ./force_update_emacsd.sh ~/.emacs.d
  3. Tried opening emacs, but failed to install melpa. Needed to create a temporary init.el file and added the following code from https://melpa.org/#/getting-started. NOTE: This also did not work until I changed 'https' to 'http' which I found suggested in some threads after googling the error (https://stackoverflow.com/questions/67062723/file-error-https-melpa-org-packages-archive-contents-bad-request-during-em).
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired.  See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
  1. Also needed to add this section from "Failed to download ‘MELPA’ archive" on the melpa link above.
    -- Error: Failed to download 'gnu' archive. Bad request
    -- Fix: (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
  2. Open emacs once using this temporary init.el file installed melpa successfully
  3. Then switched back to init.el from the git repo and it was able to open and install most of the packages.
  4. Now emacs opens with the following errors
Error (use-package): Failed to install mastodon: Package  emacs-27.1  is unavailable
Error (use-package): Cannot load org-entities
Error (use-package): ob/:init: Cannot open load file: No such file or directory, org
Error (use-package): org-sticky-header/:catch: Cannot open load file: No such file or directory, org
Error (use-package): org-link-ref/:catch: Symbol s function definition is void: org-add-link-type
Error (use-package): toc-org/:catch: Cannot open load file: No such file or directory, org
Error (use-package): org-noter/:catch: Cannot open load file: No such file or directory, org
Error (use-package): desktop/:config: Cannot open load file: No such file or directory, org

Simple solution is to probably install at least emacs 27.1 or above, but unsure of the best way to do that. I assumed sudo apt install emacs would install the most recently released version. Can you please advise?

Changing the hugo mode load

Hi,
There are no way to run your emacs configuration without loaded ox-hugo (git-submodule)

Warning (initialization): An error occurred while loading ‘c:/HOME/.emacs.d/init.el’:
File is missing: Opening directory, No such file or directory, c:/HOME/.emacs.d/elisp/ox-hugo/
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.

maybe it doesn't matter, but sometimes it is inconvenient

File permissions

Hi,
I clone your repository(or download zip-file),
go to the directory .emacs.d, run command:
find . -perm /o=x -not -path "./.git/*" -type f
I see 49 file with execute permission.
Is there a reason to have so many files with execute permission?

Thanks.

Pass also milliseconds to destructuring-bind

Hi there! Thanks for sharing your Emacs configuration.

I looked at your .emacs configuration to get more insipiration. I liked the ability to record the startup time of the emacs. So I wanted to steal your snippet of code. Currently I have the following in my init.el

;; Record the start time
(setq *emacs-load-start* (current-time))

(require 'package)
(package-initialize)

[Block of my preciousss configuration] 

  ;; Load destructuring-bind, which seems to be a common lisp function.
  (eval-when-compile (require 'cl))
  (eval-when-compile (require 'cl-lib))

;; Write out a message indicating how long it took to process the init script
(defun startup-time () 
    (message "Yo dude, Emacs recorded %f seconds to get started!"
         (destructuring-bind (hi lo ms ps) (current-time)
           (- (+ hi lo)
              (+ (first *emacs-load-start*)
                 (second *emacs-load-start*)))))
)


(add-hook 'emacs-startup-hook 'startup-time)

Everything worked fine at all. I wanted to get the milliseconds, so I see Emacs started up in 3.11 seconds instead Emacs started up in 3 seconds in the messages buffer. So I replaced the %d with the floating %f. However, I get zero decimals. I could't find anything in the documentation of destructuring-bind, to pass the milliseconds.

Any suggestion?

Probably you should use helm-gtags

I saw your issue on ggtags, so I will answer it hear. The answer is easy: since you already use Helm, use helm-gtags, it's really fast, since Helm buffer is basically fundamental-mode, unlike compilation buffer which contains text widgets, which is heavy when there are many entries to show.

Suggestion to improve

Hi Kaushal,
Thanks for sharing the setup-verilog.el. It is very useful and in one case (code written by someone else had the "#" and "(" in different lines or it has spaces in between.
I just added \\(?:\n\\|\\s-\\)+ between #( and made it to work for few more situations.

      (concat "^\\s-*"
              ;; force group number to 1; module name
              "\\(?1:" modi/verilog-identifier-re "\\)"
              "\\(?:\n\\|\\s-\\)+" ; newline/space
              ;; optional hardware parameters followed by optional comments
              ;; followed by optional space/newline before instance name
              "\\(#\\(?:\n\\|\\s-\\)+([^;]+?)\\(\\s-*//.*?\\)*[^;\\./]+?\\)*" ;;Updated by Shankar
              ;; force group number to 2; instance name
              "\\(?2:" modi/verilog-identifier-re "\\)"
              "\\(?:\n\\|\\s-\\)*" ; optional newline/space
              "(" ; opening parenthesis `(' before port list
              )
      "Regexp for a valid verilog module instance declaration.")

Regards,
Shankar

seems modi/eww--go-to-first-search-result not working properly

How about this, I tried, it seems work.

(defun modi/eww--go-to-first-search-result (search-term)
  "Navigate to the first search result in the *eww* buffer."
  ;; Keep on burying the current buffer if it turns out to be an eww buffer.
  (while (string-match "^eww$\\|^eww<[[:digit:]]+>$" (buffer-name))
    (bury-buffer))
  ;; Start a new eww search.
  (eww search-term)
  (let* ((max-wait 5)                 ;Seconds
         (search-repeat-interval 0.1) ;Seconds
         (max-trials (floor max-wait search-repeat-interval))
         (start-time (current-time))
         (n 1))
    ;; The while loop will keep on repeating every `search-repeat-interval'
    ;; seconds till the return value of `eww-links-at-point' is non-nil.
    (catch 'break
      (while (<= n max-trials)
        (goto-char (point-min))     ;Go to the top of the buffer
        ;; Go to the start of results
        ;; (re-search-forward "About.*results.*$" nil :noerror) ;; google.com
        (re-search-forward "約有.*項結果.*$" nil :noerror)      ;; google.com.hk
        (shr-next-link)             ;Go to the first search result
        (when (eww-links-at-point)
          (throw 'break nil))
        ;; Wait for a while before trying link check again.
        (sleep-for search-repeat-interval)
        ;; (message "eww search result trial # %d" n)
        (setq n (1+ n))))
    (message "Search for `%s' finished in %0.2f seconds."
             search-term (float-time (time-since start-time)))))

manually-synced directory

Hi,
May you explain, what is the purpose of the manually-synced directory?

I am confused by Git submodule elisp/manually-synced/hideshowvis/,
and files to manually-synced such as: elisp/spice-mode/spice-mode.el, elisp/verilog-mode/verilog-mode.el

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.