all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* underline-line
@ 2009-12-24 11:06 Cecil Westerhof
  2009-12-24 11:23 ` underline-line Cecil Westerhof
  2009-12-24 15:32 ` underline-line Pascal J. Bourguignon
  0 siblings, 2 replies; 12+ messages in thread
From: Cecil Westerhof @ 2009-12-24 11:06 UTC (permalink / raw)
  To: help-gnu-emacs

Sometime you want to underline a sentence, just like this one. 
-------------------------------------------------------------- 
That is why I wrote a function underline-line. (Good name giving 
to functions and files will be done soon.)   Default it underlines 
the complete line with '-'.  An example with white-space at the 
front and end. 
------------------------------------------------------------  But 
the default underline character can be changed: (underline-line 
?^) gives: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  But not underlining the 
white-space could be useful.  That is possible with 
(underline-line nil t): 
---------------------------------------------  And of course the 
underline character can still be changed: (underline-line ?* t) 
gives: ****************************  There is a problem with tabs 
as seen here: ------------------------------------------  Also 
what is a better default: underlining everything as is done now, 
or is it better to default not underline the white-space at the 
beginning and the end of the line?   I am open to suggestions. 
The code (own-functions-general.el on 
http://www.decebal.nl/EmacsLisp/): (defun underline-line 
(&optional underline-char skip-outer-whitespace)
      "Underline current line; Default the whole line is 
    underlined with -. If underline-char is given, this character 
    is used.  When skip-outer-whitespace is not nil, whitespace at 
    the beginning and the end of the line is not underlined.  When 
    there are characters that do not have a width of one, this 
    function will not work correctly. This is the case with tabs. 
    If the tabs are only in the whitespace at the beginning of the 
    line, this function works correctly."
      (interactive)
      (save-excursion
        (let ((end-point) (start-point) (start-string "") 
              (this-underline-char)
              (underline-length)) (if (char-valid-p 
          underline-char) (setq this-underline-char 
          underline-char) (setq this-underline-char "-"))
          (end-of-line) (setq end-point (point)) 
          (beginning-of-line) (setq start-point (point))
          (when skip-outer-whitespace (if (not (re-search-forward 
            "\\(^[ \t]*\\)[^ \t]" end-point)) (setq start-point 
            end-point) (setq start-point  (match-end 0) 
            start-string (match-string 1)) (end-of-line) 
            (re-search-backward "\\([^ \t]\\)[ \t]*$" start-point) 
            (setq end-point (1+ (match-end 1)))))
          (setq underline-length (- end-point start-point)) (if (< 
          underline-length 1) (exit-depends-on-interactive 
          "Nothing to underline" (interactive-p))
            (forward-line 1) (insert start-string) (loop for i
            from 1 to underline-length do (insert
            this-underline-char)) (insert "\n")))))

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: underline-line
  2009-12-24 11:06 underline-line Cecil Westerhof
@ 2009-12-24 11:23 ` Cecil Westerhof
  2009-12-24 12:21   ` underline-line Reiner Steib
  2009-12-24 15:32 ` underline-line Pascal J. Bourguignon
  1 sibling, 1 reply; 12+ messages in thread
From: Cecil Westerhof @ 2009-12-24 11:23 UTC (permalink / raw)
  To: help-gnu-emacs

Cecil Westerhof <Cecil@decebal.nl> writes:

> Sometime you want to underline a sentence, just like this one. -------------------------------------------------------------- 

I do not understand what happened here. When writing the message it was
like:
Sometime you want to underline a sentence, just like this one.
-------------------------------------------------------------- 

And in the rest of the message there are also missing a 'few' newlines.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: underline-line
  2009-12-24 11:23 ` underline-line Cecil Westerhof
@ 2009-12-24 12:21   ` Reiner Steib
  2009-12-24 12:50     ` underline-line Cecil Westerhof
  0 siblings, 1 reply; 12+ messages in thread
