[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: why do I have to <C-u> before calling align?
From: |
Drew Adams |
Subject: |
RE: why do I have to <C-u> before calling align? |
Date: |
Thu, 30 Dec 2010 15:31:52 -0800 |
> I'm scratching my head over this one. In Emacs 23.2.1,
> calling `align' directly never works, I always have to
> pass the universal arg. It looks like the function only
> accepts the region.
Recipe please. Otherwise you won't be the only one scratching your head. ;-) How
are you calling it? etc. How are you "passing" the universal arg?
There seems to be no direct reference to the universal arg or
`current-prefix-arg' in the `align' code. (`align-regexp' is a different
story.)
However, I do see this in the user option `align-rules-list', which is used by
`align'. Some of the `run-if' functions examine the prefix arg:
`((lisp-second-arg
(regexp . "\\(^\\s-+[^( \t\n]\\|(\\(\\S-+\\)\\s-+\\)\\S-+\\(\\s-+\\)")
(group . 3)
(modes . align-lisp-modes)
(run-if . ,(function (lambda () current-prefix-arg))))
...
(c-comma-delimiter
(regexp . ",\\(\\s-*\\)[^/ \t\n]")
(repeat . t)
(modes . align-c++-modes)
(run-if . ,(function (lambda () current-prefix-arg))))
...
;; With a prefix argument, comma delimiter will be aligned. Since
;; perl-mode doesn't give us enough syntactic information (and we
;; don't do our own parsing yet), this rule is too destructive to
;; run normally.
(basic-comma-delimiter
(regexp . ",\\(\\s-*\\)[^# \t\n]")
(repeat . t)
(modes . (append align-perl-modes '(python-mode)))
(run-if . ,(function (lambda () current-prefix-arg))))
...
;; With a numeric prefix argument, or C-u, space delimited text
;; tables will be aligned.
(text-column
(regexp . "\\(^\\|\\S-\\)\\([ \t]+\\)\\(\\S-\\|$\\)")
(group . 2)
(modes . align-text-modes)
(repeat . t)
(run-if . ,(function
(lambda ()
(and current-prefix-arg
(not (eq '- current-prefix-arg)))))))
;; With a negative prefix argument, lists of dollar figures will
;; be aligned.
(text-dollar-figure
(regexp . "\\$?\\(\\s-+[0-9]+\\)\\.")
(modes . align-text-modes)
(justify . t)
(run-if . ,(function
(lambda ()
(eq '- current-prefix-arg)))))
So maybe that's where it comes in. Again, recipe please.
(Disclaimer: I know nothing about `align' and have never used it.)