Punch Line

October 31, 2025 ยท View on GitHub

A modern, feature-rich mode line for Emacs

โค๏ธ Please sponsor me if you like this package

Screenshot of Punch-line and mode line for Emacs.

Features

  • ๐ŸŽจ Highly customizable appearance
  • ๐Ÿ‘ฟ Evil/Meow mode integration
  • ๐ŸŽต Music player integration (Apple Music/Spotify)
  • ๐ŸŒก๏ธ Weather information
  • ๐Ÿ“Š Git status and branch information
  • ๐Ÿ”‹ Battery status
  • โŒš Time display
  • ๐Ÿค– Copilot integration
  • โœ… Flycheck integration
  • ๐Ÿ“ LSP/Eglot support
  • ๐Ÿ“‹ Task management system
  • ๐ŸŽฏ Project awareness

Installation

(use-package punch-line
  :ensure nil
  :after ((after-init . punch-line-mode)        ;; Load punch-line
          (after-init . punch-weather-update)   ;; Load weather
          (after-init . punch-load-tasks))      ;; Load saved current tasks
  :config
  (setq
   punch-line-left-separator "  "
   punch-line-right-separator "  "
   punch-line-music-info '(:service apple)      ;; Music service configuration
   punch-line-music-max-length 80))             ;; Max length of artist and song

Feature Toggles

Feature ToggleDefaultDescription
punch-line-show-modal-sectiontShow Evil/Meow mode states
punch-line-modal-use-fancy-icontUse fancy icons for modal states
punch-show-git-infotDisplay Git branch and status
punch-show-project-infotShow current project information
punch-show-lsp-infotDisplay LSP/Eglot status
punch-show-copilot-infotShow Copilot status
punch-show-battery-infotDisplay battery status
punch-show-weather-infotShow weather information
punch-show-flycheck-infotDisplay Flycheck status
punch-show-processes-infotShow active processes
punch-show-org-infotDisplay Org-mode information
punch-show-misc-infonilShow miscellaneous information
punch-line-show-time-infotDisplay current time
punch-show-column-infonilShow column number
punch-show-buffer-positionnilDisplay buffer position
punch-show-what-am-i-doing-infotShow current task information
punch-battery-show-percentagetDisplay battery percentage

Task Management System

The built-in task management system helps you keep track of your current activities:

M-x punch-line-what-am-i-doing-next          # View next tasks
M-x punch-line-what-am-i-doing-done          # Mark current task as completed
M-x punch-line-what-am-i-doing-show-all      # Display all tasks
M-x punch-line-what-am-i-doing-next-task     # Switch to next task
M-x punch-line-what-am-i-doing-previous-task # Switch to previous task

Screenshot of a what I am currently working on.

Screenshot of a what I am currently working on.

All tasks.

Customization

Appearance

;; Mode line size
(setq punch-line-modal-size 'small)  ; Options: 'small, 'medium, 'large

;; Divider style
(setq punch-line-modal-divider-style 'circle)  ; Options: 'arrow, 'flame, 'ice, 'circle, 'block

;; Separators
(setq punch-line-left-separator "  ")
(setq punch-line-right-separator "  ")

Section Backgrounds

Customize background colors for individual mode-line sections:

;; Manual colors for specific sections
(setq punch-line-section-backgrounds
      '((filename . "#201010")
        (battery . "#000000")
        (git . "#1a1a2e")
        (major-mode . "#16213e")))

;; Automatic tinting - each section gets progressively lighter
(setq punch-line-section-backgrounds 'auto)
(setq punch-line-section-background-tint-step 5)  ; 5% lighter each section

;; Automatic with darker progression
(setq punch-line-section-backgrounds 'auto)
(setq punch-line-section-background-tint-step -5)  ; 5% darker each section

Available sections:

  • Left side: filename, major-mode, project, flycheck, what-am-i-doing, process
  • Right side: music, system-monitor, column, position, copilot, term, misc, git, weather, battery

Note: Evil/Meow status and time sections maintain their own styling and are excluded from section backgrounds.

Arrow Arrow

Circle Circle

Flame Flame

Ice Ice

None None

Block - Wraps modal and time in a solid block background with padding on all sides

Weather Configuration

(setq punch-show-weather-info t
      punch-weather-latitude "56.7365"
      punch-weather-longitude "16.2981")

Music Player Integration

(setq punch-line-music-info '(:service apple)  ; or 'spotify
      punch-line-music-max-length 80)

None

Cache Settings

;; Update intervals in seconds
(setq punch-git-cache-update-interval 5
      punch-battery-cache-update-interval 60
      punch-flycheck-cache-interval 3)

Weather Configuration Details

The weather module includes robust error handling and caching:

;; Weather fetch settings
(setq punch-weather-update-interval 3600        ; Update every hour (seconds)
      punch-weather-request-timeout 10          ; Request timeout (seconds)
      punch-weather-max-retries 3)              ; Max retry attempts

Weather Commands

M-x punch-weather-cleanup       ; Clean up timers and buffers
M-x punch-weather-force-update  ; Force immediate weather update

Changelog

Version 1.1 (2025-01-31)

Weather Module (punch-line-weather.el)

  • Fixed: "Selecting deleted buffer" errors during long Emacs sessions
  • Fixed: Race conditions with buffer lifecycle management
  • Added: Fetch guard to prevent multiple simultaneous API requests
  • Improved: Timeout handling with proper buffer cleanup
  • Improved: Error handling in async callbacks

Music Module (punch-line-music.el)

  • Fixed: Buffer lifecycle issues in process sentinel
  • Improved: Timeout handler now uses proper closure with process parameter
  • Improved: More robust buffer existence checks before operations

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.