I'm programmtically create a new buffer as a result of shell command
(defun jira-ticket-view (&optional jira-ticket)
"Open Jira Ticket Inside Emacs"
(interactive)
(setq jiraURL (get-jira-url))
(setq jiraPrefix (get-jira-prefix))
(if (not jira-ticket)
(setq jira-ticket (get-jira-branch)))
(setq buffer jira-ticket)
(let ((b (get-buffer-create buffer)))
(switch-to-buffer b)
(markdown-mode)
(insert (
concat "## Open in Jira: [" jira-ticket "](" jiraURL "/browse/" jira-ticket ")\n"))
(insert (
concat "## Kanban Board: [Open Board](" jiraURL "/browse/" jiraPrefix ")\n"))
(insert (
concat "## My Open Issues: [Open Issues](" jiraURL "/projects/" jiraPrefix "/issues/" jira-ticket "?filter=myopenissues)\n\n"))
(insert (
shell-command-to-string (
concat "j view " jira-ticket " | dos2unix")))))
however when I'm in this buffer and trying to run a custom defun that expects some local variables to be set - such command fails with
list: Symbol’s value as variable is void: jira-project-users
this is my
.dir-locals.el
((nil . ((jira-project-prefix . "PROJ")
(jira-url . "https://domain.atlassian.net/")
(jira-project-workflow-states . ("Cancel" "Ready For Development" "In Progress" "Ready for Code Review" "Ready for QA" "Back to Backlog" "Stop Development" "Reopen" "Verified" "Accepted"))
(jira-project-users . ("User1" "User2" "User3"))
(projectile-project-test-cmd . "npm run unit")
(projectile-globally-ignored-files . ("node_modules"))
(projectile-register-project-type 'npm '("package.json")
:compile "npm install"
:test "npm test"
:run "npm run start"
:test-suffix "unit.js")
)))
and the following command fails if called in this buffer
list: Symbol’s value as variable is void: jira-project-users
(defun jira-ticket-assign (username &optional jira-ticket)
"Assign ticket to a user"
(interactive
(let ((completion-ignore-case t))
(list (completing-read "Assign to: " jira-project-users nil t)))
(message "You chose `%s'" username))
(if (not jira-ticket)
(setq jira-ticket (get-jira-branch)))
(setq result (shell-command-to-string (
concat "j assign " jira-ticket " " username)))
;(my-message "Result %s" result)
;(message "%s" (propertize result 'face '(:foreground "#A8E4A0"))))
(message (colorize-ok-error-message result)))