* [Proposal] M-x tabify to indent only when needed.
@ 2006-07-24 17:30 Michaël Cadilhac
2006-07-24 20:40 ` Michaël Cadilhac
2006-07-24 21:50 ` Richard Stallman
0 siblings, 2 replies; 15+ messages in thread
From: Michaël Cadilhac @ 2006-07-24 17:30 UTC (permalink / raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 384 bytes --]
M-x tabify has an unexpected behavior with files that are already
tabified: once it is called, the file is set to be modified. In fact,
the regions of spaces are removed and then re-added.
Can the following patch be applied to change this behavior?
It checks that the region we are going to delete is not already of the
form « tabs then spaces less than a tab. ».
[-- Attachment #1.1.2: tabify.patch --]
[-- Type: text/x-patch, Size: 1593 bytes --]
Index: lisp/tabify.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/tabify.el,v
retrieving revision 1.19
diff -c -r1.19 tabify.el
*** lisp/tabify.el 6 Feb 2006 14:33:35 -0000 1.19
--- lisp/tabify.el 24 Jul 2006 17:21:48 -0000
***************
*** 75,82 ****
(while (re-search-forward tabify-regexp nil t)
(let ((column (current-column))
(indent-tabs-mode t))
! (delete-region (match-beginning 0) (point))
! (indent-to column))))))
(provide 'tabify)
--- 75,90 ----
(while (re-search-forward tabify-regexp nil t)
(let ((column (current-column))
(indent-tabs-mode t))
! ;; Whether already tabified.
! (unless (save-match-data
! (save-excursion
! (goto-char (match-beginning 0))
! (string-match
! (format "^\t* \\{0,%d\\}$"
! (- tab-width (1+ (mod (current-column) tab-width))))
! (match-string 0))))
! (delete-region (match-beginning 0) (point))
! (indent-to column)))))))
(provide 'tabify)
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.9820
diff -c -r1.9820 ChangeLog
*** lisp/ChangeLog 17 Jul 2006 04:07:48 -0000 1.9820
--- lisp/ChangeLog 24 Jul 2006 17:21:50 -0000
***************
*** 1,0 ****
--- 1,4 ----
+ 2006-07-24 Michaël Cadilhac <michael.cadilhac@lrde.org>
+
+ * tabify.el (tabify): Check if not already tabified before indenting.
+
[-- Attachment #1.1.3: Type: text/plain, Size: 331 bytes --]
TIA!
--
| Michaël `Micha' Cadilhac | Le copillage-collage |
| Epita/LRDE Promo 2007 | tue le programmeur. |
| http://www.lrde.org/~cadilh_m | -- Dictons LRDE |
`-- - JID: micha@amessage.be --' - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-24 17:30 [Proposal] M-x tabify to indent only when needed Michaël Cadilhac
@ 2006-07-24 20:40 ` Michaël Cadilhac
2006-07-24 21:30 ` Stefan Monnier
2006-07-24 21:50 ` Richard Stallman
1 sibling, 1 reply; 15+ messages in thread
From: Michaël Cadilhac @ 2006-07-24 20:40 UTC (permalink / raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 549 bytes --]
michael.cadilhac@lrde.org (Michaël Cadilhac) writes:
> M-x tabify has an unexpected behavior with files that are already
> tabified: once it is called, the file is set to be modified. In fact,
> the regions of spaces are removed and then re-added.
>
> Can the following patch be applied to change this behavior?
>
> It checks that the region we are going to delete is not already of the
> form « tabs then spaces less than a tab. ».
... Sorry for the noise, the previous patch was no good. Please
consider the following one.
[-- Attachment #1.1.2: tabify.patch --]
[-- Type: text/x-patch, Size: 1240 bytes --]
*** lisp/tabify.el.~1.19.~ 2006-02-06 15:33:35.000000000 +0100
--- lisp/tabify.el 2006-07-24 22:33:57.000000000 +0200
***************
*** 75,82 ****
(while (re-search-forward tabify-regexp nil t)
(let ((column (current-column))
(indent-tabs-mode t))
! (delete-region (match-beginning 0) (point))
! (indent-to column))))))
(provide 'tabify)
--- 75,90 ----
(while (re-search-forward tabify-regexp nil t)
(let ((column (current-column))
(indent-tabs-mode t))
! ;; Whether already tabified.
! (unless (save-match-data
! (save-excursion
! (skip-chars-backward " ")
! (string-match
! (format "^\t* \\{0,%d\\}$"
! (- tab-width (1+ (mod (current-column) tab-width))))
! (match-string 0))))
! (delete-region (match-beginning 0) (point))
! (indent-to column)))))))
(provide 'tabify)
*** lisp/ChangeLog.~1.9820.~ 2006-07-17 13:27:46.000000000 +0200
--- lisp/ChangeLog 2006-07-24 19:20:58.000000000 +0200
***************
*** 1,0 ****
--- 1,4 ----
+ 2006-07-24 Michaël Cadilhac <michael.cadilhac@lrde.org>
+
+ * tabify.el (tabify): Check if not already tabified before indenting.
+
[-- Attachment #1.1.3: Type: text/plain, Size: 331 bytes --]
TIA!
--
| Michaël `Micha' Cadilhac | Pour les 35-40 ans, l'humour |
| Epita/LRDE Promo 2007 | c'est une plus-value. |
| http://www.lrde.org/~cadilh_m | -- Guillaume L. |
`-- - JID: micha@amessage.be --' - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-24 20:40 ` Michaël Cadilhac
@ 2006-07-24 21:30 ` Stefan Monnier
2006-07-25 3:09 ` Richard Stallman
0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2006-07-24 21:30 UTC (permalink / raw)
Cc: emacs-devel
> (while (re-search-forward tabify-regexp nil t)
> (let ((column (current-column))
> (indent-tabs-mode t))
> ! ;; Whether already tabified.
> ! (unless (save-match-data
> ! (save-excursion
> ! (skip-chars-backward " ")
> ! (string-match
> ! (format "^\t* \\{0,%d\\}$"
> ! (- tab-width (1+ (mod (current-column) tab-width))))
> ! (match-string 0))))
> ! (delete-region (match-beginning 0) (point))
> ! (indent-to column)))))))
I'm not convinced it's correct.
I think we should only accept such a patch if the correctness is clear
(either because the code's correctnes is inherently obvious, or because it
is sufficiently commented to explain why it's correct).
How 'bout the 100% untested patch below?
Stefan
--- orig/lisp/tabify.el
+++ mod/lisp/tabify.el
@@ -50,9 +50,9 @@
(delete-region tab-beg (point))
(indent-to column))))))
-(defvar tabify-regexp "[ \t][ \t]+"
+(defvar tabify-regexp " [ \t]+"
"Regexp matching whitespace that tabify should consider.
-Usually this will be \"[ \\t][ \\t]+\" to match two or more spaces or tabs.
+Usually this will be \" [ \\t]+\" to match two or more spaces or tabs.
\"^[ \\t]+\" is also useful, for tabifying only initial whitespace.")
;;;###autoload
@@ -73,12 +73,20 @@
(narrow-to-region (point) end)
(goto-char start)
(while (re-search-forward tabify-regexp nil t)
- (let ((column (current-column))
- (indent-tabs-mode t))
- (delete-region (match-beginning 0) (point))
- (indent-to column))))))
+ ;; The region between (match-beginning 0) and (match-end 0) is just
+ ;; spacing which we want to adjust to use TABs where possible.
+ (let ((end-col (current-column))
+ (beg-col (save-excursion (goto-char (match-beginning 0))
+ (current-column))))
+ (if (= (/ end-col tab-width) (/ beg-col tab-width))
+ ;; The spacing does not straddle a TAB boundary, so we won't
+ ;; be able to use a TAB here anyway: there's nothing to do.
+ nil
+ (let ((indent-tabs-mode t))
+ (delete-region (match-beginning 0) (point))
+ (indent-to end-col))))))))
(provide 'tabify)
-;;; arch-tag: c83893b1-e0cc-4e57-8a09-73fd03466416
+;; arch-tag: c83893b1-e0cc-4e57-8a09-73fd03466416
;;; tabify.el ends here
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-24 17:30 [Proposal] M-x tabify to indent only when needed Michaël Cadilhac
2006-07-24 20:40 ` Michaël Cadilhac
@ 2006-07-24 21:50 ` Richard Stallman
2006-07-25 11:38 ` Michaël Cadilhac
1 sibling, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2006-07-24 21:50 UTC (permalink / raw)
Cc: emacs-devel
! (unless (save-match-data
! (save-excursion
! (goto-char (match-beginning 0))
! (string-match
! (format "^\t* \\{0,%d\\}$"
! (- tab-width (1+ (mod (current-column) tab-width))))
! (match-string 0))))
That would be very slow. Please do it without using regexps,
perhaps using skip-chars-forward.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-24 21:30 ` Stefan Monnier
@ 2006-07-25 3:09 ` Richard Stallman
2006-07-25 13:55 ` Stefan Monnier
0 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2006-07-25 3:09 UTC (permalink / raw)
Cc: michael.cadilhac, emacs-devel
+ (if (= (/ end-col tab-width) (/ beg-col tab-width))
+ ;; The spacing does not straddle a TAB boundary, so we won't
+ ;; be able to use a TAB here anyway: there's nothing to do.
+ nil
This detects a case where no tabs can be used.
It doesn't detect the case where tabs already ARE used.
-(defvar tabify-regexp "[ \t][ \t]+"
+(defvar tabify-regexp " [ \t]+"
Is that change supposed to exclude those other cases?
It is a good idea to make the regexp match less often.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-24 21:50 ` Richard Stallman
@ 2006-07-25 11:38 ` Michaël Cadilhac
2006-07-25 22:15 ` Richard Stallman
0 siblings, 1 reply; 15+ messages in thread
From: Michaël Cadilhac @ 2006-07-25 11:38 UTC (permalink / raw)
Cc: emacs-devel
[-- Attachment #1.1.1: Type: text/plain, Size: 735 bytes --]
Richard Stallman <rms@gnu.org> writes:
> ! (unless (save-match-data
> ! (save-excursion
> ! (goto-char (match-beginning 0))
> ! (string-match
> ! (format "^\t* \\{0,%d\\}$"
> ! (- tab-width (1+ (mod (current-column) tab-width))))
> ! (match-string 0))))
>
> That would be very slow. Please do it without using regexps,
> perhaps using skip-chars-forward.
I can come up with the following regexp-free, search-free patch that
makes the job, and that uses Stefan's good proposal of using " [ \t]+"
as `tabify-regexp'.
However, the code now supposes that if a TAB appears in the match,
a space must have preceded it. I specified that in the docstring.
[-- Attachment #1.1.2: tabify.patch --]
[-- Type: text/x-patch, Size: 2745 bytes --]
Index: lisp/tabify.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/tabify.el,v
retrieving revision 1.19
diff -c -r1.19 tabify.el
*** lisp/tabify.el 6 Feb 2006 14:33:35 -0000 1.19
--- lisp/tabify.el 25 Jul 2006 10:30:09 -0000
***************
*** 50,59 ****
(delete-region tab-beg (point))
(indent-to column))))))
! (defvar tabify-regexp "[ \t][ \t]+"
"Regexp matching whitespace that tabify should consider.
! Usually this will be \"[ \\t][ \\t]+\" to match two or more spaces or tabs.
! \"^[ \\t]+\" is also useful, for tabifying only initial whitespace.")
;;;###autoload
(defun tabify (start end)
--- 50,60 ----
(delete-region tab-beg (point))
(indent-to column))))))
! (defvar tabify-regexp " [ \t]+"
"Regexp matching whitespace that tabify should consider.
! Usually this will be \" [ \\t]+\" to match two or more spaces or tabs.
! \"^\\\\( \\t*\\\\)+\" is also useful, for tabifying only initial whitespace.
! Note that if a `\\t' is matched, a space must have been matched before.")
;;;###autoload
(defun tabify (start end)
***************
*** 75,82 ****
(while (re-search-forward tabify-regexp nil t)
(let ((column (current-column))
(indent-tabs-mode t))
! (delete-region (match-beginning 0) (point))
! (indent-to column))))))
(provide 'tabify)
--- 76,94 ----
(while (re-search-forward tabify-regexp nil t)
(let ((column (current-column))
(indent-tabs-mode t))
! (unless (save-excursion
! (if (not (= (skip-chars-backward " " (match-beginning 0))
! (- (match-beginning 0) (match-end 0))))
! ;; There is a TAB after a space: (match-string 0) is
! ;; not full of spaces.
! nil
! ;; See if there's room for a TAB.
! ;; We already are at (match-beginning 0).
! (< (+ (mod (current-column) tab-width)
! (- column (current-column)))
! tab-width)))
! (delete-region (match-beginning 0) (point))
! (indent-to column)))))))
(provide 'tabify)
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.9820
diff -c -r1.9820 ChangeLog
*** lisp/ChangeLog 17 Jul 2006 04:07:48 -0000 1.9820
--- lisp/ChangeLog 25 Jul 2006 10:30:10 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2006-07-24 Michaël Cadilhac <michael.cadilhac@lrde.org>
+
+ * tabify.el (tabify): Check if not already tabified before indenting.
+
2006-07-17 Chong Yidong <cyd@stupidchicken.com>
* progmodes/compile.el (compilation-mode-font-lock-keywords):
[-- Attachment #1.1.3: Type: text/plain, Size: 404 bytes --]
The understanding is slightly improved :-) I can't make it clearer, in
fact.
--
| Michaël `Micha' Cadilhac | Isn't vi that text editor with |
| Epita/LRDE Promo 2007 | two modes... One that beeps and |
| http://www.lrde.org/~cadilh_m | one that corrupts your file? |
`-- - JID: micha@amessage.be --' -- Dan Jacobson - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-25 3:09 ` Richard Stallman
@ 2006-07-25 13:55 ` Stefan Monnier
2006-07-25 14:09 ` Michaël Cadilhac
0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2006-07-25 13:55 UTC (permalink / raw)
Cc: michael.cadilhac, emacs-devel
> + (if (= (/ end-col tab-width) (/ beg-col tab-width))
> + ;; The spacing does not straddle a TAB boundary, so we won't
> + ;; be able to use a TAB here anyway: there's nothing to do.
> + nil
> This detects a case where no tabs can be used.
> It doesn't detect the case where tabs already ARE used.
Those cases aren't matched by the regexp.
> -(defvar tabify-regexp "[ \t][ \t]+"
> +(defvar tabify-regexp " [ \t]+"
> Is that change supposed to exclude those other cases?
Exactly.
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-25 13:55 ` Stefan Monnier
@ 2006-07-25 14:09 ` Michaël Cadilhac
2006-07-25 15:07 ` Stefan Monnier
0 siblings, 1 reply; 15+ messages in thread
From: Michaël Cadilhac @ 2006-07-25 14:09 UTC (permalink / raw)
Cc: rms, emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 1185 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> + (if (= (/ end-col tab-width) (/ beg-col tab-width))
>> + ;; The spacing does not straddle a TAB boundary, so we won't
>> + ;; be able to use a TAB here anyway: there's nothing to do.
>> + nil
>
>> This detects a case where no tabs can be used.
>> It doesn't detect the case where tabs already ARE used.
>
> Those cases aren't matched by the regexp.
>
>> -(defvar tabify-regexp "[ \t][ \t]+"
>> +(defvar tabify-regexp " [ \t]+"
>
>> Is that change supposed to exclude those other cases?
>
> Exactly.
>
> Stefan
IIUC, your patch does work and is very much clearer than mine.
However, it suffers from the same precondition on tabify-regexp, which
should be described in its docstring.
Thanks!
--
| Michaël `Micha' Cadilhac | Si les religions etaient aussi tole- |
| Epita/LRDE Promo 2007 | rantes qu'elles le pretendent, il y |
| http://www.lrde.org/~cadilh_m | a longtemps qu'il n'y en aurait plus |
`-- - JID: micha@amessage.be --' -- Moustic - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-25 14:09 ` Michaël Cadilhac
@ 2006-07-25 15:07 ` Stefan Monnier
2006-07-25 15:28 ` Michaël Cadilhac
0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2006-07-25 15:07 UTC (permalink / raw)
Cc: rms, emacs-devel
>>> + (if (= (/ end-col tab-width) (/ beg-col tab-width))
>>> + ;; The spacing does not straddle a TAB boundary, so we won't
>>> + ;; be able to use a TAB here anyway: there's nothing to do.
>>> + nil
>>
>>> This detects a case where no tabs can be used.
>>> It doesn't detect the case where tabs already ARE used.
>>
>> Those cases aren't matched by the regexp.
>>
>>> -(defvar tabify-regexp "[ \t][ \t]+"
>>> +(defvar tabify-regexp " [ \t]+"
>>
>>> Is that change supposed to exclude those other cases?
>>
>> Exactly.
>>
>> Stefan
> IIUC, your patch does work and is very much clearer than mine.
> However, it suffers from the same precondition on tabify-regexp, which
> should be described in its docstring.
Another regexp will also work, except that it may result in "spurious"
buffer modifications. But people have lived with such spurious buffer
modifications until now, so it's not a big deal, is it?
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-25 15:07 ` Stefan Monnier
@ 2006-07-25 15:28 ` Michaël Cadilhac
2006-07-25 16:21 ` Stefan Monnier
0 siblings, 1 reply; 15+ messages in thread
From: Michaël Cadilhac @ 2006-07-25 15:28 UTC (permalink / raw)
Cc: rms, emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 1608 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>>> + (if (= (/ end-col tab-width) (/ beg-col tab-width))
>>>> + ;; The spacing does not straddle a TAB boundary, so we won't
>>>> + ;; be able to use a TAB here anyway: there's nothing to do.
>>>> + nil
>>>
>>>> This detects a case where no tabs can be used.
>>>> It doesn't detect the case where tabs already ARE used.
>>>
>>> Those cases aren't matched by the regexp.
>>>
>>>> -(defvar tabify-regexp "[ \t][ \t]+"
>>>> +(defvar tabify-regexp " [ \t]+"
>>>
>>>> Is that change supposed to exclude those other cases?
>>>
>>> Exactly.
>>>
>>> Stefan
>
>> IIUC, your patch does work and is very much clearer than mine.
>> However, it suffers from the same precondition on tabify-regexp, which
>> should be described in its docstring.
>
> Another regexp will also work, except that it may result in "spurious"
> buffer modifications. But people have lived with such spurious buffer
> modifications until now, so it's not a big deal, is it?
Well... Why not tell the user how to get good results?
Whatever, the docstring should be modified to tell that
\"^\\\\( \\t*\\\\)+\" must be used for « tabifying only initial
whitespace » (IINM).
--
| Michaël `Micha' Cadilhac | Would someone please DTRT with this, |
| Epita/LRDE Promo 2007 | then ACK? |
| http://www.lrde.org/~cadilh_m | -- Richard Stallman |
`-- - JID: micha@amessage.be --' - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-25 15:28 ` Michaël Cadilhac
@ 2006-07-25 16:21 ` Stefan Monnier
2006-07-25 17:09 ` Michaël Cadilhac
0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2006-07-25 16:21 UTC (permalink / raw)
Cc: rms, emacs-devel
> Whatever, the docstring should be modified to tell that
> \"^\\\\( \\t*\\\\)+\" must be used for « tabifying only initial
> whitespace » (IINM).
I'm not sure this regexp will give correct results.
Actually I don't think you can come up with a regexp for this problem that
works correctly (in the sense of the resulting buffer text) and that also
allows my code to avoid changing the buffer when it's not needed.
It's a limitation of my code. It can probably be lifted with
a (skip-chars-forward "\t").
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-25 16:21 ` Stefan Monnier
@ 2006-07-25 17:09 ` Michaël Cadilhac
0 siblings, 0 replies; 15+ messages in thread
From: Michaël Cadilhac @ 2006-07-25 17:09 UTC (permalink / raw)
Cc: rms, emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 763 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Whatever, the docstring should be modified to tell that
>> \"^\\\\( \\t*\\\\)+\" must be used for « tabifying only initial
>> whitespace » (IINM).
>
> I'm not sure this regexp will give correct results.
Huho, neither I am now ;-)
> It's a limitation of my code. It can probably be lifted with
> a (skip-chars-forward "\t").
You're again completly right! Please do :-)
--
| Michaël `Micha' Cadilhac | Would someone please DTRT with this, |
| Epita/LRDE Promo 2007 | then ACK? |
| http://www.lrde.org/~cadilh_m | -- Richard Stallman |
`-- - JID: micha@amessage.be --' - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-25 11:38 ` Michaël Cadilhac
@ 2006-07-25 22:15 ` Richard Stallman
2006-07-26 11:29 ` Michaël Cadilhac
0 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2006-07-25 22:15 UTC (permalink / raw)
Cc: emacs-devel
I can come up with the following regexp-free, search-free patch that
makes the job, and that uses Stefan's good proposal of using " [ \t]+"
as `tabify-regexp'.
Please install this, if no one finds a flaw in it soon.
Thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-25 22:15 ` Richard Stallman
@ 2006-07-26 11:29 ` Michaël Cadilhac
2006-07-26 11:32 ` Michaël Cadilhac
0 siblings, 1 reply; 15+ messages in thread
From: Michaël Cadilhac @ 2006-07-26 11:29 UTC (permalink / raw)
Cc: Stefan Monnier, emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 933 bytes --]
Richard Stallman <rms@gnu.org> writes:
> I can come up with the following regexp-free, search-free patch that
> makes the job, and that uses Stefan's good proposal of using " [ \t]+"
> as `tabify-regexp'.
>
> Please install this, if no one finds a flaw in it soon.
>
> Thanks.
I think Stefan proposal is better than mine. The only flaw in it is
fixed if he changes the following part of its patch, as he proposed:
+ (beg-col (save-excursion (goto-char (match-beginning 0))
(skip-forward-chars "\t")
+ (current-column))))
--
| Michaël `Micha' Cadilhac | Le copillage-collage |
| Epita/LRDE Promo 2007 | tue le programmeur. |
| http://www.lrde.org/~cadilh_m | -- Dictons LRDE |
`-- - JID: micha@amessage.be --' - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Proposal] M-x tabify to indent only when needed.
2006-07-26 11:29 ` Michaël Cadilhac
@ 2006-07-26 11:32 ` Michaël Cadilhac
0 siblings, 0 replies; 15+ messages in thread
From: Michaël Cadilhac @ 2006-07-26 11:32 UTC (permalink / raw)
Cc: Stefan Monnier, emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 1071 bytes --]
michael.cadilhac@lrde.org (Michaël Cadilhac) writes:
> Richard Stallman <rms@gnu.org> writes:
>
>> I can come up with the following regexp-free, search-free patch that
>> makes the job, and that uses Stefan's good proposal of using " [ \t]+"
>> as `tabify-regexp'.
>>
>> Please install this, if no one finds a flaw in it soon.
>>
>> Thanks.
>
> I think Stefan proposal is better than mine. The only flaw in it is
> fixed if he changes the following part of its patch, as he proposed:
>
> + (beg-col (save-excursion (goto-char (match-beginning 0))
> (skip-forward-chars "\t")
> + (current-column))))
I just saw he did, so case closed :-) Thank you Stefan !
--
| Michaël `Micha' Cadilhac | Un certain Blaise Pascal |
| Epita/LRDE Promo 2007 | etc... etc... |
| http://www.lrde.org/~cadilh_m | -- Prévert (Les paris stupides) |
`-- - JID: micha@amessage.be --' - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2006-07-26 11:32 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-24 17:30 [Proposal] M-x tabify to indent only when needed Michaël Cadilhac
2006-07-24 20:40 ` Michaël Cadilhac
2006-07-24 21:30 ` Stefan Monnier
2006-07-25 3:09 ` Richard Stallman
2006-07-25 13:55 ` Stefan Monnier
2006-07-25 14:09 ` Michaël Cadilhac
2006-07-25 15:07 ` Stefan Monnier
2006-07-25 15:28 ` Michaël Cadilhac
2006-07-25 16:21 ` Stefan Monnier
2006-07-25 17:09 ` Michaël Cadilhac
2006-07-24 21:50 ` Richard Stallman
2006-07-25 11:38 ` Michaël Cadilhac
2006-07-25 22:15 ` Richard Stallman
2006-07-26 11:29 ` Michaël Cadilhac
2006-07-26 11:32 ` Michaël Cadilhac
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.