Older blog entries for ryuslash (starting at number 6)

I've been trying out several types of code folding in emacs, but I've never found a very good one. Folding mode seemed clunky and could sometimes break font locking it seemed. HideShow actually removes (doesn't delete of course) the lines, so the line numbers get screwed up and things like goto-line get messed up.

This time I'm trying out outline-minor-mode. I've tried it before and didn't really like it, but this time I've combined it with some, IMO, nice header comments.

I've written a simple skeleton to help me write these comment lines:

(define-skeleton outline-skeleton
"Insert command"
"Text: "
'(beginning-of-line)
'(setq beginning-of-line-point (point))
'(indent-according-to-mode)
'(setq beginning-of-indent-point (point))
comment-start "-----[ " str " ]"
(let ((len (- fill-column
(length comment-start)
(length comment-end)
(length str)
9
(- beginning-of-indent-point
beginning-of-line-point))))
(insert-char ?- len))
comment-end)

And then I add this hook:
(add-hook
'prog-mode-hook
(lambda ()
(outline-minor-mode 1)
(set (make-local-variable 'outline-regexp)
(concat "\\s *" (regexp-opt `(,comment-start)) "-----\\["))
(hide-body)
(local-set-key [C-tab] 'outline-toggle-children)))

And whenever I load a file with these comments I get a nice and clean outline of my file.

Also, since it uses the variables comment-start and comment-end it works for multiple programming languages. I've tried it in both emacs-lisp and php.

Looks like:
;-----[ Prog mode ]---------------------------------------------------

What are some of the other options people use?

ntd progress #1

So I’ve only had a little bit of time to work on ntd. But at least I did do something, though nothing major. I got rid of the gets() function by replacing it with getline(), I know this is a GNU extension, but it’s apparently recommended and for now I don’t think anyone other than myself is using it, and since I only use archlinux I’m in minimal danger of incompatibilities.

I’m still getting some errors with valgrind, but if I eventually figure them out I will be able to fix it.

Maybe tomorrow I can finally start adding another command.


Syndicated 2011-09-19 22:50:05 from RyuSlash's Blog » Advogato

New toudou

So, I’m trying again… After feeling I couldn’t achieve what I wanted with toudou or toudou2 through 5, I’m starting from scratch again with ntd (New toudou).

This time I’m first going to focus on creating a shell in which I can perform the actions that I want. After that I will start looking at/thinking about user interfaces again.

Right now it’s only a tiny shell with some big holes in it (usage of gets, for example) that need to be fixed, and it only knows help and exit for commands, but it’s a start, again.

The code for it is here, though I can’t recommend looking at it yet, it might burn your eyes out.


Syndicated 2011-09-19 13:39:26 from RyuSlash's Blog » Advogato

17 Sep 2011 (updated 17 Sep 2011 at 08:22 UTC) »
redi: Ok, but, now I have 2 people to reply to, and I want to post something new. If I split it into 3 posts my name will appear high on the recentlog 3 times, making people think that I think I'm important enough to take up that much space.

Now, if I combine the replies and the post into 1, the 'thread' is completely broken, nothing about what I'm saying here indicates whether or not I'll be replying to anyone else or starting a new post. I don't care if comments get shown on the recentlog or not, if it's purely about conversation, but an indication of what it is meant to be might be nice. So that if I were to split it in 3, it would at least be clear that 2 of those were replies to others, and not just spam :)

cdfrey: As I've just said to redi, comments showing up on the recentlog would be fine, probably even a good idea because of exactly what you said. Also, I agree with your article comment, if we could at least see from the original post what discussion has been had over it, I would gladly leave it at that and be more than happy (since I'm already happy).

Thanks to both of you, and Zaitcev, for your comments, I appreciate it.

I've chosen a middle road, I'll split it in 2 (one for replies and one for post) and leave some time before I post again in the hope someone else is going to post as well :)

This site really needs comments on the blogs as well.

I read in one of the articles that was posted that a patch had been sent in to allow commenting of this sort, but it wasn't applied because there were other things higher on the todo list. I don't understand, though, what this has to do with not applying it. Is it because something else needs to be done in order for it to work, or because there are security/stability issues involved, or perhaps the person in charge just doesn't have the time for it? I'd actually kind of like to know...

Anyway, the reason that I have found this is that I'd really like to comment on certain people's posts, but I don't want to fill up the recentlog with these replies. Only the people interested in the original post would want to know about any discussion about that post, I would think.

It's also nice to be able to see where the discussion about this post lead. Right now there's no way of knowing who replies to what really. This also makes it harder to look up older comments, I have to remember who replied to me to be able to look it up.

I wouldn't mind having a look at implementing such a thing, but knowing that someone already has and it hasn't been accepted makes me wonder what else can be done. So far I really like it here, and forking over something like this seems rather extreme, so I blog.

First of all, thanks cdfrey for encouraging me and helping me along. It might seem silly, but seeing something like this so early on in a tryout (which this of course is for me) is very encouraging. And thank you for the certification, I will try to live up to it.

Before I really start writing about what I'm working on and learning, and so on, I thought I'd rant a little bit more, this time about free and open source software, I sometimes have an opinion and maybe it's time I start sharing it.

I've been having a kind-of crisis of faith.

I'm not the person who's used free software the longest. When I started using Linux I still didn't know about the difference between Free software and software at no cost. It started as an experiment unrelated to being free in either sense.

Since then, though, I have learned more about free software and about entities such as the FSF, LF and of course people such as Richard Stallman and Linus Torvalds. I have read parts of the GPL and have encountered some other licenses as well.

My problem comes from the idea of freedom. I can't decide whether copyleft is more about freedom or if a permissive license like BSD-style licenses are. Do I want people who use what I write to be completely free to do as they please, or for the things I write to be free and have a certain amount of protection to keep them free.

Then there's the GPLv2 vs GPLv3. From what I know I'd have to say that the GPLv3 is a very logical expansion/'improvement' upon the GPLv2, but it does seem somewhat more restricting in what it allows people to do with the software, in the name of keeping the software written free.

How can one know which branch of freedom is better? Is that even the right, or at least a valid, question?
I'm not trying to be inflamatory or anything, this really does fly through my head a lot.

For what it's worth, so far I have always chosen the GPL path. Even though in a certain way it limits the user of my software more than a permissive license would, I do believe that in the end it provides a great(er) guarantee of freedom for the (eventual) end-user.

Ok, so I've been looking at this website for a few hours now, trying to decide whether or not I should try it out and see what it's all about.

I must say that the all the text about the website seems rather demanding.
I try to contribute to free software, I believe in free software, and if it is my choice to make I write free software, but I'm not well known in any circles because I'm an observer most of the time

So saying that I should only join if I can get to the level of Apprentice scares me, because nobody knows me here or anywhere else.

I thought I'd try anyway, though, so here I am.

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!