Welcome to JamesCherti.com

About the author

Hi, I am James Cherti, a Software and Infrastructure Specialist based in Toronto, Canada. With over two decades in the tech industry, I have had the privilege of working on everything from software development to managing complex UNIX/Linux systems and building scalable architectures. I am a terminal enthusiast who lives in the Bash shell, tmux, and Emacs, always looking for the next automation to write. When I step away from the terminal, you can usually find me in Toronto with a good cup of coffee,... (Read more)

Popular Articles

Recent articles

  • The Emacs security settings that might silently compromise your system
    Emacs ships with default settings intended for backward compatibility and convenience over strict security. The following settings enforce TLS certificate verification, reduce unintended ffap network lookups, restrict the evaluation of potentially unsafe local file, and directory variables, automated package review system, and protect authentication credentials stored by Emacs. Network and communication security By default, Emacs prompts the user interactively if a connection appears untrustworthy. You can additionally require certificate validation to fail at the TLS library level, causing invalid certificates to result in a connection error. Requiring certificate validation at the TLS layer reduces the possibility of accidentally accepting an … Continue reading
  • Securing Emacs .dir-locals.el and local variables
    Emacs automatically applies project-specific configurations through file-local and directory-local (.dir-locals.el) variables when opening a file or directory. While this feature ensures consistent settings across environments, it can cause security risks and persistent prompt fatigue when editing source code. Malicious .dir-locals.el files or file-local variables containing eval forms can execute arbitrary Lisp code if Emacs is configured to evaluate them, or if the user approves the relevant prompt by mistake. This article outlines configurations for securing file-local and directory-local variables while reducing prompts. Allowing safe local variables The enable-local-variables variable controls how Emacs handles file-local variables. File-local variables are configurations embedded … Continue reading
  • Fixing Emacs Dired defaults - Settings for better file management
    This article presents a set of Emacs Dired configuration changes to enhance file management. The configurations sort directories before files for easier navigation, hide dotfiles, reduce unnecessary confirmation prompts, prevent UI lockups caused by network latency, among other improvements. Each configuration explains the behavior of the relevant setting, its benefits, and its tradeoffs, making it easier to determine which changes are appropriate. Keeping Dired clean by hiding dotfiles Using dired-omit-mode helps hide hidden files and directories, such as .git or .DS_Store, by applying a specific regular expression. The tradeoff is that required configuration files are hidden by default, forcing you … Continue reading
  • Measuring Emacs startup time more accurately than the built-in emacs-init-time
    As an Emacs configuration grows, startup time can gradually increase. Measuring that increase accurately makes it easier to identify regressions. The majority of Emacs users use emacs-init-time. However, this built-in function does not measure all the work performed during startup. Emacs startup proceeds through several stages: it loads the early init and regular init files, processes command-line options, sets after-init-time, runs emacs-startup-hook, performs additional initial-frame setup such as applying frame parameters from the configuration, and then runs window-setup-hook after the initial frame parameters have been configured. This makes window-setup-hook a useful place to record a broader startup-time measurement. For a … Continue reading
  • Configuring Eglot for Python Development in Emacs: Integrating python-lsp-server (pylsp) with Linters and Formatters
    Eglot provides built-in LSP support in modern Emacs, giving developers a native interface for autocompletion, linting, and formatting. When paired with python-lsp-server (pylsp), creating a Python development environment comes down to managing the LSP server configuration properly. Historically, setting up this toolchain required wiring together a stack of individual utilities such as flake8 and isort. Now, ruff stands entirely apart from that legacy ecosystem by consolidating all of those separate checks into a single, high-performance Rust binary. This article demonstrates how to configure Eglot to detect and use Ruff dynamically when it is present on your system, while retaining a … Continue reading
  • Configuring Emacs Scrolling for Better Usability
    By default, scrolling in Emacs recenters the window when point moves off-screen, and rapid scrolling through large, heavily fontified files can introduce noticeable input lag. This article outlines configurations that make scrolling more predictable and responsive. Customizing scroll recentering Adjusting the automatic scrolling behavior can prevent Emacs from making large jumps when point moves beyond the visible portion of the window: When point moves off-screen or into the scroll margin, setting scroll-conservatively to a moderate value like 20 allows Emacs to scroll the text by up to 20 lines in either direction to bring point back into view. Note: Setting … Continue reading
  • Configuring Emacs Eglot for Better Performance and Latency
    Eglot ships with Emacs as a built-in, lightweight LSP client, and its default configuration is sufficient for most projects. However, working with large codebases can cause latency. When Eglot becomes sluggish, the problem may involve work performed by Eglot and Emacs as well as the language server itself. Event logging, filesystem watching, diagnostics, completion, and other editor activity can all contribute to latency. This article covers practical changes for keeping Eglot responsive when working with large projects. Auto-shutting down idle Eglot servers This reduces resource usage when switching between multiple projects. The eglot-autoshutdown variable shuts down the LSP server after … Continue reading
  • Copy-paste without Emacs org-mode or markdown-mode Formatting Bleeding Into Other Buffers
    When text is copied from an org-mode or markdown-mode buffer and pasted into another Emacs buffer, its visual formatting can sometimes follow it. For instance, text displayed with a particular color, background, or font weight in an Org or Markdown buffer can retain that appearance after being inserted into a Python buffer. This can be undesirable because the inserted text may then display with the source buffer's face text property instead of relying on the destination buffer's normal font-lock or syntax highlighting. Understanding the face text property In Emacs, visual formatting can be represented by the face text property. Some … Continue reading
  • Configuring Emacs Spell Checking with Flyspell, Ispell, and Aspell to Minimize False Positives in Source Code and Prose
    The ispell package serves as the underlying interface in Emacs for communicating with external spell checking programs. Building upon this, the flyspell package is a built-in minor mode that provides on-the-fly spell checking. It highlights misspelled words as you type and offers interactive corrections. This article presents a practical configuration for Emacs that sets up ispell to use Aspell for both programming and standard text editing. Additionally, it addresses a common issue for developers. While writing code, variables such as filepath or buffername in comments or docstrings are often flagged as errors, generating visual noise in your programming buffers. This … Continue reading
  • Emacs startup - Why setq beats setopt, customize-set-variable, and use-package :custom?
    Every millisecond counts during Emacs initialization. A potential performance cost in modern Emacs configurations is defaulting to setopt, customize-set-variable, or the use-package :custom keyword when a direct assignment with setq is sufficient. Disclaimer: This article assumes you have a solid understanding of Emacs Lisp and know what you are doing when switching to setq. For users who prefer a hands-off experience, defaulting to setopt or the built-in customization interface is often better for convenience, even though these options are not the fastest. Using setq is mainly intended for users who want to optimize startup performance. Always check the Elisp definition … Continue reading
  • Improving the Performance of Samsung Galaxy Phones and Tablets
    Out of the box, Samsung Galaxy Phones and Tablets are highly responsive, but long-term performance often degrades into noticeable lag. As background services, cached data, and memory paging overhead consume available CPU cycles and RAM, the entire system slows down. This article covers reducing storage I/O bottlenecks by disabling virtual memory paging, controlling process lifecycles through targeted app hibernation, accelerating UI rendering, and automating routine system maintenance. Storage and I/O Overhead Disabling RAM Plus RAM Plus borrows a portion of your devices's regular storage space (NAND flash or UFS) to hold apps you are not actively using so your faster … Continue reading
  • single-window.el - Always Open Emacs Buffers in the Current Active Window
    The single-window package forces Emacs to open buffers in the current active window. It keeps your carefully arranged layouts intact, reduces visual clutter, and provides a much more predictable workflow. To ensure it does not break standard Emacs functionality, the package is built to handle the following edge cases and integrations out of the box: Transient and Magit: Excludes Transient buffers by default, which ensures that Magit popup menus render correctly and manage their own window placement. Ediff control panel: Excludes the Ediff control interface so it can maintain its specific layout requirements without breaking. Temporary and utility buffers: Ignores … Continue reading
  • jc-gentoo-portage - An opinionated, performance-oriented Gentoo Portage /etc/portage configuration
    The jc-gentoo-portage repository houses an opinionated, performance-oriented Gentoo Portage (/etc/portage) configuration. This repository can be used as an inspiration to build a lean and fast Gentoo operating system. Features: Maximizes execution performance across the system by globally enabling xs, asm, orc, jit, and threads, forcing packages to use hand-written assembly routines and JIT compilation loops. Disables telemetry and remote RPC calls by globally setting -telemetry, -geoclue, -geolocation, -cloudproviders, -google, and -gnome-online-accounts. Optimizes Rust compiler outputs by enforcing modern instruction sets via target-cpu=native, opt-level=3, and strip=symbols. Links long-running daemons and high-throughput parsing utilities against jemalloc to guarantee flat memory profiles and … Continue reading
  • git-rexec: Find Git Repositories and Execute Commands Against Them, either Sequentially or in Parallel
    The git-rexec command-line tool recursively locates Git repositories within a directory and executes commands against them, either sequentially or in parallel. Here are examples demonstrating how to use git-rexec: Example 1: Execute git status -s across all discovered Git repositories (found by searching recursively under the current working directory) in parallel (-p or --parallel): git-rexec -p -- git status -s Example 2: Fetch updates across all discovered repositories, limiting the concurrency to 5 background jobs (-j 5), which helps avoid network congestion or server rate limits when communicating with upstream Git remotes: git-rexec -j 5 --parallel -- git fetch Example … Continue reading
  • ansible-cleanup - Cleanup an Ansible project
    Ansible-cleanup provides a command line tool to find and remove unused playbooks, tasks, group variables, and host variables. It maintains a clean codebase by recursively scanning your Ansible repository and listing files that are safe to delete. Features Identify unused playbooks and tasks: Scans the repository to find all unused playbooks and tasks. It analyzes the codebase and determines which playbooks and tasks are no longer referenced or used. Find unused YAML files in group_vars and host_vars: Parses the "hosts" file, load all hosts and groups into a data structure. It then scans the group_vars and host_vars directories, identifying any … Continue reading

← Older posts