Re: Dired diff

2011-08-23 Thread Nima Hoda
On Tue, Aug 23, 2011 at 08:47:12PM +0400, Loganaden Velvindron wrote:
> I'm over-stretching it, but on -current this compiles
> with warnings :-D
> 
> Can you test this diff and report on tech@ please :-) ?

Works fine and compiles without warnings.  I tested on 4.8/amd64 and
on current/loongson.

Cheers,
-Nima
-- 
The pudding is in the proof.



src/usr.bin/at build broken

2011-08-23 Thread Nima Hoda
Hello:

The last revision to src/usr.sbin/cron/macros.h removed some custom
macros (OK_EXIT, ERROR_EXIT) that src/usr.bin/at/at.c relies on.
Here's a patch that moves at.c to the standard ones (EXIT_FAILURE,
EXIT_SUCCESS).

Cheers,
-Nima
-- 
The pudding is in the proof.


Index: at.c
===
RCS file: /cvs/src/usr.bin/at/at.c,v
retrieving revision 1.58
diff -u -r1.58 at.c
--- at.c3 Mar 2011 15:06:43 -   1.58
+++ at.c23 Aug 2011 14:44:08 -
@@ -82,7 +82,7 @@
PRIV_END;
}
 
-   exit(ERROR_EXIT);
+   exit(EXIT_FAILURE);
 }
 
 /*
@@ -98,7 +98,7 @@
PRIV_END;
}
 
-   exit(ERROR_EXIT);
+   exit(EXIT_FAILURE);
 }
 
 /*
@@ -115,7 +115,7 @@
PRIV_END;
}
 
-   exit(ERROR_EXIT);
+   exit(EXIT_FAILURE);
 }
 
 /*
@@ -140,7 +140,7 @@
PRIV_END;
}
 
-   _exit(ERROR_EXIT);
+   _exit(EXIT_FAILURE);
 }
 
 /* ARGSUSED */
@@ -669,7 +669,7 @@
" may %s other users' jobs\n",
ProgramName, what == ATRM
? "remove" : "view");
-   exit(ERROR_EXIT);
+   exit(EXIT_FAILURE);
}
uids[uids_len++] = pw->pw_uid;
} else
@@ -876,7 +876,7 @@
 
if ((pw = getpwuid(uid)) == NULL) {
perror("Cannot access password database");
-   exit(ERROR_EXIT);
+   exit(EXIT_FAILURE);
}
 
PRIV_START;
@@ -913,7 +913,7 @@
"usage: batch [-m] [-f file] [-q queue] [timespec]\n");
break;
}
-   exit(ERROR_EXIT);
+   exit(EXIT_FAILURE);
 }
 
 int
@@ -1076,7 +1076,7 @@
if (argc == 0)
usage();
else if ((timer = parsetime(argc, argv)) == -1)
-   exit(ERROR_EXIT);
+   exit(EXIT_FAILURE);
}
writefile(cwd, timer, queue);
break;
@@ -1090,7 +1090,7 @@
if (argc == 0)
timer = time(NULL);
else if ((timer = parsetime(argc, argv)) == -1)
-   exit(ERROR_EXIT);
+   exit(EXIT_FAILURE);
 
writefile(cwd, timer, queue);
break;
@@ -1099,5 +1099,5 @@
panic("Internal error");
break;
}
-   exit(OK_EXIT);
+   exit(EXIT_SUCCESS);
 }



Re: Dired diff

2011-08-22 Thread Nima Hoda
On Thu, Aug 18, 2011 at 05:27:40PM +0400, Loganaden Velvindron wrote:
> I have improved it further by simplifying it. Can you test & report
> this one to tech@ instead ?
> 
> http://marc.info/?l=openbsd-tech&m=131367237631197&w=2

Tested this (on amd64) and it seems to work ok.  Thanks again for your
work on this.

Cheers,
-Nima
-- 
The pudding is in the proof.



Re: Need testers for mg dired diff

