~martanne/devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH vis] retab vis.c

Details
Message ID
<20240522074420.8149-1-mcepl@cepl.eu>
DKIM signature
pass
Download raw message
Patch: +11 -11
Signed-off-by: Matěj Cepl <mcepl@cepl.eu>
---
It seems to me that we got a bit careless about TABs v spaces.

 vis.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/vis.c b/vis.c
index 4a025f9a..ad4114ca 100644
--- a/vis.c
+++ b/vis.c
@@ -94,7 +94,7 @@ char *absolute_path(const char *name) {
		path_absolute[0] = '\0';

	snprintf(path_normalized, sizeof(path_normalized), "%s/%s",
	         path_absolute, base);
			 path_absolute, base);
err:
	free(copy1);
	free(copy2);
@@ -124,7 +124,7 @@ static File *file_new(Vis *vis, const char *name, bool internal) {
		for (File *file = vis->files; file; file = file->next) {
			if (file->name) {
				if ((cmp_names && strcmp(file->name, name_absolute) == 0) ||
				    (file->stat.st_dev == new.st_dev && file->stat.st_ino == new.st_ino)) {
					(file->stat.st_dev == new.st_dev && file->stat.st_ino == new.st_ino)) {
					existing = file;
					break;
				}
@@ -1082,8 +1082,8 @@ static void vis_keys_process(Vis *vis, size_t pos) {
		for (Mode *global_mode = vis->mode; global_mode && !prefix; global_mode = global_mode->parent) {
			for (int global = 0; global < 2 && !prefix; global++) {
				Mode *mode = (global || !vis->win) ?
					     global_mode :
				             &vis->win->modes[global_mode->id];
							  global_mode :
							  &vis->win->modes[global_mode->id];
				if (!mode->bindings)
					continue;
				/* keep track of longest matching binding */
@@ -1103,7 +1103,7 @@ static void vis_keys_process(Vis *vis, size_t pos) {
				map_iterate(pmap, isprefix, &completions);

				prefix = (!match && completions.count > 0) ||
				         ( match && completions.count > 1);
						 ( match && completions.count > 1);
			}
		}

@@ -1192,8 +1192,8 @@ static const char *getkey(Vis *vis) {
		return NULL;
	ui_info_hide(&vis->ui);
	bool use_keymap = vis->mode->id != VIS_MODE_INSERT &&
	                  vis->mode->id != VIS_MODE_REPLACE &&
	                  !vis->keymap_disabled;
		vis->mode->id != VIS_MODE_REPLACE &&
		!vis->keymap_disabled;
	vis->keymap_disabled = false;
	if (key.type == TERMKEY_TYPE_UNICODE && use_keymap) {
		const char *mapped = map_get(vis->keymap, key.utf8);
@@ -1310,7 +1310,7 @@ int vis_run(Vis *vis) {
		ui_draw(&vis->ui);
		idle.tv_sec = vis->mode->idle_timeout;
		int r = pselect(vis_process_before_tick(&fds) + 1, &fds, NULL, NULL,
		                timeout, &emptyset);
				timeout, &emptyset);
		if (r == -1 && errno == EINTR)
			continue;

@@ -1833,9 +1833,9 @@ int vis_pipe_collect(Vis *vis, File *file, Filerange *range, const char *argv[],
	buffer_init(&bufout);
	buffer_init(&buferr);
	int status = vis_pipe(vis, file, range, argv,
	                      &bufout, out ? read_buffer : NULL,
	                      &buferr, err ? read_buffer : NULL,
	                      fullscreen);
						  &bufout, out ? read_buffer : NULL,
						  &buferr, err ? read_buffer : NULL,
						  fullscreen);
	buffer_terminate(&bufout);
	buffer_terminate(&buferr);
	if (out)
-- 
2.45.1

[vis/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D1G08SLYSQQW.1P6WTO1BBPWU5@fra01>
In-Reply-To
<20240522074420.8149-1-mcepl@cepl.eu> (view parent)
DKIM signature
missing
Download raw message
vis/patches: SUCCESS in 1m24s

[retab vis.c][0] from [Matěj Cepl][1]

[0]: https://lists.sr.ht/~martanne/devel/patches/52850
[1]: mcepl@cepl.eu

✓ #1227963 SUCCESS vis/patches/freebsd.yml https://builds.sr.ht/~martanne/job/1227963
✓ #1227962 SUCCESS vis/patches/debian.yml  https://builds.sr.ht/~martanne/job/1227962
✓ #1227961 SUCCESS vis/patches/alpine.yml  https://builds.sr.ht/~martanne/job/1227961
✓ #1227964 SUCCESS vis/patches/openbsd.yml https://builds.sr.ht/~martanne/job/1227964
Details
Message ID
<31Q7TD0DDQ28X.3KQABA4W8M5B5@rnpnr.xyz>
In-Reply-To
<20240522074420.8149-1-mcepl@cepl.eu> (view parent)
DKIM signature
permerror
Download raw message
Matěj Cepl <mcepl@cepl.eu> wrote:
> Signed-off-by: Matěj Cepl <mcepl@cepl.eu>
> ---
> It seems to me that we got a bit careless about TABs v spaces.
> 
>  vis.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 

Hi Matěj,

I'm going to reject this. The whitespace is correct in most of
these places. When the previous line is broken (to keep it near 80
columns or for readability) the number of tabs should not be
changed. Spaces are used for alignment with the original part of
the expression. If you use a different number of tabs then
alignment will be incorrect if the reader uses a different tabstop
from the author.

- Randy

> diff --git a/vis.c b/vis.c
> index 4a025f9a..ad4114ca 100644
> --- a/vis.c
> +++ b/vis.c
> @@ -94,7 +94,7 @@ char *absolute_path(const char *name) {
>  		path_absolute[0] = '\0';
>  
>  	snprintf(path_normalized, sizeof(path_normalized), "%s/%s",
> -	         path_absolute, base);
> +			 path_absolute, base);
>  err:
>  	free(copy1);
>  	free(copy2);
> @@ -124,7 +124,7 @@ static File *file_new(Vis *vis, const char *name, bool internal) {
>  		for (File *file = vis->files; file; file = file->next) {
>  			if (file->name) {
>  				if ((cmp_names && strcmp(file->name, name_absolute) == 0) ||
> -				    (file->stat.st_dev == new.st_dev && file->stat.st_ino == new.st_ino)) {
> +					(file->stat.st_dev == new.st_dev && file->stat.st_ino == new.st_ino)) {
>  					existing = file;
>  					break;
>  				}
> @@ -1082,8 +1082,8 @@ static void vis_keys_process(Vis *vis, size_t pos) {
>  		for (Mode *global_mode = vis->mode; global_mode && !prefix; global_mode = global_mode->parent) {
>  			for (int global = 0; global < 2 && !prefix; global++) {
>  				Mode *mode = (global || !vis->win) ?
> -					     global_mode :
> -				             &vis->win->modes[global_mode->id];
> +							  global_mode :
> +							  &vis->win->modes[global_mode->id];
>  				if (!mode->bindings)
>  					continue;
>  				/* keep track of longest matching binding */
> @@ -1103,7 +1103,7 @@ static void vis_keys_process(Vis *vis, size_t pos) {
>  				map_iterate(pmap, isprefix, &completions);
>  
>  				prefix = (!match && completions.count > 0) ||
> -				         ( match && completions.count > 1);
> +						 ( match && completions.count > 1);
>  			}
>  		}
>  
> @@ -1192,8 +1192,8 @@ static const char *getkey(Vis *vis) {
>  		return NULL;
>  	ui_info_hide(&vis->ui);
>  	bool use_keymap = vis->mode->id != VIS_MODE_INSERT &&
> -	                  vis->mode->id != VIS_MODE_REPLACE &&
> -	                  !vis->keymap_disabled;
> +		vis->mode->id != VIS_MODE_REPLACE &&
> +		!vis->keymap_disabled;
>  	vis->keymap_disabled = false;
>  	if (key.type == TERMKEY_TYPE_UNICODE && use_keymap) {
>  		const char *mapped = map_get(vis->keymap, key.utf8);
> @@ -1310,7 +1310,7 @@ int vis_run(Vis *vis) {
>  		ui_draw(&vis->ui);
>  		idle.tv_sec = vis->mode->idle_timeout;
>  		int r = pselect(vis_process_before_tick(&fds) + 1, &fds, NULL, NULL,
> -		                timeout, &emptyset);
> +				timeout, &emptyset);
>  		if (r == -1 && errno == EINTR)
>  			continue;
>  
> @@ -1833,9 +1833,9 @@ int vis_pipe_collect(Vis *vis, File *file, Filerange *range, const char *argv[],
>  	buffer_init(&bufout);
>  	buffer_init(&buferr);
>  	int status = vis_pipe(vis, file, range, argv,
> -	                      &bufout, out ? read_buffer : NULL,
> -	                      &buferr, err ? read_buffer : NULL,
> -	                      fullscreen);
> +						  &bufout, out ? read_buffer : NULL,
> +						  &buferr, err ? read_buffer : NULL,
> +						  fullscreen);
>  	buffer_terminate(&bufout);
>  	buffer_terminate(&buferr);
>  	if (out)


-- 
https://rnpnr.xyz/
GPG Fingerprint: B8F0 CF4C B6E9 415C 1B27 A8C4 C8D2 F782 86DF 2DC5
Details
Message ID
<D1K810PAC8RO.22YAVQR2BEXUH@cepl.eu>
In-Reply-To
<31Q7TD0DDQ28X.3KQABA4W8M5B5@rnpnr.xyz> (view parent)
DKIM signature
pass
Download raw message
On Mon May 27, 2024 at 4:27 AM CEST, Randy Palamar wrote:
> Hi Matěj,
>
> I'm going to reject this. The whitespace is correct in most of
> these places. When the previous line is broken (to keep it near 80
> columns or for readability) the number of tabs should not be
> changed. Spaces are used for alignment with the original part of
> the expression. If you use a different number of tabs then
> alignment will be incorrect if the reader uses a different tabstop
> from the author.

No problem. It was just one :retab in neovim for me anyway (with
a bit of checking afterwards). I, as a Pythonista, believe in
spaces anyway ;).

Best,

Matěj

-- 
http://matej.ceplovi.cz/blog/, @mcepl@floss.social
GPG Finger: 3C76 A027 CA45 AD70 98B5  BC1D 7920 5802 880B C9D8
 
“Push to test.” (click) “Release to detonate…”
 -- from a bugzilla quip list
Reply to thread Export thread (mbox)