Code Monkey home page Code Monkey logo

aggressive-indent-mode's Introduction

aggressive-indent-mode Melpa Melpa-Stable

electric-indent-mode is enough to keep your code nicely aligned when all you do is type. However, once you start shifting blocks around, transposing lines, or slurping and barfing sexps, indentation is bound to go wrong.

aggressive-indent-mode is a minor mode that keeps your code always indented. It reindents after every change, making it more reliable than electric-indent-mode.

Demonstration

  • An example of Lisp mode (Emacs Lisp): Lisp Code Example

  • An example of non-Lisp mode (C): C Code Example

Instructions

This package is available from Melpa, you may install it by calling

M-x package-install RET aggressive-indent

Then activate it with

(add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode)
(add-hook 'css-mode-hook #'aggressive-indent-mode)

You can use this hook on any mode you want, aggressive-indent is not exclusive to emacs-lisp code. In fact, if you want to turn it on for every programming mode, you can do something like:

(global-aggressive-indent-mode 1)
(add-to-list 'aggressive-indent-excluded-modes 'html-mode)

Manual Installation

If you don't want to install from Melpa, you can download it manually, place it in your load-path along with its dependency cl-lib (which you should already have if your emacs-version is at least 24.3).

Then require it with:

(require 'aggressive-indent)

Customization

The variable aggressive-indent-dont-indent-if lets you customize when you don't want indentation to happen. For instance, if you think it's annoying that lines jump around in c++-mode because you haven't typed the ; yet, you could add the following clause:

(add-to-list
 'aggressive-indent-dont-indent-if
 '(and (derived-mode-p 'c++-mode)
       (null (string-match "\\([;{}]\\|\\b\\(if\\|for\\|while\\)\\b\\)"
                           (thing-at-point 'line)))))

Contribute

Gratipay

aggressive-indent-mode's People

Contributors

celeritascelery avatar davidshepherd7 avatar expez avatar joaotavora avatar leungbk avatar leuven65 avatar liuchong avatar malabarba avatar monnier avatar okamsn avatar peterwvj avatar prometeo avatar purcell avatar raxod502 avatar silex avatar skangas avatar spwhitton avatar tmurph avatar tsdh avatar tuhdo avatar wilfred avatar yyoncho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aggressive-indent-mode's Issues

Ruby identation problem

class PrimeWorker
  include Celluloid

  def prime(number)
    if number.prime?
      puts number
    end
  end
end

pool = PrimeWorker.pool

If I delete the spaces of the second end and its enter I get:

class PrimeWorker
  include Celluloid

  def prime(number)
    if number.prime?
      puts number
      endend
    end
    pool = PrimeWorker.pool

And now if I add the enter again the identation is not set correctly:

class PrimeWorker
  include Celluloid

  def prime(number)
    if number.prime?
      puts number
    end
  end
    end

    pool = PrimeWorker.pool

Extreme slowdown with large Clojure functions

In some of my clojure source files, I encounter quite extreme slowdowns due to a-i-m. I think that happens mostly in very large, deeply nested functions, and it seems to happen only when I have unsaved changes.

Here's a profiler stat gathered by doing a small edit, then moving around in the clojure function definition with C-n, C-f and friends. When pressing and holding C-f it is even possible that emacs freezes for one or two seconds.

- aggressive-indent--softly-indent-defun                         9813  86%
 - if                                                            9813  86%
  - progn                                                        9694  85%
   - let*                                                        9694  85%
    - unwind-protect                                             9691  84%
     - progn                                                     9676  84%
      - condition-case                                           9676  84%
       - progn                                                   9676  84%
        - aggressive-indent-indent-defun                         9676  84%
         - let                                                   9676  84%
          - indent-region                                        9602  84%
           - indent-according-to-mode                            9422  82%
            - lisp-indent-line                                   8942  78%
             - calculate-lisp-indent                             8259  72%
              - clojure-indent-function                          3199  28%
               - clojure-backtracking-indent                     2221  19%
                  forward-sexp                                   1140   9%
                + backward-up-list                                833   7%
               + lisp-indent-specform                             453   3%
                 split-string                                      25   0%
                 forward-sexp                                      14   0%
                 last                                               3   0%
              - beginning-of-defun                               1306  11%
               + beginning-of-defun-raw                          1228  10%
           + save-excursion                                        90   0%
             progress-reporter-do-update                           13   0%
             make-progress-reporter                                 6   0%
  + or                                                            119   1%
+ ...                                                             823   7%
+ timer-event-handler                                             268   2%
+ command-execute                                                 209   1%
+ redisplay_internal (C function)                                 156   1%
+ eldoc-pre-command-refresh-echo-area                             101   0%
+ highlight-symbol-mode-post-command                               25   0%
+ hl-paren-initiate-highlight                                       9   0%

The profiler ran maybe for 10 to 20 seconds where I've moved around. Nearly 10000 indentation calls seem a bit too much (ok, I have a keyboard repeat rate of 60Hz), especially because I just moved and didn't change anything.

Wouldn't it be possible to inhibit re-indentation in case there hasn't been an edit operation since the last re-indent?

BackSpace Does not Delete a Line

I am not sure if it is because of the package or not. Backspace does not delete the line. When the curser get to the beggining of the line, one expect that Backspace will then delete the line and place the curser at the end of the previous line. However, instead of that, Backspace immediately becomes TAB and indent the line instead.

This started with the new update. I experience the issue with c++ mode.

De-indent in c++ mode with nested levels

I've been having issues with my c++ code ending up wrongly indented at the end of files. After some testing I've narrowed it down to the below test case.

First, start with this

void a()
{
    {
    }
}

// comment
void b()
{
}

Then, add an open brace in a(), which indents everything following it, except for the comment (which is as desired)

void a()
{
    {
        {
        }
    }

// comment
    void b()
    {
    }

Finally, close the open brace that was added. a() will properly deindent, but b will stay (wrongly) indented

void a()
{
    {
        {}
    }
}

// comment
    void b()
    {
    }

This issue doesn't happen if a() does not have the extra scope, or if the comment is removed. I presume this has something to do with indent-region-and-on noticing that the comment's indentation doesn't change, but I'm not sure why it only happens for de-indent and why the extra scope matters.

If it matters, I'm using 4 spaces for indentation, with c-default-style set to linux.

Option to align columns in a clojure let?

Would it be possible to have this?

(let [longName 1
      y        2])

Currently the 2 isn't aligned to 1. Would be nice to optionally have it aligned. Though I'm not sure of the implication of this feature on the rest of the features.

`names` related messages at emacs startup

Today I noticed the below messages for the first time:

[names] No :package given. Guessing `aggressive-indent'
Edebug: names-edebug-anon13
Edebug: names-edebug-anon14
Edebug: names-edebug-anon18
Edebug: names-edebug-anon19

I had a barrage of package updates over the weekend.

If you cannot see the same messages, I can start bisecting what's causing these.

aggressive indent not updating all effected regions

agressive-indent-demo

Looks like aggressive indent no longer considers def goodbye as being something that should be updated when the parens are closed.

Not sure if this is a ruby mode issue or a aggressive indent mode issue.
calling M-x indent-region restores the class to proper indentation.

aggresive-indent will lock the indent

"aggressive-indent-mode is a minor mode that keeps your code always indented."
that is great, but the problem is that it will lock the indent, I couldn't even manually use SPACE key insert a single space or TAB or C-q TAB to insert a tab at the beginning of a line in the indent.

I found this annoying when I first used it in scratch buffer, because I always want to copy and paster some snippets(elisp or C code, different modes of code) into that buffer and make a little modification like indent or someting else, but aggressive-indent won't let me do the indent, and because scratch buffer default mode is lisp-interaction-mode, I have to do

(add-to-list 'aggressive-indent-excluded-modes 'lisp-interaction-mode)

in .emacs, but this problem occurs to me when I edit other modes of file too, I don't want to exclule the mode again, here is an example in .bashrc in conf-unix-mode:

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

it will automatically move the . /etc/bashrc to the beginning of the line, and I cannot use TAB to indent or C-q TAB forcely insert a tab, I cannot even use SPACE to insert spaces.

So the best solution is you can automatically indent the rest the indent when typing, but please pease do not lock it.

AND another thing is it will automatically format the whole buffer after saving it or something, what I really want is do not do I ditn't ask, such as paster a C code snippet into scratch buffer which is lisp-interaction-mode, it will format(which is totally different) the code snippet automatically if you move point after pasting, please just do indent(to be aligned) the part of code snippet I'm editing and nothing more, maybe you can add some options for us to turn on or off.

How to diagnose aggressive-indent related loops?

I'm currently having an issue with aggressive-indent enabled in es-mode, if I start with a completely blank buffer, turn on es-mode, then do M-x aggressive-indent-mode and type "P" emacs hangs and I can not do anything. It also uses 100% CPU during this time.

I'm not sure if this is my fault (inside of es-mode, maybe I defined the indenting improperly?), or an issue with aggressive-mode itself. Do you know of a way to diagnose this to determine what's causing it?

(void-variable indent) when evaluating (global-aggressive-indent-mode 1)

I get this when trying to evaluate (global-aggressive-indent-mode 1) as per instructions

Debugger entered--Lisp error: (void-variable indent) byte-code("\301\302!\210\301\303!\210�\207" [indent require cl-lib names] 2) (global-aggressive-indent-mode 1) eval((global-aggressive-indent-mode 1) nil) elisp--eval-last-sexp(nil) eval-last-sexp(nil) funcall-interactively(eval-last-sexp nil) #<subr call-interactively>(eval-last-sexp nil nil) ad-Advice-call-interactively(#<subr call-interactively> eval-last-sexp nil nil) apply(ad-Advice-call-interactively #<subr call-interactively> (eval-last-sexp nil nil)) call-interactively(eval-last-sexp nil nil) command-execute(eval-last-sexp)

Ruby bug

Hello,

The following scenario bugs:

test

As you can see after the begin/end, the rest is missindented. I had to go there and press tab to indent it.

How to don't indent after >

How can I modify the aggressive-indent-dont-indent-if setting given to also wait to indent until > is pressed on the keyboard.

I would like to have this to stop indentation while writing HTML markup code.

Thank you for such a great package!

Indent even when region is active.

When moving code blocks around with the move-text packages aggressive indentation isn't being triggered until I press C-g to clear the mark around my text.

This youtube-video says more than 10³ words though.

I have no idea if this is fixable in a non hacky way or so, if not just close this. :)

Thanks for an awesome package!

Excessive cursor movement with comments in elisp

I find the jumpy cursor movement when typing a new comment to be awkward.

Starting with the cursor on an empty line:

|

type a single semicolon, and point is very indented:

                                        ;|

type a second one, and point jumps back:

;;|

I know this is a matter of taste. Personally, I think aggressive-indent-mode should do nothing inside comments. What do you suggest?

Support languages where indentation is not absolute (python, haskell, cofee, etc)

Hello, I would like to report a bug that I can reproduce on python mode.
here is the steps to reproduce python the bug.

  • start with aggresive-indent-mode disabled
  • write following sample code
def fun1(a, b):
    return (a, b)


def fun2(a, b):
    value = {'a': a,
             'b': b,
             }
    value2 = fun(a,
                 b)
    return value, value2

The problem here is the function call fun(a, b) should be fun1(a,b)

  • enable aggresive-indent-mode
  • change fun function call with fun1.
  • At this moment aggresive-inden-mode changes the code to this.
def fun1(a, b):
    return (a, b)


def fun2(a, b):
        value = {'a': a,
                 'b': b,
                 }
                value2 = fun1(a,  # function fun should be fun1
                              b)

                return value, value2

Which is not a valid document.

And I see that aggresive-indent mode is forcing whole document to change indentation. I imagined it would change only the secition of the file.

Thanks.
By the way this is an awsome idea.

Aggressive indent hinders deleting lines

Say you are in elisp mode and write a list like below where | is the location of point.

(foo
 bar|)

Now you notice that bar shouldn't be in the list, so you repeatedly hit DEL. I'd expect that after hitting DEL five times in a row, you end up with (bar|). However, after hitting DEL three times you end up with

(foo
 |)

and any further DEL won't change anything.

On a related note, when I have

(let ((foo 1)
      (bar 2)|))

and want to delete the bar binding, I'd delete it with ESC C-backspace (backward-kill-sexp) so I end up with

(let ((foo 1)
      |))

and then do M-SPC (cycle-spacing in emacs trunk) twice which would end up in

(let ((foo 1)
|))

followed by DEL to get me to

(let ((foo 1)|))

With aggressive indent, the effects of cycle-spacing are undone immediately.

Both problems can be "fixed" by adding backward-delete-char (and paredit-backward-delete) and cycle-spacing to aggressive-indent-protected-commands. But that's not really what I want. The current behavior is good except if the line's contents before point is only whitespace.

An idea for coping with this situation was to allow aggressive-indent-protected-commands entries to also be cons cells of the form (PREDICATE . COMMAND) where COMMAND is only protected if PREDICATE returns non-nil. Then I could configure

(add-to-list 'aggressive-indent-protected-commands
             (cons (lambda ()
                     (looking-back "^[[:space:]]*"))
                   'cycle-spacing))

to satisfy my needs.

aggressive-indent-mode sometimes delays handling of keys until next key is typed

Since some time, I sometimes have the situation that I type "foo" but only "fo" is inserted in the buffer. Then I type SPC and see "foo" but not the space, etc., so the last key is inserted only after the next one has been typed.

This has completely been irreproducible for me but just now I found a recipe, and it seems to be aggressive-indent-modes fault, or maybe aggressive-indent-mode triggers a bug inside emacs (current git master and a-i-m from MELPA as of today but I have that problem for several months and update daily).

Ok, here we go.

  1. emacs -Q
  2. M-x package-initialize
  3. M-x global-aggressive-indent-mode
  4. C-x C-f ~/test.sh
  5. Type "if true" but only "if tru" is displayed. Type DEL and then you'll see "if true". Now move, e.g., with C-b and see how the displayed text catches up to "if tru".

Note that it seems to be important what you type. When I try typing "foo" initially, it all works fine. It has to be a keyword like "if". When you use "while" instead, that strange behavior starts after typing the "e", i.e., it starts as soon as you have typed the complete keyword.

Oh, and it is not limited to editing commands. If after typing the initial "if" I do C-h f some-function RET nothing seems to happen. Only after I type any further key, the window is split and the *Help* buffer is shown.

Also, when that wicked behavior started, emacs takes 100% of one CPU core here.

While the recipe is with sh-mode, I had this problem several times with clojure-mode, too.

Does not go along with electric-indent-mode

For some reason, when I put in my .emacs the following
(global-aggressive-indent-mode 1)
(electric-indent-mode 1)
and fire emacs and open a .cpp file, electric-indent-mode is not enabled. When I press "Enter" it does not go automatically to the correct indentation.

Wish: Indent only after changes

Thanks for this useful package!

Aggressive Indent Mode indents code after every command and this can slow down navigation (at least, this is what I experience with some large Emacs Lisp files). Also, standard Emacs libraries are not indented properly, and just skimming the code of a library can modify the buffer contents, making Emacs prompt for saving when the buffer will be closed. Therefore, it would be useful to have an option to indent only after modifications.

Thanks for your attention.

Don't indent inside docstrings (or strings in general)

I've noticed that when editing docstrings, those get indented as well. IMHO, docstrings and strings in general should be verbatim, so I'd propose to disable aggressive indent there, i.e., when (nth 3 (syntax-ppss)) is non-nil.

Serious conflict between aggressive-indent and Evil

Bug report

Setup:

GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32)
of 2015-07-25 on KAEL
Compiled from EmacsW64.

Evil, using the latest version of Evil from MELPA
Agressive indent mode, using the latest version from MELPA

Windows 7 x64 bit.

Situation:

Load the Evil and Agressive indent with use-package.

Then load this snippet as foobar.el inside Emacs.
For example, in normal mode, press /, and type vimish. Then press f, and then 1.

Replace it fast with 2, then proceed fast in normal mode to go left-left-right. Look how weird the cursor behaves, it will not going right. 😳

It will not occur when aggressive-indent will be disabled.

This bug bothered me for many days, and costed me many hours to track it down to aggressive indent with bisecting my configuration. 😦 .

In default Emacs configuration with only Evil and Aggressive-indent, I get the same issue.

Any idea why aggressive-indent caused this?

aggressive-indent-mode is quietly disabled in cc-mode based modes in emacs 24.4+

Since emacs 24.4 cc-mode sets electric-indent-inhibit by default, which combined with this commit cripples aggressive-indent-mode in many programming modes. I say cripples because the mode is still enabled but doesn't do anything (which was quite confusing).

Here's the emacs commit in question, in case that's useful.

I don't have any useful ideas for how to get around this sorry. Personally I've just reverted the aggressive-indent-mode commit that checks electric-indent-inhibit to get it working again.

Issue with manual commenting in cc-mode derived modes

In cc-mode derived modes such as java-mode, the beginning / of a comment causes unwanted indentation, e.g.:

java comment indentation

Not sure how possible or easy it is to fix this. Using something like comment-dwim gives correct behaviour but I often find myself for whatever reason beginning comments manually and run into this. My elisp abilities are pretty bad so I wasn't able to glean much from -internal-dont-indent-if to fix it myself 😕

aggressive-indent very slow in bigger C functions

Hi,
if I type something in a bigger C function, I have to wait a few seconds to see the changes.
The prefer-defun option not enabled for c-mode (this option seems to slow it down even more in c-mode).
I have it checked with emacs -q and only aggressive-indent-mode enabled.
Thanks

When smerge-mode is enabled, let aggressive-indent does nothing

When I was performing a merge in a buffer using smerge-mode, aggressive-indent appends spaces before the conflict marks "<<<<<<<<" , thus disable the conflict region that smerge-mode can see. aggressive-indent should do nothing when it detects smerge-mode is enabled.

add it to `before-save-hook` not on the fly

Can I use it after saving the file using C-x C-s, not indent on the fly:

(add-hook 'before-save-hook ...)

FYI, do not consider the buffer like *Scratch* that is not associated with any file.

trailing whitespace

I've got "whitespace" mode on globally pointing out my trailing whitespace, mixes of tabs/spaces, etc. aggressive-indent will force indentation to exist even if I use something like delete-traliing-whitespace. Can there be an option to NOT add indentation if it just ends in a newline? I looked at the code and couldn't figure out the right place to patch this.

Way to not remove space before let/loop bindings in Clojure

Say I have the following:

(defn min-dot [xs ys]
  (let [a (sort > xs)
        b (sort < ys)]
    (apply + (map * a b))))

If I delete the b inside the let binding to change it, a-i-m automatically deletes the following empty space as well. This is fine in most cases, but it is a problem in conjunction with lispy. I am wondering what I need to add to aggressive-indent-dont-indent-if so that a-i-m will not remove that space, I couldn't quite understand the example in the documentation.

Please Use Tags For Melpa-Stable

I'm not really a big fan of raw Melpa, it's hosed my setup on more than one occasion. Thankfully the same maintainers have released Melpa Stable which uses tags instead of commit-dates. This lets app maintainers have Melpa like convenience while only releasing specific versions.

I'd appreciate it if you'd create the tags required to release onto melpa-stable!

Install from MELPA, compile error

Install from MELPA, "aggressive-indent.el:94:1:Error: Lisp nesting exceeds `max-lisp-eval-depth'" shows in the Compile-Log buffer.

Erlang indentation does not work

When you delete a ] for example, it moves cursor to the next line.

You can try with the following code

-module(thorerl).
-export([
         parse/3
        ]).

parse(Module, Args, Url) ->
    try
        process(Module, Args)
    catch
        _:{error, Message} ->
            io:format("~s~n", [Message]),
            halt(1);
        _:Exception ->
            io:format("An unexpected error ocurred.~n"
                      "Please fill a new issue ~s~n~n"
                      "Error: ~p~n"
                      "Stacktrace:~n~p~n"
                      "Arguments: ~p~n",
                      [Url , Exception, erlang:get_stacktrace(), Args]),
            halt(1)
    end.

process(Module, []) ->
    print_help(Module, []);
process(Module, ["help" | Opts]) ->
    print_help(Module, Opts);
process(Module, [Function| Opts]) ->
    Function2 = erlang:list_to_atom(Function),

    code:ensure_loaded(Module),
    Exported = erlang:function_exported(Module, Function2, 1),

    exported(Exported, Module, Function2, Opts).

exported(false, Module, Function, Opts) ->
    io:format("Command ~p with arguments ~p is not supported~n~n", [Function, Opts]),

    print_help(Module, Opts),
    halt(1);
exported(true, Module, Function, Opts) ->
    ok = Module:Function(Opts).

print_help(Module, []) ->
    Help = Module:help(),

    Padding = padding_size(maps:keys(Help)),
    maps:fold(fun (Key, #{desc := Desc}, _) ->
                      PaddedKey = string:left(Key, Padding),
                      ColorPaddedKey = color:blue(PaddedKey),
                      io:format("~s # ~s~n", [ColorPaddedKey, Desc])
              end, 0, Help);
print_help(Module, [Command | _]) ->
    Help = Module:help(),

    case maps:is_key(Command, Help) of
        true ->
            #{desc := Desc, long := Long} = maps:get(Command, Help),
            io:format("~s~n~n~s~n", [Desc, Long]);
        false ->
            throw({error, "No help entry for " ++ Command})
    end.

padding_size(List) ->
    lists:max(lists:map(fun length/1, List)).

void-variable mode-map

Latest version gave me this:

Debugger entered--Lisp error: (void-variable mode-map) byte-code("\301�\302\303#\210\301�\304\305#\207" [mode-map define-key "��" aggressive-indent-indent-defun [backspace] aggressive-indent-delete-backward] 4) (global-aggressive-indent-mode 1) eval-buffer(#<buffer *load*-429752> nil "/home/manuel/.emacs.d/config/04-modes.el" nil t) ; Reading at buffer position 10756 load-with-code-conversion("/home/manuel/.emacs.d/config/04-modes.el" "/home/manuel/.emacs.d/config/04-modes.el" nil nil) load("~/.emacs.d/config/04-modes") (cond ((and (eq isdir t) (not ignore-dir)) (load-directory fullpath)) ((and (eq isdir nil) (string= (substring path -3) ".el")) (load (file-name-sans-extension fullpath)))) (let* ((path (car element)) (fullpath (concat directory "/" path)) (isdir (car (cdr element))) (ignore-dir (or (string= path ".") (string= path "..")))) (cond ((and (eq isdir t) (not ignore-dir)) (load-directory fullpath)) ((and (eq isdir nil) (string= (substring path -3) ".el")) (load (file-name-sans-extension fullpath))))) (while --dolist-tail-- (setq element (car --dolist-tail--)) (let* ((path (car element)) (fullpath (concat directory "/" path)) (isdir (car (cdr element))) (ignore-dir (or (string= path ".") (string= path "..")))) (cond ((and (eq isdir t) (not ignore-dir)) (load-directory fullpath)) ((and (eq isdir nil) (string= (substring path -3) ".el")) (load (file-name-sans-extension fullpath))))) (setq --dolist-tail-- (cdr --dolist-tail--))) (let ((--dolist-tail-- (directory-files-and-attributes directory nil nil nil)) element) (while --dolist-tail-- (setq element (car --dolist-tail--)) (let* ((path (car element)) (fullpath (concat directory "/" path)) (isdir (car (cdr element))) (ignore-dir (or (string= path ".") (string= path "..")))) (cond ((and (eq isdir t) (not ignore-dir)) (load-directory fullpath)) ((and (eq isdir nil) (string= (substring path -3) ".el")) (load (file-name-sans-extension fullpath))))) (setq --dolist-tail-- (cdr --dolist-tail--)))) load-directory("~/.emacs.d/config") eval-buffer(#<buffer *load*> nil "/home/manuel/.emacs.d/init.el" nil t) ; Reading at buffer position 397 load-with-code-conversion("/home/manuel/.emacs.d/init.el" "/home/manuel/.emacs.d/init.el" t t) load("/home/manuel/.emacs.d/init" t t) #[0 "�\205\262

dont-indent-if hooks appear to be broken

I think the quoting in (eval (cons 'or dont-indent-if)) on this line is broken, I can't get hooks in aggressive-indent-dont-indent-if to work correctly.

Here's a stripped down version of the problematic code:

(defun true1 () t)
(setq function-list (list #'true1))
(cons 'or function-list)
(eval (cons 'or function-list)) 

for me the cons line returns (or true1 true2), but the eval line gives the error (void-variable true1).

In the real code this error is trapped by a condition-case which tells me that there's an error in my hook function (confusing!). Maybe the error handling should be moved "inside" the or function so that it only catches errors in the hook functions?

[In case it's relevant: I'm using emacs24.4 from the tagged version in the git repo, aggressive-indent is from melpa: Version: 20150115.1200]

Extreme slowdown in iEdit mode

Not too surprisingly, iEdit's multiple edits will cause aggressive-indent-mode to slowdown Emacs to a crawl.

I think perhaps aggressive-indent should be aware of things like iEdit (Just speculating, but maybe cua rectangle and multiple cursors may have similar problems.)

I guess suspending indentation until those specialised editing modes are inactive?

cursor tarp in clojure-mode

Be in clojure-mode and let | denote the cursor:

(defn my-fn
| "my docstring
")

With the cursor in this position aggressive-indent-mode doesn't allow me to move my cursor using forward-char. I have to use move-end-of-line or similar to escape the tarp.

void-variable `aggressive-indent-`

I use el-get to manage aggressive-indent-mode, it always raise this error when I try to update it.
Seems issue related with package namespaces.

Spaces between point and closing bracket

I am in clojure-mode. Whenever I define something using def or defn, as soon as I hit RET on the closing bracket point is at the beginning of the new line and bracket is correctly indented.
However, when I start typing the code is rightly indented but there are spaces between the code and the closing bracket.

(def king-moves
  (partial )  )

As you can see, I didn't input the spaces between the last two closing brackets but there they are. Is it possible to change this behavior?
Typing the two closing brackets removes the spaces, but still, since I don't need them, I wonder if it is possible not to have them at all.

Error in post-command-hook

I got this in the latest release.
Error in post-command-hook (aggressive-indent--softly-indent-defun): (wrong-type-argument stringp nil)

Error pops up as soon as I start typing in the *scratch* buffer and hit BACKSPACE.

Can't delete trailing whitespace

Hi,

Thanks for aggressive indent. It's generally super awesome.

I am having one really annoying issue (most noticeable when editing Ruby files)... When aggressive-indent-mode is enabled, empty lines have trailing whitespace up to the current indent level. I can not delete this trailing whitespace manually or with whitespace-cleanup. I have to disable aggressive indent, delete the trailing whitespace, commit the file, and re-enable.

I am on Emacs 24.5 and enable the mode like so:

(add-hook 'prog-mode-hook 'aggressive-indent-mode)

Let me know if there's any further information I can provide to help here.

Semi-aggressive-indent-mode

So, as you know, I'm running aggressive-indent-mode as I'm working with files in a codebase that I'm sharing with others.

(Yay!)

I love a-i-m, but it's a little too aggressive for my tastes in this scenario. Ideally, I would be able to turn on a mode that would aggressively indent the sections of the code that I work with, not the whole buffer. Is that possible or difficult, Artur?

Degrading performance in some modes

First of all, thanks for this awesome mode. I like automated things. However, currently the package is lagging in C++ mode (not C) when enter characters into a buffer. It would be nice if this is investigated and fixed, so I can enable in all prog-mode.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.