Features I want (have no issue trying to add manually, but would like to see it there) -
- Project Management
- LSP with Linting
- Popup/Toggle-based Terminals
I’d be happy to explain / work with you on these requirements. What you are looking for:
project.el: Understanding what a project is (actions like searching in projects, switching projects, opening files in projects etc). IF you mean the other project management (task management) thenorg-modewhich is a beast of it’s own. Both are built-ins.eglotfor LSP. Invoke withM-x eglotfrom inside whichever project.- I did not understand what this means.
A long time back, I wrote some documents that you might find useful:
- What a Programming Editor should be able to do : a list of table-stakes operations, and key-bindings for my setup of Emacs: https://github.com/vedang/emacs-up/blob/master/docs/02_what_a_programming_editor_should_do.org
- An Opinionated Emacs Tutorial: Getting started fast. : A presentation I used to give in my previous work-place for getting started with Emacs: https://github.com/vedang/emacs-up/blob/master/docs/01_opinionated_emacs_tutorial.org (This is more philosophy than quick-tips, but might be useful to you)
- M-x locate <RET> refcard <RET>
- profit.
Eg: (funcall #’equal :a :A) => nil (funcall #’equal :a :a) => t
Taken right from the Emacs Manual (I always seem to forget this). http://www.gnu.org/software/emacs/manual/html_node/emacs/Regexp-Replace.htmlM-x replace-regexp <RET> c[ad]+r <RET> \&-safe <RET> replaces (for example) ‘cadr’ with ‘cadr-safe’ and ‘cddr’ with ‘cddr-safe’.
M-x replace-regexp <RET> \(c[ad]+r\)-safe <RET> \1 <RET> ‘\d’ in newstring, where d is a digit, stands for whatever matched the dth parenthesized grouping in regexp. Note : The parens making groups need to be escaped.
(require 'loadhist)
(file-dependents (feature-file 'cl))- Run the command
sudo apt build-dep emacsand copy all the packages it will install. (Don’t actually install the packages) - Remove all the ImageMagick related libraries from this command, we have installed it from source.
- Review the output of
./configurecommand in Emacs. See if there are new options which are not covered by your distribution’s old version of Emacs.
sudo apt install libx11-dev libtiff5-dev libtiff-dev libgif-dev libjpeg-dev libpng-dev libxpm-dev libcairo2-dev libexif-dev libexpat1-dev libglx-dev libgmp-dev libgnutls-openssl27 libgnutls28-dev libgraphite2-dev libharfbuzz-dev libharfbuzz-gobject0 libice-dev libidn2-dev libilmbase-dev libilmbase25 libjbig-dev libjpeg-turbo8-dev libgnutlsxx28 libjpeg8-dev liblcms2-dev liblockfile-bin liblockfile-dev liblockfile1 liblqr-1-0 liblqr-1-0-dev libltdl-dev liblzma-dev libm17n-0 libm17n-dev libgtk-3-dev libncurses-dev libncurses5-dev libopenexr-dev libopenexr25 libopengl-dev libopengl0 libotf-dev libotf0 libp11-kit-dev libpango1.0-dev libpixman-1-dev libpng-dev libpthread-stubs0-dev librsvg2-dev libsm-dev libsub-override-perl libsystemd-dev libtasn1-6-dev libthai-dev libtiff-dev libtiffxx5 libtool libunbound8 libwayland-bin libwayland-dev libwmf-dev libwmf0.2-7 libx11-dev libxau-dev libxaw7-dev libxcb-render0-dev libxcb-shm0-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxkbcommon-dev libxmu-dev libxmu-headers libxpm-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev m17n-db nettle-dev pango1.0-tools po-debconf postfix quilt sharutils wayland-protocols x11proto-core-dev x11proto-dev x11proto-input-dev x11proto-randr-dev x11proto-record-dev x11proto-xext-dev x11proto-xinerama-dev xaw3dg xaw3dg-dev xorg-sgml-doctools xtrans-dev xutils-dev gnutls-bin graphviz autopoint gsfonts libxaw3dxft8-dev libwebkit2gtk-4.0-dev libgccjit-10-dev libjson-c-dev libjson-glib-dev libjansson-devNote: if you are doing this for the first time, you need to run ./autogen.sh as the first command. This command creates the configure script and various Makefiles, which we use in the next commands.
make distclean
./autogen.sh
./configure --with-imagemagick --with-json --with-native-compilation --with-xft --with-xwidgets --with-pgtk --with-tree-sitter
# Alternative configure command:
./configure --without-toolkit-scroll-bars --with-x-toolkit=gtk3 --with-xpm=ifavailable --with-jpeg=ifavailable --with-gif=ifavailable --with-tiff=ifavailable --with-xml2 --with-rsvg --without-pop --with-png --with-mailutils --with-native-compilation --with-cairo --with-harfbuzz --with-tree-sitter --with-sqlite3
# If everything works
make bootstrap
# If everything works
make
# Test the binary
src/emacs -Q
# Install the binary
sudo make installNotes:
- There is no
Makefilebefore you runautogen.shfor the first time. - You need to install
libgccjit-<x>-devwhere<x>is your gcc version.gcc --version. (for native compilation support) - You need to install
libtree-sitter-dev(for tree-sitter support)
Initially, I had a linker failure ld: library not found for -lwebp. I added the line brew 'webp' to the Brewfile to install this dependency. However, later I realized that the problem was because the correct LIBRARY_PATH was not being set. So I’m not sure if this change is needed.
The actual commands I executed were:
brew bundle
export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib/
export CPATH=$CPATH:/opt/homebrew/include/
./build-emacs-for-macos --git-sha c00ffe263d9ffeb4d2a5e13cc124c786152137dbOnce compilation was successful, I extracted the .tbz file created under builds and signed it as explained in https://github.com/jimeh/build-emacs-for-macos/pull/65/files
codesign --force --deep -s - Emacs.app- I’m always looking for stuff in Org-Mode Tables, so check there for common tasks first.
- All tips taken from https://twitter.com/search?lang=en&q=dired%20(from%3Ailemming)
M-x magit-dired-log
and it will show commits but only related to those files?
Let’s say you want to recursively find all*.scss files and then
mark those that contain “mixin”, so you can then move them or rename,
delete etc.
M-x find-name-dired % g mixinOf course you know about this feature of dired-mode.
You can “peek” into a subdirectory by pressing <i>
But did you know you can “insert” dirs recursively?
Use an argument and -R option.
C-u i -R RET
- Install
dired-narrow
You can mark files in Dired-mode and pipe them into a program.
- Mark files -
m - M-x dired-do-shell-command -
!orX - M-x dired-do-shell-command-async -
& - Command:
wc-lto run the command on each marked file,wc -l *to run the command on all the files in one go.
- get output of “find” or “ls”,
- edit it,
- then do `M-x dired-virtual`
if you’re still not convinced that Emacs is dope - stay tuned, I’ll keep posting cool tips
- Use
wdiredfor this. - Activate writable mode in Dired using
M-x dired-toggle-read-onlyorC-x C-q - Make all the edits as you would in a normal buffer
- Exit Wdired and commit the changes, using
C-x C-sorC-c C-c
- Open the target directory in Dired. Position the cursor on the
.entry and copy the absolute path usingM-0 w. - Open the source directory in Dired. Mark all the files you want to move. Press
Rto trigger the move and paste the absolute path. - Press Enter, done.
sql-interactive-mode is excellent and my preferred way of interactive with a database that supports SQL.
To start a SQLi buffer + work against a database:
M-x sql-<name-of-db>(eg:sql-postgres). If you have the.dir-locals.elfile (see below), values will be auto filled in. This will start an interactive SQL buffer.- Open a .sql file to write SQL in.
- In this file,
M-x sql-set-product, followed byM-x sql-set-sqli-buffer.
To speed up connection to an SQL database, add the following to a .dir-locals.el file:
((sql-mode . ((sql-product . postgres)
(sql-user . "pgw")
(sql-password . "")
(sql-port . 5432)
(sql-server . "192.168.33.10")
(sql-database . "pgw-main"))))- State “RESTRUCTURED” from [2021-10-18 Mon 18:01]
Outdated now, please refer to Compiling and Running Emacs 28 on master branch (Ubuntu).
$ git clone git://git.savannah.gnu.org/emacs.git
$ sudo apt-get install libxaw7-dev libjpeg-dev libgif-dev libxpm-dev libpng12-dev libtiff4-dev libncurses5-dev libtinfo-dev libglib2.0-dev intl-fonts libgtk2.0-dev libxaw3dxft6 librsvg2-dev imagemagick libdbus-1-dev libgconf2-dev libm17n-dev libotf-dev graphicsmagick-libmagick-dev-compat
$ make distclean $ ./autogen.sh $ ./configure –prefix=/opt/emacs/ –with-xft –with-x-toolkit $ make bootstrap $ sudo make install
$ brew install emacs –HEAD –cocoa –use-git-head
$ brew linkapps
$ make tags
- State “RESTRUCTURED” from [2021-10-18 Mon 18:02]
- Outdated, please refer to Compiling and Running Emacs 28 on master branch (Ubuntu).
./autogen.sh
./configure --with-nativecomp
# If everything works
make
# Test the binary
src/emacs -Q
# Install the binary
sudo make install
- Ensure that libgccjit is installed and at the latest version (at this point in time, the latest version is 10)
- Ensure that gcc is at the same version as libgccjit (also 10)
- Install the Ubuntu toolchain PPA for the latest versions of gcc and libgccjit.
- After updating / installing the latest gcc, libgccjit-* packages,
you will need to use update-alternatives to ensure that the correct
tools are being picked.
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 sudo update-alternatives --config gcc sudo update-alternatives --config g++ - Ensure that gcc-10 is selected, so that you don’t see the ‘failed smoke test’ error message from libgccjit.
- Emacs needs a number of different libraries during compilation. You
should look for an install the
-devversion of any such libraries that are missing. (Eg:libxpm-dev,libgif-dev,libtiff-dev)
- Add this to your init.el
(if (and (fboundp 'native-comp-available-p) (native-comp-available-p)) (setq comp-deferred-compilation t) (message "Native complation is *not* available"))
- The message in the above code will also tell you whether the Native Compilation binary is correctly built.
- As a one-time run, you can also execute the following code after
M-x ielm(native-compile-async "/home/<yourname>/.emacs.d" t)
- This will create all the necessary
.elnfiles for you.
- Best to just reinstall all the packages you depend on, to ensure that they get compiled properly.
- Very little configuration code broke for me (only one
isearchmodification broke, which usedsubstitute-key-definitionand substituted a function which took optional arguments with another function which took 0 arguments. This seems to not work within native compilation.