aboutsummaryrefslogtreecommitdiffhomepage
Commit message (Collapse)AuthorAge
* nmbug-status: Convert from XHTML 1.0 to HTML 5Gravatar W. Trevor King2014-02-10
| | | | | | | | | | | | | | | | | | | | | | | | HTML 5 for the win :). I also de-namespaced the language; the HTML 5 spec allows a vestigial xml:lang attribute, but it's a no-op [1], so I stripped it. This shouldn't break anything at tethera, which already serves the status as text/html: $ wget -S http://nmbug.tethera.net/status/ --2014-02-02 21:20:39-- http://nmbug.tethera.net/status/ Resolving nmbug.tethera.net... 87.98.215.224 Connecting to nmbug.tethera.net|87.98.215.224|:80... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Vary: Accept-Encoding Content-Type: text/html ... This also matches the Content-Type in the generated HTML's http-equiv meta. [1]: http://www.w3.org/TR/html5/dom.html#the-lang-and-xml:lang-attributes
* nmbug-status: Normalize table HTML indentationGravatar W. Trevor King2014-02-10
| | | | | I don't think I've ever seen '</td><td>{value}\n' before :p. The new formatting avoids mixing tag levels and content across lines.
* nmbug-status: Add an OrderedDict stub for Python 2.6Gravatar W. Trevor King2014-02-10
| | | | | | | | | | | | Tomi Ollila and David Bremner (and presumably others) are running Python 2.6 on their nmbug-status boxes, so it makes sense to keep support for that version. This commit adds a really minimal OrderedDict stub (e.g. it doesn't handle key removal), but it gets the job done for Page._get_threads. Once we reach a point where Python 2.6 is no longer important (it's already out of it's security-fix window [1]), we can pull this stub back out. [1]: http://www.python.org/download/releases/2.6.9/
* nmbug-status: Add Page and HtmlPage for modular renderingGravatar W. Trevor King2014-02-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I was having trouble understanding the logic of the longish print_view function, so I refactored the output generation into modular bits. The basic text rendering is handled by Page, which has enough hooks that HtmlPage can borrow the logic and slot-in HTML generators. By modularizing the logic it should also be easier to build other renderers if folks want to customize the layout for other projects. Timezones ========= This commit has not effect on the output, except that some dates have been converted from the sender's timezone to UTC due to: - val = m.get_header(header) - ... - if header == 'date': - val = str.join(' ', val.split(None)[1:4]) - val = str(datetime.datetime.strptime(val, '%d %b %Y').date()) ... + value = str(datetime.datetime.utcfromtimestamp( + message.get_date()).date()) I also tweaked the HTML header date to be utcnow instead of the local now() to make all times independent of the generator's local time. This matches Gmane, which converts all Date headers to UTC (although they use a 'GMT' suffix). Notmuch uses g_mime_utils_header_decode_date to calculate the UTC timestamps, but uses a NULL tz_offset which drops the information we'd need to get back to the sender's local time [1]. With the generator's local time arbitrarily different from the sender's and viewer's local time, sticking with UTC seems the best bet. [1]: https://developer.gnome.org/gmime/stable/gmime-gmime-utils.html#g-mime-utils-header-decode-date
* nmbug-status: Add a Python-3-compatible urllib.parse.quote importGravatar W. Trevor King2014-02-10
| | | | | | | | Python 2's urllib.quote [1] has moved to urllib.parse.quote in Python 3 [2]. [1]: http://docs.python.org/2/library/urllib.html#urllib.quote [2]: http://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote
* nmbug-status: Consolidate HTML header printingGravatar W. Trevor King2014-02-10
| | | | | | | | Make this all one big string, using '...{date}...'.format(date=...) to inject the date [1]. This syntax was added in Python 2.6, and is preferred to %-formatting in Python 3 [1]. [1]: http://docs.python.org/2/library/stdtypes.html#str.format
* nmbug-status: Don't require write accessGravatar W. Trevor King2014-02-10
| | | | | | | | | | | | | | | | The database in only used for notmuch.Query, so there's no need for write access. This allows nmbug-status to run while the database is being updated, without raising: A Xapian exception occurred opening database: Unable to get write lock on …: already locked Traceback (most recent call last): File "./nmbug-status", line 182, in <module> db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE) File "/…/notmuch/database.py", line 154, in __init__ self.open(path, mode) File "/…/notmuch/database.py", line 214, in open raise NotmuchError(status) notmuch.errors.XapianError
* nmbug-status: Consolidate functions and main codeGravatar W. Trevor King2014-02-10
| | | | | | | | | | | | | | | | The definitions of Thread, output_with_separator, and print_view were between the main argparse and view-printing code. Group them together with our existing read_config at the top of the module, which makes for easier reading in the main section. I also: * Made 'headers' a print_view argument instead of a module-level global. The list -> tuple conversion avoids having a mutable default argument, which makes some people jumpy ;). * Made 'db' a print_view argument instead of relying on the global namespace to access it from print_view.
* nmbug-status: Add metavars for --config and --get-queryGravatar W. Trevor King2014-02-10
| | | | | | | | | | | | Now the suggested usage (listed by 'nmbug-status --help') is: usage: nmbug-status [-h] [--text] [--config PATH] [--list-views] [--get-query VIEW] instead of the less obvious: usage: nmbug-status [-h] [--text] [--config CONFIG] [--list-views] [--get-query GET_QUERY]
* nmbug-status: Factor config-loading out into read_configGravatar W. Trevor King2014-02-10
| | | | | By isolating this peripheral handling, we make the core logic of nmbug-status easier to read.
* nmbug-status: Decode Popen output using the user's localeGravatar W. Trevor King2014-02-10
| | | | | | | | | | | | | | | | | | | | | | Avoid: $ ./nmbug-status --list-views Traceback (most recent call last): File "./nmbug-status", line 47, in <module> 'cat-file', 'blob', sha1+':status-config.json'], TypeError: can't concat bytes to str by explicitly converting the byte-stream read from Popen into a Unicode string. On Python 2, this conversion is str -> unicode; on Python 3 it is bytes -> str. _ENCODING is derived from the user's locale (or system default) in an attempt to match Git's output encoding. It may be more robust to skip the encoding/decoding by using a Python wrapper like pygit2 [1] for Git access. That's a fairly heavy dependency though, and using the locale will probably work. [1]: http://www.pygit2.org/
* nmbug-status: Use email.utils instead of rfc822Gravatar W. Trevor King2014-02-10
| | | | | | | rfc822 has been deprecated since Python 2.3, and it's gone in Python 3 [1]. [1]: http://docs.python.org/2/library/rfc822.html
* nmbug-status: Convert to Python-3-compatible print functionsGravatar W. Trevor King2014-02-10
| | | | We shouldn't require folks to install Python 2 to run nmbug-status.
* emacs: initialize ido(-completing-read) in emacs 23.[123]Gravatar Tomi Ollila2014-02-03
| | | | Otherwise `ido-completing-read' will freeze after PROMPT is displayed.
* completion: bash completion for notmuch new --quiet optionGravatar Jani Nikula2014-02-03
| | | | notmuch new now has --quiet option, complete it too.
* configure: only install bash completion if supportedGravatar Jani Nikula2014-02-03
| | | | | Our bash completion depends on bash-completion 1.90 or later. Only install where available.
* emacs: ad-activate 'mm-shr after ad-disable-advice 'mm-shrGravatar Tomi Ollila2014-01-30
| | | | | | | | Imitated from "Enabling advice" in Emacs lisp manual... ad-disable-advice by itself only changes the enable flag for a piece of advice. To make the change take effect in the advised definition, the advice needs to be activated again.
* test: add basic tests for notmuch new --quiet optionGravatar Jani Nikula2014-01-27
| | | | | This does not cover all the possible paths notmuch new could output stuff, but it's better than nothing.
* emacs: add notmuch-assert-cli-sane to notmuch-helloGravatar David Bremner2014-01-26
| | | | | | | This is meant to be the friendly entrypoint, so let's do something better than the mangled output described in id:5228989D.8030607@fifthhorseman.net
* emacs: add function notmuch-assert-cli-saneGravatar David Bremner2014-01-26
| | | | | If the CLI seems borked, signal an error, and log a suggestion for the user about how to recover.
* emacs: add a function to heuristically test if the CLI is configured OK.Gravatar David Bremner2014-01-26
| | | | | We cache the result so that we can call the function many places without worrying about the cost.
* man: document notmuch new --quiet optionGravatar Jani Nikula2014-01-26
|
* cli: add --quiet option to notmuch newGravatar Jani Nikula2014-01-26
| | | | | | Tie it to --verbose (resulting in verbosity levels of quiet, normal, and verbose) but leave --debug orthogonal. Do some drive-by cleaning while at it.
* cli: abstract notmuch new result printingGravatar Jani Nikula2014-01-26
| | | | | | The notmuch_new_command() function has grown huge, chop it up a bit. This should also be helpful when adding a --quiet option to notmuch new. No functional changes.
* cli: for loop is more customaryGravatar Jani Nikula2014-01-26
| | | | | With the happy day stop condition within the while, it was confusing. Switch to the paradigm for loop. No functional changes.
* cli: use dirent_type in count_files tooGravatar Jani Nikula2014-01-26
| | | | | Avoid an extra stat per file, if possible, also when counting the files for initial indexing.
* cli: only check the ignore list if neededGravatar Jani Nikula2014-01-26
| | | | | Premature optimization is the root of all evil, but this is simple enough.
* cli: extract single message addition in notmuch new to clarify codeGravatar Jani Nikula2014-01-26
| | | | | The add_files() function has grown huge, chop it up a bit. No functional changes.
* lib: update documentation for notmuch_database_get_directoryGravatar David Bremner2014-01-26
| | | | | | | | | Clarify that using the directory after destroying the corresponding database is not permitted. This is implicit in the description of notmuch_database_destroy, but it doesn't hurt to be explicit, and we do express similar "ownership" relationships at other places in the docs.
* build: delete the default .SUFFIXESGravatar Tomi Ollila2014-01-25
| | | | | | | All implicit rules in notmuch Makefiles are "pattern rules"; Deleting the default suffixes (to support obsolete, old-fashioned "suffix rules") from make reduces the output of 'make -d' by 40 to 90 percent, helping e.g. debugging make problems.
* notmuch-show: detect NULL pointer returned from notmuch_query_search_threadsGravatar David Bremner2014-01-24
| | | | We want to return an error status, not 0 or (worse) segfault.
* lib: make notmuch_threads_valid return FALSE when passed NULLGravatar David Bremner2014-01-24
| | | | | Without this patch, the example code in the header docs crashes for certain invalid queries (see id:871u00oimv.fsf@approx.mit.edu)
* test: add known broken test exit code of notmuch showGravatar David Bremner2014-01-24
| | | | | This test catches a segfault on a syntactically invalid query. It also catches a problem with my initial fix, which still returned 0.
* man: update notmuch-dump man page for new default.Gravatar David Bremner2014-01-24
| | | | | | Actually the previous default was not documented explicitely. I moved the batch-tag section first because it seemed that the formats were previously documented in order default, other.
* notmuch dump: default to batch-tag format.Gravatar David Bremner2014-01-24
| | | | | Although we didn't formally deprecate the old format, the new one has been available for a year.
* cli: abstract common config get/set codeGravatar Jani Nikula2014-01-18
| | | | Pretty straightforward abstraction similar to get/set list.
* lib: fix error handlingGravatar Tomi Valkeinen2014-01-18
| | | | | | | | | | | | | | | Currently if a Xapian exception happens in notmuch_message_get_header, the exception is not caught leading to crash. In notmuch_message_get_date the exception is caught, but an internal error is raised, again leading to crash. This patch fixes the error handling by making both functions catch the Xapian exceptions, print an error and return NULL or 0. The 'notmuch->exception_reported' is also set, as is done elsewhere, even if I don't really get the idea of that field. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
* cli: close config and do talloc report also on errorsGravatar Jani Nikula2014-01-18
| | | | Seems like the sensible thing to do.
* cli: clean up exit status code returned by the cli commandsGravatar Jani Nikula2014-01-18
| | | | | | Apart from the status codes for format mismatches, the non-zero exit status codes have been arbitrary. Make the cli consistently return either EXIT_SUCCESS or EXIT_FAILURE.
* emacs: tree: use tag-format-tagsGravatar Mark Walters2014-01-18
| | | | | | | | | | | | | | | | | Previously tree did not use tag-format-tags: since tree wants to distinguish matching messages from non-matching messages it is not a perfect fit. However, in preparation for allowing tag-changes to be shown (i.e., added or deleted tags to be indicated) it is convenient to make all places displaying tags call the same routines. We modify notmuch-tag-format-tags slightly so that it can take and argument for the default characteristics of the face before the special tag features are applied. This also means that things like the star symbol for flagged messages all work in tree.
* emacs: tree: default face for matching/non-matching messagesGravatar Mark Walters2014-01-18
| | | | | | | | | | | This adds default faces for matching and non-matching messages. This makes it easier for a user to do broad customization without having to customize every field. It also fits more neatly with the next patch which switches to using notmuch-tag-format-tags for tag formatting. We set the field specific face customization to nil for all the fields which use the message default face to make it clear to a user which fields customizations are being used.
* test: leave T\d\d\d- in variable $this_test and introduce $this_test_bareGravatar Tomi Ollila2014-01-18
| | | | | | | | | | | | Script `notmuch-test` expects the results file have T\d\d\d- part intact so the results files (and some test output files) are now name as such. Without this change `notmuch-test` will exit in case the test script it was executing exited with nonzero value. The T\d\d\d- part is dropped in new variable $this_test_bare which is used in progress informational messages and when loading .el files in emacs tests (whenever $this_test_bare.el exists).
* lib: fix clang compiler warningGravatar Jani Nikula2014-01-18
| | | | | | With some combination of clang and talloc, not using the return value of talloc_steal() produces a warning. Ignore it, as talloc_steal() has no failure modes per documentation.
* test: add test for syntax of emacs test libraryGravatar David Bremner2014-01-13
| | | | | | | | If there is a syntax error in the emacs test library, it causes other tests to hang or crash without a useful error message. This test could be eliminated if the error reporting for emacs tests was somehow improved.
* cli: initialize quiet variable in compactGravatar Jani Nikula2014-01-13
| | | | Surprisingly there's no compiler warning!
* test: renamed test scripts to format T\d\d\d-name.shGravatar Tomi Ollila2014-01-13
| | | | | | | | All test scripts to be executed are now named as T\d\d\d-name.sh, numers in increments of 10. This eases adding new tests and developers to see which are test scripts that are executed by test suite and in which order.
* test: basic: drop 'ensure all available tests are run'Gravatar Tomi Ollila2014-01-13
| | | | | | | | | When naming test scripts in format 'T\d\d\d-name.sh' the list of tests to run are created dynamically. This makes test 'Ensure that all available tests will be run by notmuch-test' in test/basic obsolete.
* emacs: tree remove comma separator tagsGravatar Mark Walters2014-01-13
| | | | | | | | | | | | Previously the tags on each line in tree view were separarted by ", " not just " ". This is different from show and search views. This patch removes this comma. This is a large patch as essentially every line of each of the expected outputs in the tree tests needs updating. Apart from aesthetic reasons this simplifies the switch to notmuch-tag-format-tags in the next patch.
* build: remove trailing '/.' when doing mkdir -p .deps/.Gravatar Tomi Ollila2014-01-13
| | | | | | | | When make variable $@ does not contain directory part, $(@D) resolves as '.'. In this case .deps/$(@D) is '.deps/.' In some systems `mkdir [-p] directory/.` fails. To make this compatible with more system substitute trailing '/.' (slashdot) with '' (empty string) whenever it occurs there.
* emacs: Makefile.local: HAVE_EMACS usage fixesGravatar Tomi Ollila2014-01-13
| | | | | | | | If we don't have emacs, disable targets that used EMACS while doing the recipes of that target. If we do have emacs, make install-emacs depend on *.elc files, as making the target will attempt to install those.