From c724844da1f731460f83811378a781991d25f571 Mon Sep 17 00:00:00 2001 From: Gene Pasquet Date: Tue, 15 Nov 2022 14:45:01 +0000 Subject: Improved readme. --- README.md | 39 ++++++++++++++++++++++++++++++++++++--- barb-mode.el | 11 ++++++----- demo.gif | Bin 0 -> 460754 bytes 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 demo.gif diff --git a/README.md b/README.md index 0cd70ac..17f18ed 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,41 @@ # BARB-MODE - -## Getting started - Barb-mode is a major mode for emacs to edit and interact with request files for the [barb](https://gitlab.com/guillaume54/barb) HTTP query tool. + +![Animated demo](demo.gif) + +## Installation + +The supported method of installation is through the package manager +[straight.el](https://github.com/radian-software/straight.el). In +order to install barb-mode, add the following to your `init.el`: + +```lisp +(straight-use-package + '(barb-mode + :type git + :host gitlab + :repo "guillaume54/barb-mode")) +``` + +Then restart emacs. + +## Usage + +The mode will be automatically loaded whenever a `.barb` file is +visited. If you have chosen to use a different file extension, you can +start the mode by typing `M-x barb-mode`. + +The mode provides syntax highlighting for the *barb* preamble and +allows easy execution of the request directly in emacs by typing `C-c +C-c`. + +## Running a barb file + +In order to execute a barb file, the +[barb](https://gitlab.com/guillaume54/barb#installation) executable +must be installed on your system and on the `PATH`. Then pressing `C-c +C-c` should work. + diff --git a/barb-mode.el b/barb-mode.el index a6c8684..aa79110 100644 --- a/barb-mode.el +++ b/barb-mode.el @@ -16,11 +16,12 @@ (save-excursion (back-to-indentation) (let ((start-point (point))) - (move-beginning-of-line nil) - (let* ((line-start (point)) - (indent (floor (/ (- start-point line-start) tab-width)))) - (indent-to (* (1+ indent) tab-width))))) - (back-to-indentation)) + (unless (string= (string (char-after start-point)) "#") + (move-beginning-of-line nil) + (let* ((line-start (point)) + (indent (floor (/ (- start-point line-start) tab-width)))) + (indent-to (* (1+ indent) tab-width))))) + (back-to-indentation))) (defvar barb-mode-abbrev-table nil "Abbreviation table used by `barb-mode' buffers.") diff --git a/demo.gif b/demo.gif new file mode 100644 index 0000000..8e77ede Binary files /dev/null and b/demo.gif differ -- cgit v1.2.3