* why do I have to <C-u> before calling align?
@ 2010-12-30 17:41 Le Wang
2010-12-30 23:31 ` Drew Adams
0 siblings, 1 reply; 3+ messages in thread
From: Le Wang @ 2010-12-30 17:41 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 206 bytes --]
Hi all,
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.
--
Le
[-- Attachment #2: Type: text/html, Size: 270 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: why do I have to <C-u> before calling align?
2010-12-30 17:41 why do I have to <C-u> before calling align? Le Wang
@ 2010-12-30 23:31 ` Drew Adams
2011-02-23 14:33 ` Le Wang
0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2010-12-30 23:31 UTC (permalink / raw)
To: 'Le Wang', help-gnu-emacs
> 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.)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: why do I have to <C-u> before calling align?
2010-12-30 23:31 ` Drew Adams
@ 2011-02-23 14:33 ` Le Wang
0 siblings, 0 replies; 3+ messages in thread
From: Le Wang @ 2011-02-23 14:33 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 443 bytes --]
On Fri, Dec 31, 2010 at 7:31 AM, Drew Adams <drew.adams@oracle.com> wrote:
> 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:
>
>
This thread fell off my radar.
Thanks for the helpful reply Drew. The magic is in align-rules-list. I
guess some of the useful rules I rely on are considered too aggressive to be
turned on by default.
--
Le
[-- Attachment #2: Type: text/html, Size: 789 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-02-23 14:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-30 17:41 why do I have to <C-u> before calling align? Le Wang
2010-12-30 23:31 ` Drew Adams
2011-02-23 14:33 ` Le Wang
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.