From: Reiner Steib @ 2009-12-24 12:21 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, Dec 24 2009, Cecil Westerhof wrote:

> I do not understand what happened here. [...]
>
> And in the rest of the message there are also missing a 'few' newlines.

You (accidentally) enabled format=flowed, see
(info "(emacs-mime)Flowed text").

| Content-Type: text/plain; format=flowed

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: underline-line
  2009-12-24 12:21   ` underline-line Reiner Steib
@ 2009-12-24 12:50     ` Cecil Westerhof
  0 siblings, 0 replies; 12+ messages in thread
From: Cecil Westerhof @ 2009-12-24 12:50 UTC (permalink / raw)
  To: help-gnu-emacs

Reiner Steib <reinersteib+gmane@imap.cc> writes:

>> I do not understand what happened here. [...]
>>
>> And in the rest of the message there are also missing a 'few' newlines.
>
> You (accidentally) enabled format=flowed, see
> (info "(emacs-mime)Flowed text").
>
> | Content-Type: text/plain; format=flowed

Do not know I did that. I hope I will not do that again.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: underline-line
  2009-12-24 11:06 underline-line Cecil Westerhof
  2009-12-24 11:23 ` underline-line Cecil Westerhof
@ 2009-12-24 15:32 ` Pascal J. Bourguignon
  2009-12-25  5:59   ` underline-line tomas
                     ` (2 more replies)
  1 sibling, 3 replies; 12+ messages in thread
From: Pascal J. Bourguignon @ 2009-12-24 15:32 UTC (permalink / raw)
  To: help-gnu-emacs

Cecil Westerhof <Cecil@decebal.nl> writes:

> There is a problem with tabs as seen here:
> ------------------------------------------  

There should be no problem with tabs, because there should be not tab
in text files.


The only place where prefix tabs are allowed, for historical reasons
is in Makefile.  

And since alot of people are switching to things such as ant, perhaps
we could have a big switch over to spaces.  It would be enough that
the few make providers agree on a date and provide a script to convert
tab-makefiles to space-makefiles along with a new version of make.

Such switch overs have been done for more complex things than Makefiles...

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Our enemies are innovative and resourceful, and so are we. They never
stop thinking about new ways to harm our country and our people, and
neither do we. -- Georges W. Bush


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: underline-line
  2009-12-24 15:32 ` underline-line Pascal J. Bourguignon
@ 2009-12-25  5:59   ` tomas
  2009-12-25  6:33   ` underline-line Cecil Westerhof
       [not found]   ` <mailman.167.1261721014.18930.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 12+ messages in thread
From: tomas @ 2009-12-25  5:59 UTC (permalink / raw)
  To: Pascal J. Bourguignon; +Cc: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Dec 24, 2009 at 04:32:30PM +0100, Pascal J. Bourguignon wrote:

[...]

> The only place where prefix tabs are allowed, for historical reasons
> is in Makefile.  
> 
> And since alot of people are switching to things such as ant,

