aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-04-11Get rid of old commented code and test function callsTeddy Wing
2018-04-11Add missing doc strings to functionsTeddy Wing
Fill in our TODO-ed doc strings with real descriptions.
2018-04-11Add package headersTeddy Wing
Still need to figure out the values for the "Package-Requires", "Keywords", and "URL" sections.
2018-04-11Add a `M-x` command to run the backup operationTeddy Wing
2018-04-11Prefix all functions and variables with `w3m-session-backup-`Teddy Wing
Since these are global Lisp-style functions, they need to be prefixed for namespacing. Looks like I'm going to call this package "w3m-session-backup" as I can't think of anything more concise and similarly descriptive. As per the Coding Conventions document, use a two-hyphen separator for private functions. > Use two hyphens to separate prefix and name if the symbol is not meant > to be used by other packages. (https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html#Coding-Conventions)
2018-04-11Rename `filename` variable to `filename-function`Teddy Wing
The Emacs "Coding Conventions" documentation (https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html#Coding-Conventions) recommends that variables that store functions be named ending in "-function".
2018-04-11Make the `filename` function user-customisableTeddy Wing
Allow users to customise the name of the file that gets generated and saved with a custom function.
2018-04-11Create a `w3m-session-backup` customisation groupTeddy Wing
It's apparently recommended that packages define groups for their custom variables. Do this, and put the `save-directory` custom variable we defined earlier in it.
2018-04-11Use `defcustom` instead of `setq` for the `save-directory` variableTeddy Wing
This allows us to document the variable and designate it as a user-customisable variable.
2018-04-11Add a reminder to make the filename customisableTeddy Wing
2018-04-11Add seconds to default filename timestampTeddy Wing
Helps to allow us to create multiple files. If multiple sessions are saved in the span of a minute, only the last session file for the minute is really persisted. This extends the chances of saving separate backup files.
2018-04-11Make the save directory configurableTeddy Wing
Put the save directory in a variable to make it configurable. Default it to the current directory. Thanks to Trey Jackson for the `FILE-NAME-AS-DIRECTORY` function: https://stackoverflow.com/questions/3964715/what-is-the-correct-way-to-join-multiple-path-components-into-a-single-complete/3964815#3964815
2018-04-11Replace hard-coded filename with a generated oneTeddy Wing
Generate a filename using the current date and time. Still saves to the home directory. That's the next step, we'll need to find a way to customise the save directory.
2018-04-11Wrap page title and URL in single quotes with escapeTeddy Wing
Ensure that special characters don't cause the YAML to be invalid by wrapping the URL and page title in quotes to force them to be strings. Escape any literal single quotes in the page title by doubling them. Didn't escape single quotes in the URL because I'm assuming any present will be URL encoded.
2018-04-11Save YAML to the fileTeddy Wing
* Change the temp file's extension to ".yml" * Remove blank line between pages * Output a YAML array of hashes containing the page titles and URLs in Copy URLs From All Tabs format
2018-04-11save-backup: Unwrap list around page titleTeddy Wing
Turns out `(last page 1)` didn't actually extract the page title string from the list previously created by `LAST`. To extract the title string from the list, just use `FIRST` and get rid of the now seemingly unnecessary third argument.
2018-04-11save-backup: Get rid of commented FORMAT callTeddy Wing
Ended up not using this. Wrote that when I started writing the function, but I ended up needed something a bit more complicated with maps and joins etc.
2018-04-11Fix file saving issuesTeddy Wing
* Use a real path for the temporary file because otherwise it either doesn't get saved, or I have no idea where it gets saved to. * Use the `INSERT` function to actually write the string to the temporary file buffer. * Use `(last page 1)` with the `1` argument at the end now as a way to try to get it to return us the string instead of a single-element list containing the page title. Not sure if this works though.
2018-04-11Write the session backup to a fileTeddy Wing
Use a temporary hard-coded file. Construct a string with each page turning into a URL and page title on separate lines, and a blank line between pages. Doesn't quite work just yet, but the general idea is there.
2018-04-11Get list of URL and page title pairsTeddy Wing
* Extract the list of crash recovery session buffers to a function to give it a name. I'll come up with a better name later. * Grab the first and last elements of each buffer sub-list and create tuples from them. This gives us a list of two-element lists containing the URL and title of the pages.
2018-04-11Get a list of w3m buffers from the saved session fileTeddy Wing
Grab the buffers saved to the "Crash recovery session" in "emacs-w3m"'s session file. Just list them for now. We'll be using this to create a backup file.