2011-07-31 Thread Nima Hoda
On Sun, Jul 31, 2011 at 11:40:43PM +0400, Loganaden Velvindron wrote:
> As for the key-bindings, I picked the one which were un-used in
> dired, as this seems to be practice that were used by some of the
> previous diffs committed by kjell.  Those keybinds apply to dired
> mode only.
> 
> Overall, the diff is small & doesn't break anything while reducing
> my annoyance :-D

Sure.  I only thought if the same or similar functionality exists in
Emacs, why not do it the same way in mg if it's just as simple to
implement that way?

Cheers,
-Nima
-- 
The pudding is in the proof.



Re: Need testers for mg dired diff

2011-07-31 Thread Nima Hoda
On Sun, Jul 31, 2011 at 11:59:41PM +0400, Loganaden Velvindron wrote:
> C-N and C-P are already assigned to forward-line and backward-line
> in dired.c I don't think it's a good idea to remap existing
> key-bindings...

Well, if you were going to reassign C-n and C-p to next page and
previous page then it would be a bad idea.  If you're just making C-n
and C-p move by single lines but stick to the start of the filename
(as is done in Emacs), then I'd think it's probably not a problem.

Cheers,
-Nima
-- 
The pudding is in the proof.



Re: Need testers for mg dired diff

2011-07-31 Thread Nima Hoda
On Sun, Jul 31, 2011 at 12:15:56PM -0600, Theo de Raadt wrote:
> > I tested the patch briefly and it seems to work fine BUT I'm not sure
> > why this is a good idea.  You're mapping keys that do other things in
> > Emacs (esp. C-o but also C-t and even C-w which can be used if the
> > dired buffer is made non-read-only in Emacs).
> 
> When the change is simple, mg should behave like emacs.
> 
> Sometimes it will be different because it is a simpler editor.  But
> it should not go out of the way to be different.

Yeah, this doesn't seem like a difference due to simplicity.  It would
be just as simple to wrap next-line and previous-line to replicate the
Emacs behaviour.

Cheers,
-Nima
-- 
The pudding is in the proof.



Re: Need testers for mg dired diff

2011-07-31 Thread Nima Hoda
On Sun, Jul 31, 2011 at 09:23:29PM +0400, Loganaden Velvindron wrote:
> You can check our mg from current, it should compile fine.
> 
> Here's the diff:
> 
> http://marc.info/?l=openbsd-tech&m=131160869319297&w=2
> 
> Explanation Here:
> 
> http://marc.info/?l=openbsd-tech&m=131161031221785&w=2

CC openbsd-tech for other opinions on this (note: I'm not a member of
the list).

I tested the patch briefly and it seems to work fine BUT I'm not sure
why this is a good idea.  You're mapping keys that do other things in
Emacs (esp. C-o but also C-t and even C-w which can be used if the
dired buffer is made non-read-only in Emacs).

Why not implement dired C-n and C-p from Emacs instead (nothing wrong
with C-v followed by C-n)?  And bind "M-g g" to goto-line as is done
in all modes by default in recent Emacs?

http://www.gnu.org/software/libtool/manual/emacs/Dired-Navigation.html
http://www.gnu.org/s/libtool/manual/emacs/Moving-Point.html

Cheers,
-Nima
-- 
The pudding is in the proof.



Re: Add back-to-indentation (M-m) for mg

2010-12-28 Thread Nima Hoda
> On Mon, Dec 27, 2010 at 7:33 PM, Nima Hoda  wrote:
> 
> > On Mon, Dec 27, 2010 at 03:01:57PM -0700, Kjell Wooding wrote:
> > > Looks good. Here is a slight cleanup. Essentially, fix alphabetical
> > > ordering, change function name :
> >
> > The patch isn't applying for me.  It seems tabs have been converted to
> > spaces in your diff.

On Tue, Dec 28, 2010 at 12:06:35AM -0700, Kjell Wooding wrote:
> Probably my (pasting) bad. This isn't my favourite mailer. patch -l
> will fix that though...

Thanks, I didn't know that.  I'm not sure if more testing is needed
but the cleaned up patch is working fine for me (4.8-current/sparc64).

Cheers,
-Nima



Re: Add back-to-indentation (M-m) for mg

2010-12-27 Thread Nima Hoda
On Mon, Dec 27, 2010 at 03:01:57PM -0700, Kjell Wooding wrote:
> Looks good. Here is a slight cleanup. Essentially, fix alphabetical
> ordering, change function name :

The patch isn't applying for me.  It seems tabs have been converted to
spaces in your diff.

> Index: def.h
> ===
> RCS file: /cvs/src/usr.bin/mg/def.h,v
> retrieving revision 1.113
> diff -u -u -r1.113 def.h
> --- def.h30 Jun 2010 19:12:54 -1.113
> +++ def.h27 Dec 2010 21:58:28 -
> @@ -511,6 +511,7 @@
>  int forwdel(int, int);
>  int backdel(int, int);
>  int space_to_tabstop(int, int);
> +int backtoindent(int, int);
> 
>  /* extend.c X */
>  int insert(int, int);
> Index: funmap.c
> ===
> RCS file: /cvs/src/usr.bin/mg/funmap.c,v
> retrieving revision 1.32
> diff -u -u -r1.32 funmap.c
> --- funmap.c15 Sep 2008 16:13:35 -1.32
> +++ funmap.c27 Dec 2010 21:58:28 -
> @@ -26,6 +26,7 @@
>  {auto_execute, "auto-execute", },
>  {fillmode, "auto-fill-mode",},
>  {indentmode, "auto-indent-mode",},
> +{backtoindent, "back-to-indentation",},
>  {backchar, "backward-char",},
>  {delbword, "backward-kill-word",},
>  {gotobop, "backward-paragraph",},
> Index: keymap.c
> ===
> RCS file: /cvs/src/usr.bin/mg/keymap.c,v
> retrieving revision 1.43
> diff -u -u -r1.43 keymap.c
> --- keymap.c27 Aug 2008 04:11:52 -1.43
> +++ keymap.c27 Dec 2010 21:58:28 -
> @@ -241,7 +241,7 @@
> 
>  static PF metal[] = {
>  lowerword,/* l */
> -rescan,/* m */
> +backtoindent,/* m */
>  rescan,/* n */
>  rescan,/* o */
>  rescan,/* p */
> Index: mg.1
> ===
> RCS file: /cvs/src/usr.bin/mg/mg.1,v
> retrieving revision 1.47
> diff -u -u -r1.47 mg.1
> --- mg.17 Oct 2010 17:08:58 -1.47
> +++ mg.127 Dec 2010 21:58:28 -
> @@ -230,6 +230,8 @@
>  forward-word
>  .It M-l
>  downcase-word
> +.It M-m
> +back-to-indentation
>  .It M-q
>  fill-paragraph
>  .It M-r
> @@ -304,6 +306,8 @@
>  to a new line.
>  .It auto-indent-mode
>  Toggle indent mode, where indentation is preserved after a newline.
> +.It back-to-indentation
> +Move the dot to the first non-whitespace character on the current line.
>  .It backward-char
>  Move cursor backwards one character.
>  .It backward-kill-word
> Index: random.c
> ===
> RCS file: /cvs/src/usr.bin/mg/random.c,v
> retrieving revision 1.26
> diff -u -u -r1.26 random.c
> --- random.c15 Sep 2008 16:13:35 -1.26
> +++ random.c27 Dec 2010 21:58:28 -
> @@ -440,3 +440,16 @@
>  return (linsert((n << 3) - (curwp->w_doto & 7), ' '));
>  }
>  #endif /* NOTAB */
> +
> +/*
> + * Move the dot to the first non-whitespace character of the current line.
> + */
> +int
> +backtoindent(int f, int n)
> +{
> +gotobol(FFRAND, 1);
> +while (curwp->w_doto < llength(curwp->w_dotp) &&
> +(isspace(lgetc(curwp->w_dotp, curwp->w_doto
> +++curwp->w_doto;
> +return (TRUE);
> +}



Re: Add back-to-indentation (M-m) for mg

2010-12-24 Thread Nima Hoda
On Fri, Dec 24, 2010 at 03:28:49PM +0200, Henri Kemppainen wrote:
> This adds the command that moves the dot to the first non-whitespace
> character on the line.

Thanks for this.  Working great for me on 4.8-current/sparc64.

Cheers,
-Nima