[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some functions I hope are useful for others to
From: |
Cecil Westerhof |
Subject: |
Re: Some functions I hope are useful for others to |
Date: |
Wed, 23 Dec 2009 21:10:05 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) |
pjb@informatimago.com (Pascal J. Bourguignon) writes:
> buffer-delete-lines --> kill-line
Not complete. My buffer-delete-lines delete the complete line from the
beginning, kill-line does it from the cursor position.
> buffer-to-unix --> universal-coding-system-argument
> set-default-coding-systems
> etc.
>
> More precisely, when you load a file with DOS line termination, then
> you get a (DOS) in the status line, and lines in the buffer (there's
> no RET in the buffer!). When you save a buffer (C-x C-s), it's saved
> with the same line termination. When you write out the buffer (C-x
> C-w), the default-coding-systems are used, so if you specify a unix
> coding system there, it will be saved as a unix text file.
This works also when there are lines of all three types? And with my
function you get immediately rid of those ^M at the end of the line.
>> http://www.decebal.nl/EmacsLisp/sources/own-functions-general.el
>
> I find them quite specific. (I wouldn't need these funtions).
I find log-message very handy. You do not have to search for messages of
a certain process in *Messages*. (I use it for my gnus-idle-daemon.)
I find exit-depends-on-interactive also very handy. When calling a
function interactive it is nice to get a message in the mini buffer, but
not when a function is not called interactive.
>> http://www.decebal.nl/EmacsLisp/sources/own-functions-time.el
>
> time-difference-formatted: do not do more than one thing in a
> function. Either compute a time difference, or format a time, but
> don't do both!
I do. For computing the time difference I call time-difference in
time-difference-formatted.
> Time formating is already provided by emacs format-time-string,
> so your function is redundant.
I do not think so, because in my function the format is dependent on the
time difference.
> Before an opening parenthesis, there can be only a quote, a space or
> another opening parenthesis.
I started to do this. I am used that the parenthesis in which the
parameters are given are bound to the function name. In my newest code I
am using a space, but this code is a little older and should be changed
by me.
> Finally, my own funtions are also my own-functions. You should
> rather use a unique prefix, such as:
>
> nl.decebal.cecil-general.el
> nl.decebal.cecil-buffer.el
> nl.decebal.cecil-time.el
That is a good idea.
> and you could also prefix your functions with the same to avoid
> collision with my own functions:
>
> nl.decebal.cecil.general/set-property-in-listo
> nl.decebal.cecil.time/emacs-uptime
Used with defalias that is also a good idea.
But when I started writing those functions I did not think it would be
interesting for others. I hope I was wrong. :-D
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof