I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2.6 KiB

Shell

Override the default behaviour of the Shell environment to integrate with Emacs.

Profile

Override the default shell profile under Bash.

Force colours

Manually set the terminal type to xterm-256color for better colours on TTY Emacs.

export TERM=xterm-256color

Setting up the $PATH

Ensure ~/.local/bin added to the $PATH environment variable.

export PATH=$PATH:~/.local/bin

Starting Emacs by default on TTY1

When launching into a new session on TTY1, if the display server is not running, run StartX1. This will launch the window manager.

if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
    exec startx
fi

Creating symbolic links

The system looks for the default shell profile under Bash at ~/.profile. Creating a symbolic link from this location to our configuration will override the startup behaviour.

(dotfiles/symlink "~/.emacs.d/config/profile"
                  "~/.profile")

Methods

Define methods for interaction between Emacs and the underlying shell environment.

Run an external process

Define a method to run an external process, launching any application on a new process without interferring with Emacs.

(defun dotfiles/run (cmd)
  "Run an external process."
  (interactive (list (read-shell-command "λ ")))
  (start-process-shell-command cmd nil cmd))

Apply command to call process

Define a method to apply commands to the current call process, this is to avoid issues with hooks but can impact the performance of Emacs.

(defun dotfiles/run-in-background (cmd)
  (let ((command-parts (split-string cmd "[ ]+")))
    (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))

Keybindings

Place keybindings for executing shell commands behind SPC x:

  • Run shell commands with x

  • Run async shell commands with z

(dotfiles/leader
  "x" '(:ignore t :which-key "Run")
  "xx" '(dotfiles/run :which-key "Run")
  "xz" '(async-shell-command :which-key "Async"))