Ouch. Not that 'm very fond of Makefile's tab, but I'll take leading tabs
before XML any day :-(

>                                                                 perhaps
> we could have a big switch over to spaces.  It would be enough that
> the few make providers agree on a date [...]

No need for that. Make providers agreeing on accepting leading
whitespace instead of just tabs would be backwards compatible and it'll
slowly do away with tabs. But I don't believe it to be important enough.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFLNFS3Bcgs9XrR2kYRAgBIAJ42P/KkiDMJzFO+BmD0IsQFvvNqrACcDoBy
kaVYaH+4m3TX3/XriQDDZMg=
=luoi
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: underline-line
  2009-12-24 15:32 ` underline-line Pascal J. Bourguignon
  2009-12-25  5:59   ` underline-line tomas
@ 2009-12-25  6:33   ` Cecil Westerhof
  2009-12-25 23:07     ` underline-line Tim X
       [not found]   ` <mailman.167.1261721014.18930.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 12+ messages in thread
From: Cecil Westerhof @ 2009-12-25  6:33 UTC (permalink / raw)
  To: help-gnu-emacs

pjb@informatimago.com (Pascal J. Bourguignon) writes:

> Cecil Westerhof <Cecil@decebal.nl> writes:
> There should be no problem with tabs, because there should be not tab
> in text files.

I do not use them, but I know that other people do. Better to describe
the consequences then, so that people are not taken by surprise.


> The only place where prefix tabs are allowed, for historical reasons
> is in Makefile.  

I know a lot of people who use it for indenting and it is used for
'tables'. But maybe I should give a warning when tabs are found in the
text.
But maybe I should document the function works with 'clean' text files.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: underline-line
       [not found]   ` <mailman.167.1261721014.18930.help-gnu-emacs@gnu.org>
@ 2009-12-25 22:57     ` Tim X
  0 siblings, 0 replies; 12+ messages in thread
From: Tim X @ 2009-12-25 22:57 UTC (permalink / raw)
  To: help-gnu-emacs

tomas@tuxteam.de writes:

> On Thu, Dec 24, 2009 at 04:32:30PM +0100, Pascal J. Bourguignon wrote:
>
> [...]
>
>> The only place where prefix tabs are allowed, for historical reasons
>> is in Makefile.  
>> 
>> And since alot of people are switching to things such as ant,
>
> Ouch. Not that 'm very fond of Makefile's tab, but I'll take leading tabs
> before XML any day :-(
>
>>                                                                 perhaps
>> we could have a big switch over to spaces.  It would be enough that
>> the few make providers agree on a date [...]
>
> No need for that. Make providers agreeing on accepting leading
> whitespace instead of just tabs would be backwards compatible and it'll
> slowly do away with tabs. But I don't believe it to be important enough.
>
> Regards

Agree 100%. 

-- 
tcross (at) rapttech dot com dot au


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: underline-line
  2009-12-25  6:33   ` underline-line Cecil Westerhof
@ 2009-12-25 23:07     ` Tim X
  2009-12-25 23:52       ` underline-line Pascal J. Bourguignon
  2009-12-26  9:21       ` underline-line Cecil Westerhof
  0 siblings, 2 replies; 12+ messages in thread
From: Tim X @ 2009-12-25 23:07 UTC (permalink / raw)
  To: help-gnu-emacs

Cecil Westerhof <Cecil@decebal.nl> writes:

> pjb@informatimago.com (Pascal J. Bourguignon) writes:
>
>> Cecil Westerhof <Cecil@decebal.nl> writes:
>> There should be no problem with tabs, because there should be not tab
>> in text files.
>
> I do not use them, but I know that other people do. Better to describe
> the consequences then, so that people are not taken by surprise.
>
>
>> The only place where prefix tabs are allowed, for historical reasons
>> is in Makefile.  
>
> I know a lot of people who use it for indenting and it is used for
> 'tables'. But maybe I should give a warning when tabs are found in the
> text.
> But maybe I should document the function works with 'clean' text files.

I personally don't think tabs are a problem What is a problem is when
you get source files that have a mixture of tabs and spaces where they
are not used consistently. 

Using tabs for indent can actuallly be very useful. If I'm working with
a team and we all have different preferences for how large our code
indents are, rather than forcing a standard indent size on all team
members, we can just use tabs and each member can set the tab width to
their preferred indent size i.e. 2 spaces, 4 spaces, 8 spaces etc. 

The problem is when you have some people indenting using spaces and some
using tabs. Then all the indenting gets screwed up. 

I don't have an issue with tabs in Makefiles. The emacs Makefile mode
can show tabs/spaces, so its easy to see when something is wrong/missing
a leading tab. 

I doubt we can change make effectively. There are millions of lines of
makefile code with tabs out there (I was told there are more lines of
Makefile code out there than Ruby). Much of this code is in projects
that are unlikely to have the inclination or resoruces to want to modify
 their Makefiles to remove the tabs. Changing make to handle just
 generic whitespace (i.e. space or tab) would be possible, but it won't
 remove tabs from the equation. We are pretty much stuck with them for
 the time being.

Tim



-- 
tcross (at) rapttech dot com dot au


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: underline-line
  2009-12-25 23:07     ` underline-line Tim X
@ 2009-12-25 23:52       ` Pascal J. Bourguignon
  2009-12-26  7:03         ` underline-line Tim X
  2009-12-26  9:21       ` underline-line Cecil Westerhof
  1 sibling, 1 reply; 12+ messages in thread
From: Pascal J. Bourguignon @ 2009-12-25 23:52 UTC (permalink / raw)
  To: help-gnu-emacs

Tim X <timx@nospam.dev.null> writes:

> Cecil Westerhof <Cecil@decebal.nl> writes:
>
>> pjb@informatimago.com (Pascal J. Bourguignon) writes:
>>
>>> Cecil Westerhof <Cecil@decebal.nl> writes:
>>> There should be no problem with tabs, because there should be not tab
>>> in text files.
>>
>> I do not use them, but I know that other people do. Better to describe
>> the consequences then, so that people are not taken by surprise.
>>
>>
>>> The only place where prefix tabs are allowed, for historical reasons
>>> is in Makefile.  
>>
>> I know a lot of people who use it for indenting and it is used for
>> 'tables'. But maybe I should give a warning when tabs are found in the
>> text.
>> But maybe I should document the function works with 'clean' text files.
>
> I personally don't think tabs are a problem What is a problem is when
> you get source files that have a mixture of tabs and spaces where they
> are not used consistently. 
>
> Using tabs for indent can actuallly be very useful. If I'm working with
> a team and we all have different preferences for how large our code
> indents are, rather than forcing a standard indent size on all team
> members, we can just use tabs and each member can set the tab width to
> their preferred indent size i.e. 2 spaces, 4 spaces, 8 spaces etc. 

C-x h C-M-\

I'd even put the equivalent in find-file-hook...
(and possibly the same in save-file-hook with the project parameters).



> The problem is when you have some people indenting using spaces and some
> using tabs. Then all the indenting gets screwed up. 
>
> I don't have an issue with tabs in Makefiles. The emacs Makefile mode
> can show tabs/spaces, so its easy to see when something is wrong/missing
> a leading tab. 
>
> I doubt we can change make effectively. There are millions of lines of
> makefile code with tabs out there (I was told there are more lines of
> Makefile code out there than Ruby). Much of this code is in projects
> that are unlikely to have the inclination or resoruces to want to modify
>  their Makefiles to remove the tabs. Changing make to handle just
>  generic whitespace (i.e. space or tab) would be possible, but it won't
>  remove tabs from the equation. We are pretty much stuck with them for
>  the time being.

Makefile:2:warning TAB used instead of space
Makefile:3:warning TAB used instead of space
Makefile:4:warning TAB used instead of space
Makefile:6:warning TAB used instead of space
Makefile:7:warning TAB used instead of space
...


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: underline-line
  2009-12-25 23:52       ` underline-line Pascal J. Bourguignon
@ 2009-12-26  7:03         ` Tim X
  0 siblings, 0 replies; 12+ messages in thread
From: Tim X @ 2009-12-26  7:03 UTC (permalink / raw)
  To: help-gnu-emacs

pjb@informatimago.com (Pascal J. Bourguignon) writes:

> Tim X <timx@nospam.dev.null> writes:
>
>> Cecil Westerhof <Cecil@decebal.nl> writes:
>>
>>> pjb@informatimago.com (Pascal J. Bourguignon) writes:
>>>
>>>> Cecil Westerhof <Cecil@decebal.nl> writes:
>>>> There should be no problem with tabs, because there should be not tab
>>>> in text files.
>>>
>>> I do not use them, but I know that other people do. Better to describe
>>> the consequences then, so that people are not taken by surprise.
>>>
>>>
>>>> The only place where prefix tabs are allowed, for historical reasons
>>>> is in Makefile.  
>>>
>>> I know a lot of people who use it for indenting and it is used for
>>> 'tables'. But maybe I should give a warning when tabs are found in the
>>> text.
>>> But maybe I should document the function works with 'clean' text files.
>>
>> I personally don't think tabs are a problem What is a problem is when
>> you get source files that have a mixture of tabs and spaces where they
>> are not used consistently. 
>>
>> Using tabs for indent can actuallly be very useful. If I'm working with
>> a team and we all have different preferences for how large our code
>> indents are, rather than forcing a standard indent size on all team
>> members, we can just use tabs and each member can set the tab width to
>> their preferred indent size i.e. 2 spaces, 4 spaces, 8 spaces etc. 
>
> C-x h C-M-\
>
> I'd even put the equivalent in find-file-hook...
> (and possibly the same in save-file-hook with the project parameters).
>
>
>
>> The problem is when you have some people indenting using spaces and some
>> using tabs. Then all the indenting gets screwed up. 
>>
>> I don't have an issue with tabs in Makefiles. The emacs Makefile mode
>> can show tabs/spaces, so its easy to see when something is wrong/missing
>> a leading tab. 
>>
>> I doubt we can change make effectively. There are millions of lines of
>> makefile code with tabs out there (I was told there are more lines of
>> Makefile code out there than Ruby). Much of this code is in projects
>> that are unlikely to have the inclination or resoruces to want to modify
>>  their Makefiles to remove the tabs. Changing make to handle just
>>  generic whitespace (i.e. space or tab) would be possible, but it won't
>>  remove tabs from the equation. We are pretty much stuck with them for
>>  the time being.
>
> Makefile:2:warning TAB used instead of space
> Makefile:3:warning TAB used instead of space
> Makefile:4:warning TAB used instead of space
> Makefile:6:warning TAB used instead of space
> Makefile:7:warning TAB used instead of space

Yes, but my point is there is a huge amount of makefiles out there with
tabs and that isn't going to change. The amount of legacy makefiles with
tabs means we are not going to get rid of them any time soon i.e. we are
stuck with them for the time being.

Tim> ...

-- 
tcross (at) rapttech dot com dot au


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: underline-line
  2009-12-25 23:07     ` underline-line Tim X
  2009-12-25 23:52       ` underline-line Pascal J. Bourguignon
@ 2009-12-26  9:21       ` Cecil Westerhof
  1 sibling, 0 replies; 12+ messages in thread
From: Cecil Westerhof @ 2009-12-26  9:21 UTC (permalink / raw)
  To: help-gnu-emacs

Tim X <timx@nospam.dev.null> writes:

>> I know a lot of people who use it for indenting and it is used for
>> 'tables'. But maybe I should give a warning when tabs are found in the
>> text.
>> But maybe I should document the function works with 'clean' text files.
>
> I personally don't think tabs are a problem What is a problem is when
> you get source files that have a mixture of tabs and spaces where they
> are not used consistently. 

That is certainly a problem. But I do not think that my function will be
used with source or Makefiles.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-12-26  9:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-24 11:06 underline-line Cecil Westerhof
2009-12-24 11:23 ` underline-line Cecil Westerhof
2009-12-24 12:21   ` underline-line Reiner Steib
2009-12-24 12:50     ` underline-line Cecil Westerhof
2009-12-24 15:32 ` underline-line Pascal J. Bourguignon
2009-12-25  5:59   ` underline-line tomas
2009-12-25  6:33   ` underline-line Cecil Westerhof
2009-12-25 23:07     ` underline-line Tim X
2009-12-25 23:52       ` underline-line Pascal J. Bourguignon
2009-12-26  7:03         ` underline-line Tim X
2009-12-26  9:21       ` underline-line Cecil Westerhof
     [not found]   ` <mailman.167.1261721014.18930.help-gnu-emacs@gnu.org>
2009-12-25 22:57     ` underline-line Tim X

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.